Skip to content
This repository has been archived by the owner on Feb 19, 2022. It is now read-only.

Experiment/touch events #505

Merged
merged 2 commits into from
Aug 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/components/containers/victory-brush-container.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);
}
}
}];
Expand Down
13 changes: 13 additions & 0 deletions src/components/containers/victory-cursor-container.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ export const cursorContainerMixin = (base) => class VictoryCursorContainer exten
onMouseLeave: () => {
return [];
},
onTouchCancel: () => {
return [];
},
onMouseMove: (evt, targetProps) => {
const mutations = CursorHelpers.onMouseMove(evt, targetProps);

Expand All @@ -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 [];
}
}
Expand Down
16 changes: 16 additions & 0 deletions src/components/containers/victory-selection-container.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);
}
}
}];
Expand Down
13 changes: 13 additions & 0 deletions src/components/containers/victory-voronoi-container.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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;
}
}
Expand Down
20 changes: 20 additions & 0 deletions src/components/containers/victory-zoom-container.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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();
Expand Down