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