Merge pull request #4229 from xyflow/fix/react-pan-win-touch
Fix/react pan win touch
This commit is contained in:
@@ -78,10 +78,9 @@ export function createPanOnScrollHandler({
|
||||
event.stopImmediatePropagation();
|
||||
|
||||
const currentZoom = d3Selection.property('__zoom').k || 1;
|
||||
const _isMacOs = isMacOs();
|
||||
|
||||
// macos sets ctrlKey=true for pinch gesture on a trackpad
|
||||
if (event.ctrlKey && zoomOnPinch && _isMacOs) {
|
||||
if (event.ctrlKey && zoomOnPinch) {
|
||||
const point = pointer(event);
|
||||
const pinchDelta = wheelDelta(event);
|
||||
const zoom = currentZoom * Math.pow(2, pinchDelta);
|
||||
@@ -98,7 +97,7 @@ export function createPanOnScrollHandler({
|
||||
let deltaY = panOnScrollMode === PanOnScrollMode.Horizontal ? 0 : event.deltaY * deltaNormalize;
|
||||
|
||||
// this enables vertical scrolling with shift + scroll on windows
|
||||
if (!_isMacOs && event.shiftKey && panOnScrollMode !== PanOnScrollMode.Vertical) {
|
||||
if (!isMacOs() && event.shiftKey && panOnScrollMode !== PanOnScrollMode.Vertical) {
|
||||
deltaX = event.deltaY * deltaNormalize;
|
||||
deltaY = 0;
|
||||
}
|
||||
@@ -208,6 +207,7 @@ export function createPanZoomEndHandler({
|
||||
if (event.sourceEvent?.internal) {
|
||||
return;
|
||||
}
|
||||
|
||||
zoomPanValues.isZoomingOrPanning = false;
|
||||
|
||||
if (
|
||||
|
||||
@@ -76,11 +76,7 @@ export function createFilter({
|
||||
}
|
||||
|
||||
// if the pane is only movable using allowed clicks
|
||||
if (
|
||||
Array.isArray(panOnDrag) &&
|
||||
!panOnDrag.includes(event.button) &&
|
||||
(event.type === 'mousedown' || event.type === 'touchstart')
|
||||
) {
|
||||
if (Array.isArray(panOnDrag) && !panOnDrag.includes(event.button) && event.type === 'mousedown') {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user