Merge pull request #3593 from leavest/wheel-event

Fix bug 56+ chrome can't prevent default wheel events.
This commit is contained in:
Simon
2019-04-12 09:13:33 +02:00
committed by GitHub

View File

@@ -63,10 +63,16 @@ class ZoomableCanvas extends React.Component {
this.updateZoomLimits(this.props);
this.restoreZoomState(this.props);
document
.getElementById('canvas')
.addEventListener('wheel', this.handleZoom, { passive: false });
}
componentWillUnmount() {
this.debouncedCacheZoom.cancel();
document
.getElementById('canvas')
.removeEventListener('wheel', this.handleZoom, { passive: false });
}
componentWillReceiveProps(nextProps) {
@@ -104,7 +110,7 @@ class ZoomableCanvas extends React.Component {
return (
<div className="zoomable-canvas">
<svg id="canvas" className={className} onClick={this.props.onClick} onWheel={this.handleZoom}>
<svg id="canvas" className={className} onClick={this.props.onClick}>
<Logo transform="translate(24,24) scale(0.25)" />
<g className="zoom-content">
{this.props.children(this.state)}