Skip to content

Commit

Permalink
add touchAction prop
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiaoji Chen committed Jun 12, 2019
1 parent 8bdaa93 commit 5239223
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/api-reference/deck.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,14 @@ Canvas ID to allow style customization in CSS.

Css styles for the deckgl-canvas.

##### `touchAction` (String, optional)

Allow browser default touch actions. See [hammer.js doc](http://hammerjs.github.io/touch-action/).

Default: `none`.

By default, the deck canvas captures all touch interactions. This prop is useful for mobile applications to unblock default scrolling behavior. For example, use the combination `controller: {dragPan: false}` and `touchAction: 'pan-y'` to allow vertical page scroll when dragging over the canvas.

##### `pickingRadius` (Number, optional)

Extra pixels around the pointer to include while picking. This is helpful when rendered objects are difficult to target, for example irregularly shaped icons, small moving circles or interaction by touch. Default `0`.
Expand Down
3 changes: 3 additions & 0 deletions modules/core/src/lib/deck.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ function getPropTypes(PropTypes) {
parameters: PropTypes.object,
pickingRadius: PropTypes.number,
useDevicePixels: PropTypes.bool,
touchAction: PropTypes.string,

// Callbacks
onWebGLInitialized: PropTypes.func,
Expand Down Expand Up @@ -101,6 +102,7 @@ const defaultProps = {
views: null,
controller: null, // Rely on external controller, e.g. react-map-gl
useDevicePixels: true,
touchAction: 'none',
_animate: false,

onWebGLInitialized: noop,
Expand Down Expand Up @@ -586,6 +588,7 @@ export default class Deck {
this.props.onWebGLInitialized(gl);

this.eventManager = new EventManager(gl.canvas, {
touchAction: this.props.touchAction,
events: {
pointerdown: this._onPointerDown,
pointermove: this._onPointerMove,
Expand Down

0 comments on commit 5239223

Please sign in to comment.