Skip to content

Restoring Interaction.Hover on mobile

Pre-release
Pre-release
Compare
Choose a tag to compare
@crmorford crmorford released this 04 Mar 01:55
· 4652 commits to master since this release

This release fixes a regression caused in our last release, where Interaction.Hover stopped responding to Touch events as we switched from using D3 to writing our own implementation. We wrote Dispatcher.Touch to solve this problem. Mobile functionality for Interaction.Hover should now resemble functionality from v0.45.0 and before.

This release is occurring off-schedule in order to supply a fix for the regression as soon as possible. Note the version number change, which reflects the addition of new API points (see below).

v0.47.0

Features

Dispatcher.Touch

Dispatcher.Touch has been added. This Dispatcher reports the first touch position relative to the <svg> on touchstart, touchmove, and touchend events. Example usage:

var touchDispatcher = Plottable.Dispatcher.Touch.getDispatcher(svgElement);
touchDispatcher.onTouchStart("dispatcherKey", touchStartCallback);
touchDispatcher.onTouchMove("dispatcherKey", touchMoveCallback);
touchDispatcher.onTouchEnd("dispatcherKey", touchEndCallback);

Events passed to Dispatcher callbacks.

Dispatcher callbacks are now passed the original Event object, to allow for more customization of behavior. One example might be to call preventDefault() to suppress text-selection or other behavior.

Bugfixes

  • Interaction.Hover now responds to touchstart events. Initiating the touch event will have the same effect as moving the mouse to that position.
  • Scale.Time no longer locks up if both ends of the domain are set to the same value (#1689).

Upgrade Instructions:

Typescript Users: Please add the touch-events type definitions to your project.