feat(renderer): change layer order, allow zoom on nodes and user selection

This commit is contained in:
Christopher Möller
2020-10-06 13:08:38 +02:00
parent 4f757b86b9
commit 0373b53fc2
4 changed files with 28 additions and 6 deletions
+14 -2
View File
@@ -107,7 +107,19 @@ export default ({
useEffect(() => {
if (d3Zoom) {
d3Zoom.filter((event: any) => {
console.log(event);
if (selectionKeyPressed) {
return false;
}
// only allow zoom on nodes
if (event.target.closest('.react-flow__node') && event.type !== 'wheel') {
return false;
}
// only allow zoom on user selection
if (event.target.closest('.react-flow__nodesselection') && event.type !== 'wheel') {
return false;
}
if (!paneMoveable) {
return false;
@@ -124,5 +136,5 @@ export default ({
return !event.ctrlKey && !event.button;
});
}
}, [d3Zoom, zoomOnScroll, zoomOnDoubleClick, paneMoveable]);
}, [d3Zoom, zoomOnScroll, zoomOnDoubleClick, paneMoveable, selectionKeyPressed]);
};