refactor(zomm): simplify
This commit is contained in:
@@ -92,8 +92,7 @@ const ZoomPane = ({
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (d3Selection && d3Zoom) {
|
if (d3Selection && d3Zoom) {
|
||||||
if (panOnScroll && !zoomActivationKeyPressed) {
|
if (panOnScroll && !zoomActivationKeyPressed) {
|
||||||
d3Selection
|
d3Selection.on('wheel.zoom', (event: any) => {
|
||||||
.on('wheel', (event: any) => {
|
|
||||||
if (isWrappedWithClass(event, noWheelClassName)) {
|
if (isWrappedWithClass(event, noWheelClassName)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -123,18 +122,16 @@ const ZoomPane = ({
|
|||||||
-(deltaX / currentZoom) * panOnScrollSpeed,
|
-(deltaX / currentZoom) * panOnScrollSpeed,
|
||||||
-(deltaY / currentZoom) * panOnScrollSpeed
|
-(deltaY / currentZoom) * panOnScrollSpeed
|
||||||
);
|
);
|
||||||
})
|
});
|
||||||
.on('wheel.zoom', null);
|
|
||||||
} else if (typeof d3ZoomHandler !== 'undefined') {
|
} else if (typeof d3ZoomHandler !== 'undefined') {
|
||||||
d3Selection
|
d3Selection.on('wheel.zoom', function (event: any, d: any) {
|
||||||
.on('wheel', (event: any) => {
|
|
||||||
if (!preventScrolling || isWrappedWithClass(event, noWheelClassName)) {
|
if (!preventScrolling || isWrappedWithClass(event, noWheelClassName)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
})
|
d3ZoomHandler.call(this, event, d);
|
||||||
.on('wheel.zoom', d3ZoomHandler);
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [
|
}, [
|
||||||
|
|||||||
Reference in New Issue
Block a user