Skip to content

Commit

Permalink
Merge pull request williamngan#62 from tibotiber/fix/extra-drop
Browse files Browse the repository at this point in the history
Fix/extra drop
  • Loading branch information
williamngan authored May 27, 2019
2 parents 7643c01 + d02fa91 commit aaae365
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 5 deletions.
8 changes: 7 additions & 1 deletion dist/es2015/UI.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion dist/es5.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion dist/pts.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion src/UI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@ export class UIDragger extends UIButton {
constructor( group:GroupLike, shape:string, states:{[key:string]: any}={}, id?:string ) {
super( group, shape, states, id );
if (states.dragging === undefined) this._states['dragging'] = false;
if (states.moved === undefined) this._states['moved'] = false;
if (states.offset === undefined) this._states['offset'] = new Pt();

const UA = UIPointerActions;
Expand All @@ -434,6 +435,7 @@ export class UIDragger extends UIButton {
this._draggingID = this.on( UA.move, (t:UI, p:PtLike) => {
if ( this.state('dragging') ) {
UI._trigger( this._actions[UA.uidrag], t, p, UA.uidrag );
this.state( 'moved', true );
}
});
});
Expand All @@ -443,7 +445,10 @@ export class UIDragger extends UIButton {
this.state('dragging', false);
this.off(UA.move, this._draggingID); // remove 'all' listener
this.unhold( this._moveHoldID ); // // stop keeping hold of move
UI._trigger( this._actions[UA.drop], target, pt, type );
if ( this.state('moved') ) {
UI._trigger( this._actions[UA.drop], target, pt, type );
this.state( 'moved', false );
}
});

}
Expand Down

0 comments on commit aaae365

Please sign in to comment.