diff --git a/src/components/containers/victory-brush-container.js b/src/components/containers/victory-brush-container.js index a48d6f6c..dbef18a2 100644 --- a/src/components/containers/victory-brush-container.js +++ b/src/components/containers/victory-brush-container.js @@ -42,6 +42,9 @@ export const brushContainerMixin = (base) => class VictoryBrushContainer extends onMouseDown: (evt, targetProps) => { return BrushHelpers.onMouseDown(evt, targetProps); }, + onTouchStart: (evt, targetProps) => { + return BrushHelpers.onMouseDown(evt, targetProps); + }, onMouseMove: (evt, targetProps) => { const mutations = BrushHelpers.onMouseMove(evt, targetProps); @@ -52,11 +55,27 @@ export const brushContainerMixin = (base) => class VictoryBrushContainer extends return undefined; }, + onTouchMove: (evt, targetProps) => { + const mutations = BrushHelpers.onMouseMove(evt, targetProps); + + if (mutations.id !== this.mouseMoveMutationId) { // eslint-disable-line + this.mouseMoveMutationId = mutations.id; // eslint-disable-line + return mutations.mutations; + } + + return undefined; + }, onMouseUp: (evt, targetProps) => { return BrushHelpers.onMouseUp(evt, targetProps); }, + onTouchEnd: (evt, targetProps) => { + return BrushHelpers.onMouseUp(evt, targetProps); + }, onMouseLeave: (evt, targetProps) => { return BrushHelpers.onMouseLeave(evt, targetProps); + }, + onTouchCancel: (evt, targetProps) => { + return BrushHelpers.onMouseLeave(evt, targetProps); } } }]; diff --git a/src/components/containers/victory-cursor-container.js b/src/components/containers/victory-cursor-container.js index 0e95c822..be594f29 100644 --- a/src/components/containers/victory-cursor-container.js +++ b/src/components/containers/victory-cursor-container.js @@ -44,6 +44,9 @@ export const cursorContainerMixin = (base) => class VictoryCursorContainer exten onMouseLeave: () => { return []; }, + onTouchCancel: () => { + return []; + }, onMouseMove: (evt, targetProps) => { const mutations = CursorHelpers.onMouseMove(evt, targetProps); @@ -52,6 +55,16 @@ export const cursorContainerMixin = (base) => class VictoryCursorContainer exten return mutations.mutations; } + return []; + }, + onTouchMove: (evt, targetProps) => { + const mutations = CursorHelpers.onMouseMove(evt, targetProps); + + if (mutations.id !== this.mouseMoveMutationId) { // eslint-disable-line + this.mouseMoveMutationId = mutations.id; // eslint-disable-line + return mutations.mutations; + } + return []; } } diff --git a/src/components/containers/victory-selection-container.js b/src/components/containers/victory-selection-container.js index 07dac19d..b2442623 100644 --- a/src/components/containers/victory-selection-container.js +++ b/src/components/containers/victory-selection-container.js @@ -30,6 +30,9 @@ export const selectionContainerMixin = (base) => class VictorySelectionContainer onMouseDown: (evt, targetProps) => { return SelectionHelpers.onMouseDown(evt, targetProps); }, + onTouchStart: (evt, targetProps) => { + return SelectionHelpers.onMouseDown(evt, targetProps); + }, onMouseMove: (evt, targetProps) => { const mutations = SelectionHelpers.onMouseMove(evt, targetProps); @@ -40,8 +43,21 @@ export const selectionContainerMixin = (base) => class VictorySelectionContainer return undefined; }, + onTouchMove: (evt, targetProps) => { + const mutations = SelectionHelpers.onMouseMove(evt, targetProps); + + if (mutations.id !== this.mouseMoveMutationId) { // eslint-disable-line + this.mouseMoveMutationId = mutations.id; // eslint-disable-line + return mutations.mutations; + } + + return undefined; + }, onMouseUp: (evt, targetProps) => { return SelectionHelpers.onMouseUp(evt, targetProps); + }, + onTouchEnd: (evt, targetProps) => { + return SelectionHelpers.onMouseUp(evt, targetProps); } } }]; diff --git a/src/components/containers/victory-voronoi-container.js b/src/components/containers/victory-voronoi-container.js index ab1f775d..b2fc7caf 100644 --- a/src/components/containers/victory-voronoi-container.js +++ b/src/components/containers/victory-voronoi-container.js @@ -29,6 +29,9 @@ export const voronoiContainerMixin = (base) => class VictoryVoronoiContainer ext onMouseLeave: (evt, targetProps) => { return VoronoiHelpers.onMouseLeave(evt, targetProps); }, + onTouchCancel: (evt, targetProps) => { + return VoronoiHelpers.onMouseLeave(evt, targetProps); + }, onMouseMove: (evt, targetProps) => { const mutations = VoronoiHelpers.onMouseMove(evt, targetProps); @@ -37,6 +40,16 @@ export const voronoiContainerMixin = (base) => class VictoryVoronoiContainer ext return mutations.mutations; } + return undefined; + }, + onTouchMove: (evt, targetProps) => { + const mutations = VoronoiHelpers.onMouseMove(evt, targetProps); + + if (mutations.id !== this.mouseMoveMutationId) { // eslint-disable-line + this.mouseMoveMutationId = mutations.id; // eslint-disable-line + return mutations.mutations; + } + return undefined; } } diff --git a/src/components/containers/victory-zoom-container.js b/src/components/containers/victory-zoom-container.js index 850bec43..07bf1636 100644 --- a/src/components/containers/victory-zoom-container.js +++ b/src/components/containers/victory-zoom-container.js @@ -36,12 +36,21 @@ export const zoomContainerMixin = (base) => class VictoryZoomContainer extends b onMouseDown: (evt, targetProps) => { return ZoomHelpers.onMouseDown(evt, targetProps); }, + onTouchStart: (evt, targetProps) => { + return ZoomHelpers.onMouseDown(evt, targetProps); + }, onMouseUp: (evt, targetProps) => { return ZoomHelpers.onMouseUp(evt, targetProps); }, + onTouchEnd: (evt, targetProps) => { + return ZoomHelpers.onMouseUp(evt, targetProps); + }, onMouseLeave: (evt, targetProps) => { return ZoomHelpers.onMouseLeave(evt, targetProps); }, + onTouchCancel: (evt, targetProps) => { + return ZoomHelpers.onMouseLeave(evt, targetProps); + }, onMouseMove: (evt, targetProps, eventKey, ctx) => { // eslint-disable-line max-params evt.preventDefault(); const mutations = ZoomHelpers.onMouseMove(evt, targetProps, eventKey, ctx); @@ -53,6 +62,17 @@ export const zoomContainerMixin = (base) => class VictoryZoomContainer extends b return undefined; }, + onTouchMove: (evt, targetProps, eventKey, ctx) => { // eslint-disable-line max-params + evt.preventDefault(); + const mutations = ZoomHelpers.onMouseMove(evt, targetProps, eventKey, ctx); + + if (mutations.id !== this.mouseMoveMutationId) { // eslint-disable-line + this.mouseMoveMutationId = mutations.id; // eslint-disable-line + return mutations.mutations; + } + + return undefined; + }, onWheel: (evt, targetProps, eventKey, ctx) => { // eslint-disable-line max-params if (targetProps.allowZoom) { evt.preventDefault();