File tree Expand file tree Collapse file tree 3 files changed +24
-0
lines changed
src/frontend/core/renderers Expand file tree Collapse file tree 3 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,13 @@ import styles from './stylesheet.scss';
4
4
import { classes } from '/common/util' ;
5
5
6
6
class Array2DRenderer extends Renderer {
7
+ constructor ( props ) {
8
+ super ( props ) ;
9
+
10
+ this . togglePan ( true ) ;
11
+ this . toggleZoom ( true ) ;
12
+ }
13
+
7
14
renderData ( ) {
8
15
const { data } = this . props . data ;
9
16
Original file line number Diff line number Diff line change @@ -9,6 +9,9 @@ class GraphRenderer extends Renderer {
9
9
10
10
this . element = React . createRef ( ) ;
11
11
this . selectedNode = null ;
12
+
13
+ this . togglePan ( true ) ;
14
+ this . toggleZoom ( true ) ;
12
15
}
13
16
14
17
handleMouseDown ( e ) {
Original file line number Diff line number Diff line change @@ -11,6 +11,12 @@ class Renderer extends React.Component {
11
11
this . handleMouseMove = this . handleMouseMove . bind ( this ) ;
12
12
this . handleMouseUp = this . handleMouseUp . bind ( this ) ;
13
13
this . handleWheel = this . handleWheel . bind ( this ) ;
14
+
15
+ this . _handleMouseDown = this . handleMouseDown ;
16
+ this . _handleWheel = this . handleWheel ;
17
+ this . togglePan ( false ) ;
18
+ this . toggleZoom ( false ) ;
19
+
14
20
this . lastX = null ;
15
21
this . lastY = null ;
16
22
this . centerX = 0 ;
@@ -24,6 +30,14 @@ class Renderer extends React.Component {
24
30
componentDidUpdate ( prevProps , prevState , snapshot ) {
25
31
}
26
32
33
+ togglePan ( enable = ! this . handleMouseDown ) {
34
+ this . handleMouseDown = enable ? this . _handleMouseDown : undefined ;
35
+ }
36
+
37
+ toggleZoom ( enable = ! this . handleWheel ) {
38
+ this . handleWheel = enable ? this . _handleWheel : undefined ;
39
+ }
40
+
27
41
handleMouseDown ( e ) {
28
42
const { clientX, clientY } = e ;
29
43
this . lastX = clientX ;
You can’t perform that action at this time.
0 commit comments