File tree Expand file tree Collapse file tree 5 files changed +45
-2
lines changed Expand file tree Collapse file tree 5 files changed +45
-2
lines changed Original file line number Diff line number Diff line change @@ -314,7 +314,15 @@ exports.mixin = {
314
314
} ,
315
315
316
316
fireSyntheticDropEvent : function ( dropEvent ) {
317
- return dispatchGridEvent . call ( this , 'fin-drop' , dropEvent ) ;
317
+ var dropIndex = this . getRowIndexFromMousePoint ( {
318
+ x : dropEvent . detail . primitiveEvent . x ,
319
+ y : dropEvent . detail . primitiveEvent . y
320
+ } ) ;
321
+
322
+ return dispatchGridEvent . call ( this , 'fin-drop' , {
323
+ dropIndex : dropIndex ,
324
+ headerRowCount : this . getHeaderRowCount ( )
325
+ } , dropEvent . detail . primitiveEvent ) ;
318
326
} ,
319
327
320
328
fireSyntheticDocumentDragEvent : function ( dragEvent ) {
Original file line number Diff line number Diff line change @@ -1265,6 +1265,10 @@ var Hypergrid = Base.extend('Hypergrid', {
1265
1265
return this . renderer . getGridCellFromMousePoint ( mouse ) ;
1266
1266
} ,
1267
1267
1268
+ getRowIndexFromMousePoint : function ( mouse : Point ) {
1269
+ return this . renderer . getRowIndexFromMousePoint ( mouse ) ;
1270
+ } ,
1271
+
1268
1272
/**
1269
1273
* @param {Point } gridCell - The pixel location of the mouse in physical grid coordinates.
1270
1274
* @returns {Rectangle } The pixel based bounds rectangle given a data cell point.
Original file line number Diff line number Diff line change @@ -831,6 +831,13 @@ var defaults = {
831
831
*/
832
832
useHiDPI : true ,
833
833
834
+ /**
835
+ * @default
836
+ * @type {boolean }
837
+ * @memberOf module:defaults
838
+ */
839
+ enableDropHint : false ,
840
+
834
841
/**
835
842
* @summary Mappings for cell navigation keys.
836
843
* @desc Cell navigation is handled in the {@link CellSelection} "feature".
Original file line number Diff line number Diff line change @@ -25,6 +25,10 @@ export class Drag extends FeatureBase {
25
25
}
26
26
27
27
handleDocumentDragOver ( grid : any , event : { detail : { primitiveEvent : DragEvent } } ) : void {
28
+ if ( ! grid . properties . enableDropHint ) {
29
+ return
30
+ }
31
+
28
32
this . renderDragHint ( grid , event )
29
33
this . scrollOnEdge ( grid , event )
30
34
if ( this . next ) {
@@ -33,12 +37,18 @@ export class Drag extends FeatureBase {
33
37
}
34
38
35
39
handleDocumentDragEnd ( grid : any , event : any ) : void {
36
- this . dragHint . style . display = 'none'
37
40
if ( this . next ) {
38
41
this . next . handleDocumentDragEnd ( grid , event ) ;
39
42
}
40
43
}
41
44
45
+ handleDrop ( grid : any , event : any ) : void {
46
+ this . dragHint . style . display = 'none'
47
+ if ( this . next ) {
48
+ this . next . handleDrop ( grid , event ) ;
49
+ }
50
+ }
51
+
42
52
scrollOnEdge ( grid , event ) {
43
53
var cell = grid . getGridCellFromMousePoint ( event . detail . mouse )
44
54
const halfCellHeight = cell . cellEvent . bounds . height / 2
Original file line number Diff line number Diff line change @@ -340,6 +340,20 @@ var Renderer = Base.extend('Renderer', {
340
340
return result ;
341
341
} ,
342
342
343
+ getRowIndexFromMousePoint : function ( point ) {
344
+ var y = point . y
345
+ var vrs = this . visibleRows
346
+ var vr = vrs . find ( function ( vr ) { return y < vr . bottom ; } ) ;
347
+
348
+ if ( vr !== undefined ) {
349
+ var onLowerHalf = y > ( vr . top + ( vr . bottom - vr . top ) / 2 )
350
+ return onLowerHalf ? vr . index + 1 : vr . index ;
351
+ }
352
+
353
+ // last row
354
+ return vrs [ vrs . length - 1 ] . index + 1 ;
355
+ } ,
356
+
343
357
/**
344
358
* Matrix of unformatted values of visible cells.
345
359
* @returns {Array<Array> }
You can’t perform that action at this time.
0 commit comments