This repository was archived by the owner on Jul 30, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 38
This repository was archived by the owner on Jul 30, 2018. It is now read-only.
Scrolling, Gesture and Dragging abstraction via meta #571
Copy link
Copy link
Closed
Milestone
Description
Enhancement
Implementing gestures and scrolling present several challenges:
- They require intimate knowledge of the DOM and DOM events.
- They are somewhat inconsistent across browsers.
- To truly model the user action, it requires the widget to break encapsulation of the DOM to listen for events outside of its own DOM structure.
- Currently require duplication of code across widgets needing to support these features.
Therefore we should consider abstracting these features via the meta API. Conceptually an interaction would look something like this:
- Widget indicates that it wasn't to know about scrolling for itself or one of its keys.
- The meta manager ensure that it is listening for the proper events if it isn't already.
- When the scroll event occurs that applies to the widget, it invalidates the widget.
- When the widget renders, it requests the information about the scroll position.
Additional considerations:
- Integration and further abstraction of the Intersection Observers meta?
- Implement a full drag and drop solution, including target acceptance and other features over time?
- For scrolling, it would be a good idea to deal in abstract concepts and likely would need to integrate into the dimensions meta as well. For example, it would be good if the widget could offload the calculation of the changes from a relative value to a specific value. Specifically, given a horizontal scroll event, the widget would have offered up some relative scale to meta on subscription (e.g.
100
) and the change would be relative. (e.g.1
or-1
) and to the meta dimensions it could say "tell me what my absolute scroll top would be if the change was a relative-1
out of100
). That way, the widget would have no need to be concerned about its absolute values, it simply would trust whatever is returned is accurate.
Prior art/references:
- HammerJS
- Dojo 1 DND
- pep.js - Already included with widget core
- touch-action (can effect when the action is triggered, reducing delay)
Refs: #507