File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed
Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,9 @@ DirectSelect.fireActionable = function(state) {
2828} ;
2929
3030DirectSelect . startDragging = function ( state , e ) {
31- state . initialDragPanState = this . map . dragPan . isEnabled ( ) ;
31+ if ( state . initialDragPanState == null ) {
32+ state . initialDragPanState = this . map . dragPan . isEnabled ( ) ;
33+ }
3234
3335 this . map . dragPan . disable ( ) ;
3436 state . canDragMove = true ;
@@ -39,6 +41,8 @@ DirectSelect.stopDragging = function(state) {
3941 if ( state . canDragMove && state . initialDragPanState === true ) {
4042 this . map . dragPan . enable ( ) ;
4143 }
44+
45+ state . initialDragPanState = null ;
4246 state . dragMoving = false ;
4347 state . canDragMove = false ;
4448 state . dragMoveLocation = null ;
Original file line number Diff line number Diff line change @@ -53,6 +53,33 @@ test('direct_select', async (t) => {
5353 }
5454 } ) ;
5555
56+ await t . test ( 'direct_select - double click should not disable enabled dragPan' , async ( ) => {
57+ const ids = Draw . add ( getGeoJSON ( 'polygon' ) ) ;
58+
59+ Draw . changeMode ( Constants . modes . DIRECT_SELECT , {
60+ featureId : ids [ 0 ]
61+ } ) ;
62+
63+ await afterNextRender ( ) ;
64+
65+ spy ( map . dragPan , 'enable' ) ;
66+ spy ( map . dragPan , 'disable' ) ;
67+
68+
69+ for ( let i = 0 ; i < 2 ; i ++ ) {
70+ map . fire ( 'mousedown' , makeMouseEvent ( 35 , 25 ) ) ;
71+ await afterNextRender ( ) ;
72+ }
73+
74+ map . fire ( 'mousemove' , makeMouseEvent ( 0 , 0 ) ) ;
75+
76+ assert . equal ( map . dragPan . enable . callCount , 1 , 'dragPan.enable called' ) ;
77+
78+ map . dragPan . enable . restore ( ) ;
79+ map . dragPan . disable . restore ( ) ;
80+ } ) ;
81+
82+
5683 await t . test ( 'direct_select - should fire correct actionable when no vertices selected' , async ( ) => {
5784 const ids = Draw . add ( getGeoJSON ( 'polygon' ) ) ;
5885 Draw . changeMode ( Constants . modes . SIMPLE_SELECT , {
You can’t perform that action at this time.
0 commit comments