Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/extra drop #62

Merged
merged 2 commits into from
May 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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