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

Support disable() mid drag or rotate gesture #6232

Merged
merged 3 commits into from
Feb 26, 2018
Merged

Support disable() mid drag or rotate gesture #6232

merged 3 commits into from
Feb 26, 2018

Conversation

jfirebaugh
Copy link
Contributor

@jfirebaugh jfirebaugh commented Feb 26, 2018

Moves DragPanHandler and DragRotateHandler closer to a state machine based implementation, so that, when disabled, they can perform the appropriate actions in any state.

These two handlers have four states:

  • disabled: The handler is disabled, and should not respond to any input.
  • enabled: The handler is enabled but has not started receiving any input.
  • pending: The handler has received a mousedown or touchstart event, but not a subsequent move event.
  • active: The handler has received a mousedown or touchstart event and at least one subsequent move event.

Disabling a handler in the enabled state doesn't generally require anything special. Disabling a handler in the pending state requires unbinding some event listeners. Disabling a handler in the active state requires unbinding some event listeners, sending appropriate *end events, and not triggering an inertial camera animation.

Fixes #2419.

delete this._lastMoveEvent;
delete this._previousPos;
delete this._pos;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just noting: because there's a state called 'active', I (briefly) found it confusing to have a method called _deactivate that doesn't affect this.state... but I can't think of any better names.

@jfirebaugh jfirebaugh merged commit d25eb3f into master Feb 26, 2018
@jfirebaugh jfirebaugh deleted the disable branch February 26, 2018 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support dragPan.disable() mid-drag
2 participants