Skip to content

Commit ef5191a

Browse files
committed
fix plot performance
1 parent 026a6b1 commit ef5191a

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

lib/plots/canopy.js

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,6 @@ export class Pannable extends Etch {
7979

8080
this.isLoaded = false
8181

82-
// force update, so readAfterUpdate gets executed
83-
this.update()
8482
if (item && item.nodeName && item.nodeName.toLowerCase() === 'img') {
8583
item.onload = () => {
8684
etch.update(this).then(() => {
@@ -92,16 +90,12 @@ export class Pannable extends Etch {
9290
} else {
9391
this.isLoaded = true
9492
}
95-
this.update()
93+
etch.update(this)
9694
}
9795

9896
readAfterUpdate () {
9997
this.innerContainerRect = this.refs.innerContainer.getBoundingClientRect()
10098
this.outerContainerRect = this.refs.outerContainer.getBoundingClientRect()
101-
102-
this.setInitialScale(this.item)
103-
104-
etch.update(this)
10599
}
106100

107101
setInitialScale (item) {
@@ -117,18 +111,20 @@ export class Pannable extends Etch {
117111
}
118112

119113
resetAll () {
114+
this.setInitialScale(this.item)
120115
this.scale = this.initialScale
121116
this.left = 0
122117
this.top = 0
123-
this.update()
118+
119+
etch.update(this)
124120
}
125121

126122
ondrag({movementX, movementY}) {
127123
if (!this.dragging) return;
128124

129125
this.left += movementX
130126
this.top += movementY
131-
this.update();
127+
etch.update(this);
132128
}
133129

134130
zoom(e, amount) {
@@ -151,7 +147,7 @@ export class Pannable extends Etch {
151147
this.left -= x*zoom - x
152148
this.top -= y*zoom - y
153149
}
154-
this.update();
150+
etch.update(this);
155151
}
156152

157153
toolbarView () {

0 commit comments

Comments
 (0)