提交 68a1629d 编写于 作者: J Jason Park

Disable unnecessary zooming and panning in Chart/Log/MarkdownRenderer

上级 1f2381ac
......@@ -4,6 +4,13 @@ import styles from './stylesheet.scss';
import { classes } from '/common/util';
class Array2DRenderer extends Renderer {
constructor(props) {
super(props);
this.togglePan(true);
this.toggleZoom(true);
}
renderData() {
const { data } = this.props.data;
......
......@@ -9,6 +9,9 @@ class GraphRenderer extends Renderer {
this.element = React.createRef();
this.selectedNode = null;
this.togglePan(true);
this.toggleZoom(true);
}
handleMouseDown(e) {
......
......@@ -11,6 +11,12 @@ class Renderer extends React.Component {
this.handleMouseMove = this.handleMouseMove.bind(this);
this.handleMouseUp = this.handleMouseUp.bind(this);
this.handleWheel = this.handleWheel.bind(this);
this._handleMouseDown = this.handleMouseDown;
this._handleWheel = this.handleWheel;
this.togglePan(false);
this.toggleZoom(false);
this.lastX = null;
this.lastY = null;
this.centerX = 0;
......@@ -24,6 +30,14 @@ class Renderer extends React.Component {
componentDidUpdate(prevProps, prevState, snapshot) {
}
togglePan(enable = !this.handleMouseDown) {
this.handleMouseDown = enable ? this._handleMouseDown : undefined;
}
toggleZoom(enable = !this.handleWheel) {
this.handleWheel = enable ? this._handleWheel : undefined;
}
handleMouseDown(e) {
const { clientX, clientY } = e;
this.lastX = clientX;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册