Skip to content

Commit 9fce342

Browse files
committed
wip(card-list): /**ignore*/ some renderer fields, delete code
1 parent 0836b35 commit 9fce342

File tree

1 file changed

+15
-24
lines changed

1 file changed

+15
-24
lines changed

packages/angular-skyhook-card-list/src/card-renderer.directive.ts

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
import {
99
SkyhookDndService,
1010
Offset,
11-
DropTargetMonitor,
1211
DragSource, DropTarget
1312
} from "angular-skyhook";
1413
import { DraggedItem, SortableSpec, Size } from "./types";
@@ -40,12 +39,14 @@ export class CardRendererDirective<Data> implements OnInit, OnDestroy {
4039
get index() { return this.context.index; }
4140
get horizontal() { return this.context.horizontal; }
4241

42+
/** @ignore */
4343
private get spec() { return this.context.spec; }
4444

45+
/** @ignore */
4546
private subs = new Subscription();
4647

4748
/** @ignore */
48-
target: DropTarget<DraggedItem<Data>> = this.dnd.dropTarget<DraggedItem<Data>>(null, {
49+
private target: DropTarget<DraggedItem<Data>> = this.dnd.dropTarget<DraggedItem<Data>>(null, {
4950
// this is a hover-only situation
5051
canDrop: () => false,
5152
hover: monitor => {
@@ -94,6 +95,7 @@ export class CardRendererDirective<Data> implements OnInit, OnDestroy {
9495
) {
9596
}
9697

98+
/** @ignore */
9799
private createItem(): DraggedItem<Data> {
98100
return {
99101
data: this.data,
@@ -109,10 +111,12 @@ export class CardRendererDirective<Data> implements OnInit, OnDestroy {
109111
};
110112
}
111113

114+
/** @ignore */
112115
private sameIds = (data: Data, other: DraggedItem<Data>) => {
113116
return data && other.data && this.spec.trackBy(data) === this.spec.trackBy(other.data);
114117
}
115118

119+
/** @ignore */
116120
private isDragging(item: DraggedItem<Data> | null) {
117121
const isD = this.spec && this.spec.isDragging || this.sameIds;
118122
return item && isD(this.data, item) || false;
@@ -144,7 +148,8 @@ export class CardRendererDirective<Data> implements OnInit, OnDestroy {
144148
// '----------------------'
145149
//
146150

147-
hover(item: DraggedItem<Data>, clientOffset: Offset): void {
151+
/** @ignore */
152+
private hover(item: DraggedItem<Data>, clientOffset: Offset): void {
148153
// hovering on yourself should do nothing
149154
if (this.isDragging(item)) {
150155
return;
@@ -197,7 +202,7 @@ export class CardRendererDirective<Data> implements OnInit, OnDestroy {
197202
}
198203

199204
/** @ignore */
200-
rect() {
205+
private rect() {
201206
if (!this.el) {
202207
throw new Error("angular-skyhook-sortable: cardRenderer expected to be attached to a real DOM element");
203208
}
@@ -206,31 +211,17 @@ export class CardRendererDirective<Data> implements OnInit, OnDestroy {
206211
}
207212

208213
/** @ignore */
209-
size() {
210-
return new Size(this.width(), this.height());
211-
}
212-
213-
/** @ignore */
214-
width() {
214+
private size() {
215215
const rect = this.rect();
216-
return rect.width || rect.right - rect.left;
216+
const width = rect.width || rect.right - rect.left;
217+
const height = rect.height || rect.bottom - rect.top;
218+
return new Size(width, height);
217219
}
218220

219221
/** @ignore */
220-
height() {
222+
private top() {
221223
const rect = this.rect();
222-
return rect.height || rect.bottom - rect.top;
223-
}
224-
225-
/** @ignore */
226-
top() {
227-
return this.horizontal ? this.rect().left : this.rect().top;
228-
}
229-
230-
/** @ignore */
231-
mouse(monitor: DropTargetMonitor) {
232-
const offset = monitor.getClientOffset();
233-
return !!offset && (this.horizontal ? offset.x : offset.y);
224+
return this.horizontal ? rect.left : rect.top;
234225
}
235226

236227
ngOnInit() {

0 commit comments

Comments
 (0)