File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -119,6 +119,7 @@ Version 2.0.5 - "Tanchico" - in development
119119* Stage.backgroundColor now properly accepts hex #RRGGBB and color values 0xRRGGBB again (fix #785 )
120120* Color.getRGB would return incorrect color components if a color value without alpha was given, now works with both 0xRRGGBB and 0xAARRGGBB.
121121* Color.getWebRGB now works regardless if you give an 0xRRGGBB or 0xAARRGGBB color value.
122+ * If an object was drag enabled with bringToTop, the onDragStop event wouldn't fire until the mouse was next moved (thanks @alpera , fix #813 )
122123
123124
124125### To Do
Original file line number Diff line number Diff line change @@ -165,6 +165,12 @@ Phaser.InputHandler = function (sprite) {
165165 */
166166 this . consumePointerEvent = false ;
167167
168+ /**
169+ * @property {boolean } _dragPhase - Internal cache var.
170+ * @private
171+ */
172+ this . _dragPhase = false ;
173+
168174 /**
169175 * @property {boolean } _wasEnabled - Internal cache var.
170176 * @private
@@ -273,6 +279,11 @@ Phaser.InputHandler.prototype = {
273279 */
274280 addedToGroup : function ( ) {
275281
282+ if ( this . _dragPhase )
283+ {
284+ return ;
285+ }
286+
276287 if ( this . _wasEnabled && ! this . enabled )
277288 {
278289 this . start ( ) ;
@@ -288,6 +299,11 @@ Phaser.InputHandler.prototype = {
288299 */
289300 removedFromGroup : function ( ) {
290301
302+ if ( this . _dragPhase )
303+ {
304+ return ;
305+ }
306+
291307 if ( this . enabled )
292308 {
293309 this . _wasEnabled = true ;
@@ -907,7 +923,7 @@ Phaser.InputHandler.prototype = {
907923 }
908924
909925 // Stop drag
910- if ( this . draggable && this . isDragged && this . _draggedPointerID == pointer . id )
926+ if ( this . draggable && this . isDragged && this . _draggedPointerID === pointer . id )
911927 {
912928 this . stopDrag ( pointer ) ;
913929 }
@@ -1194,6 +1210,7 @@ Phaser.InputHandler.prototype = {
11941210
11951211 if ( this . bringToTop )
11961212 {
1213+ this . _dragPhase = true ;
11971214 this . sprite . bringToTop ( ) ;
11981215 }
11991216
@@ -1211,6 +1228,7 @@ Phaser.InputHandler.prototype = {
12111228 this . isDragged = false ;
12121229 this . _draggedPointerID = - 1 ;
12131230 this . _pointerData [ pointer . id ] . isDragged = false ;
1231+ this . _dragPhase = false ;
12141232
12151233 if ( this . snapOnRelease )
12161234 {
Original file line number Diff line number Diff line change @@ -505,7 +505,7 @@ Phaser.Pointer.prototype = {
505505
506506 this . timeUp = this . game . time . now ;
507507
508- if ( this . game . input . multiInputOverride == Phaser . Input . MOUSE_OVERRIDES_TOUCH || this . game . input . multiInputOverride == Phaser . Input . MOUSE_TOUCH_COMBINE || ( this . game . input . multiInputOverride == Phaser . Input . TOUCH_OVERRIDES_MOUSE && this . game . input . currentPointers === 0 ) )
508+ if ( this . game . input . multiInputOverride === Phaser . Input . MOUSE_OVERRIDES_TOUCH || this . game . input . multiInputOverride === Phaser . Input . MOUSE_TOUCH_COMBINE || ( this . game . input . multiInputOverride = == Phaser . Input . TOUCH_OVERRIDES_MOUSE && this . game . input . currentPointers === 0 ) )
509509 {
510510 this . game . input . onUp . dispatch ( this , event ) ;
511511
You can’t perform that action at this time.
0 commit comments