-
Notifications
You must be signed in to change notification settings - Fork 623
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for touch and pinch in interactions #4208
Comments
How difficult is this and do we need anything else in Vega @arvind? |
I think this is already possible. Perhaps, someone should provide an example and we can close this. |
This is surely working in Vega, https://vega.github.io/vega/examples/zoomable-scatter-plot/. |
https://github.com/uwdata/falcon also works on mobile. |
This issue is about seeing whether it's possible to manually customize the events in VL to capture touch as well. #4661 is about supporting this by default. |
At this falcon website it seems the anchorpoint is snapping to the left or right edge handlers of the interval. |
Can you elaborate? |
Touch works indeed, I can't get the pinch to work. Example for creating interval selection box (rectangle will be orange if using touch events): {
"$schema": "https://vega.github.io/schema/vega-lite/v3.json",
"data": {"url": "data/cars.json"},
"selection": {
"MOUSE": {
"type": "interval",
"on": "[mousedown, mouseup] > mousemove",
"translate": "[mousedown, mouseup] > mousemove"
},
"TOUCH": {
"type": "interval",
"on": "[touchstart, touchend] > touchmove",
"translate": "[touchstart, touchend] > touchmove",
"mark": {"fill": "#fdbb84", "fillOpacity": 0.5, "stroke": "#e34a33"}
}
},
"mark": "rect",
"encoding": {
"y": {"field": "Origin", "type": "ordinal"},
"x": {"field": "Cylinders", "type": "ordinal"},
"color": {
"condition": {
"selection": {"or": ["MOUSE", "TOUCH"]},
"aggregate": "count",
"type": "quantitative"
},
"value": "grey"
}
}
} And an example where one can pan when two touch events are captured. So the panning is only captured when you touch with one finger somewhere outside the chart and pan the chart with another finger: {
"$schema": "https://vega.github.io/schema/vega-lite/v3.json",
"data": {"url": "data/cars.json"},
"selection": {
"MOUSE": {
"type": "interval", "bind": "scales",
"translate": "[mousedown, window:mouseup] > window:mousemove!"
},
"TOUCH": {
"type": "interval", "bind": "scales",
"translate": "[touchstart[event.touches.length===2], touchend] > touchmove"
}
},
"mark": "circle",
"encoding": {
"x": {
"field": "Horsepower", "type": "quantitative",
"scale": {"domain": [75, 150]}
},
"y": {
"field": "Miles_per_Gallon", "type": "quantitative",
"scale": {"domain": [20, 40]}
},
"size": {"field": "Cylinders", "type": "quantitative"}
}
} For the last only the I can't get the pinching to work within Also when looking to the underlying created Vega, it doesn't combine the mouse and touch events within a single |
Thanks for the video! I filed vega/falcon#123. I guess we can close this issue here then and discuss how we can support this natively in #4661. |
Any idea of how to make this work with |
Currently there is only support for mouse click, mouse move and scroll for vega-lite declared interactions.
It would be great if this was extended with touch touchmove and pinch.
The text was updated successfully, but these errors were encountered: