8
8
import {
9
9
SkyhookDndService ,
10
10
Offset ,
11
- DropTargetMonitor ,
12
11
DragSource , DropTarget
13
12
} from "angular-skyhook" ;
14
13
import { DraggedItem , SortableSpec , Size } from "./types" ;
@@ -40,12 +39,14 @@ export class CardRendererDirective<Data> implements OnInit, OnDestroy {
40
39
get index ( ) { return this . context . index ; }
41
40
get horizontal ( ) { return this . context . horizontal ; }
42
41
42
+ /** @ignore */
43
43
private get spec ( ) { return this . context . spec ; }
44
44
45
+ /** @ignore */
45
46
private subs = new Subscription ( ) ;
46
47
47
48
/** @ignore */
48
- target : DropTarget < DraggedItem < Data > > = this . dnd . dropTarget < DraggedItem < Data > > ( null , {
49
+ private target : DropTarget < DraggedItem < Data > > = this . dnd . dropTarget < DraggedItem < Data > > ( null , {
49
50
// this is a hover-only situation
50
51
canDrop : ( ) => false ,
51
52
hover : monitor => {
@@ -94,6 +95,7 @@ export class CardRendererDirective<Data> implements OnInit, OnDestroy {
94
95
) {
95
96
}
96
97
98
+ /** @ignore */
97
99
private createItem ( ) : DraggedItem < Data > {
98
100
return {
99
101
data : this . data ,
@@ -109,10 +111,12 @@ export class CardRendererDirective<Data> implements OnInit, OnDestroy {
109
111
} ;
110
112
}
111
113
114
+ /** @ignore */
112
115
private sameIds = ( data : Data , other : DraggedItem < Data > ) => {
113
116
return data && other . data && this . spec . trackBy ( data ) === this . spec . trackBy ( other . data ) ;
114
117
}
115
118
119
+ /** @ignore */
116
120
private isDragging ( item : DraggedItem < Data > | null ) {
117
121
const isD = this . spec && this . spec . isDragging || this . sameIds ;
118
122
return item && isD ( this . data , item ) || false ;
@@ -144,7 +148,8 @@ export class CardRendererDirective<Data> implements OnInit, OnDestroy {
144
148
// '----------------------'
145
149
//
146
150
147
- hover ( item : DraggedItem < Data > , clientOffset : Offset ) : void {
151
+ /** @ignore */
152
+ private hover ( item : DraggedItem < Data > , clientOffset : Offset ) : void {
148
153
// hovering on yourself should do nothing
149
154
if ( this . isDragging ( item ) ) {
150
155
return ;
@@ -197,7 +202,7 @@ export class CardRendererDirective<Data> implements OnInit, OnDestroy {
197
202
}
198
203
199
204
/** @ignore */
200
- rect ( ) {
205
+ private rect ( ) {
201
206
if ( ! this . el ) {
202
207
throw new Error ( "angular-skyhook-sortable: cardRenderer expected to be attached to a real DOM element" ) ;
203
208
}
@@ -206,31 +211,17 @@ export class CardRendererDirective<Data> implements OnInit, OnDestroy {
206
211
}
207
212
208
213
/** @ignore */
209
- size ( ) {
210
- return new Size ( this . width ( ) , this . height ( ) ) ;
211
- }
212
-
213
- /** @ignore */
214
- width ( ) {
214
+ private size ( ) {
215
215
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 ) ;
217
219
}
218
220
219
221
/** @ignore */
220
- height ( ) {
222
+ private top ( ) {
221
223
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 ;
234
225
}
235
226
236
227
ngOnInit ( ) {
0 commit comments