mirror of https://github.com/node-red/node-red.git
Prevent UI pinch-to-zoom while keeping canvas zoomable
- Add touch-action CSS to prevent pinch-zoom on UI elements - Apply touch-action: pan-x pan-y to html, body, and editor - Apply touch-action: none to canvas for custom gestures - Add JavaScript prevention for touchpad pinch on non-canvas areas - Block Ctrl+wheel events outside the workspace chartpull/5312/head
parent
3e2fb85821
commit
bf73261ecb
|
|
@ -757,6 +757,13 @@ RED.view = (function() {
|
|||
var wheelEventContinuityThreshold = 100; // Events within 100ms are same gesture
|
||||
var gestureEndThreshold = 500; // 500ms+ gap means gesture ended
|
||||
|
||||
// Prevent browser zoom on non-canvas areas
|
||||
document.addEventListener("wheel", function(e) {
|
||||
if (e.ctrlKey && !e.target.closest('#red-ui-workspace-chart')) {
|
||||
e.preventDefault();
|
||||
}
|
||||
}, { passive: false });
|
||||
|
||||
chart.on("wheel", function(evt) {
|
||||
// ctrlKey is set during pinch gestures on trackpads
|
||||
if (evt.ctrlKey || evt.altKey || spacebarPressed) {
|
||||
|
|
|
|||
|
|
@ -17,8 +17,9 @@
|
|||
**/
|
||||
|
||||
|
||||
body {
|
||||
html, body {
|
||||
overflow: hidden;
|
||||
touch-action: pan-x pan-y;
|
||||
}
|
||||
|
||||
.red-ui-editor {
|
||||
|
|
@ -29,6 +30,7 @@ body {
|
|||
background: var(--red-ui-primary-background);
|
||||
color: var(--red-ui-primary-text-color);
|
||||
line-height: 20px;
|
||||
touch-action: pan-x pan-y;
|
||||
}
|
||||
|
||||
#red-ui-editor {
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@
|
|||
right:0px;
|
||||
box-sizing:border-box;
|
||||
transition: right 0.2s ease;
|
||||
touch-action: none;
|
||||
&:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue