Fix touchmove event handling for panning workspace

pull/5371/head
Nick O'Leary 2025-12-04 14:35:22 +00:00
parent 108b861ae0
commit ea5cc1f53c
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
1 changed files with 13 additions and 10 deletions

View File

@ -2150,24 +2150,27 @@ RED.view = (function() {
function startPanning () {
}
window.addEventListener('mousemove', function (event) {
window.addEventListener('mousemove', windowMouseMove)
window.addEventListener('touchmove', windowMouseMove)
function windowMouseMove (event) {
if (mouse_mode === RED.state.PANNING) {
var pos = [event.pageX, event.pageY];
// if (d3.event.touches) {
// var touch0 = d3.event.touches.item(0);
// pos = [touch0.pageX, touch0.pageY];
// }
var deltaPos = [
let pos = [event.pageX, event.pageY]
if (event.touches) {
let touch0 = event.touches.item(0)
pos = [touch0.pageX, touch0.pageY]
}
const deltaPos = [
mouse_position[0]-pos[0],
mouse_position[1]-pos[1]
];
]
chart.scrollLeft(scroll_position[0]+deltaPos[0])
chart.scrollTop(scroll_position[1]+deltaPos[1])
RED.events.emit("view:navigate");
return
}
})
}
function canvasMouseMove() {
var i;
var node;