@netless/app-presentation 0.1.9-beta.4 → 0.1.9-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netless/app-presentation",
3
- "version": "0.1.9-beta.4",
3
+ "version": "0.1.9-beta.5",
4
4
  "description": "Netless App for presentation slides (images)",
5
5
  "author": "netless",
6
6
  "license": "MIT",
@@ -69,9 +69,8 @@ export class Scrollbar {
69
69
 
70
70
  setReadonly(bol: boolean){
71
71
  this.readonly = bol;
72
- if (this.readonly) {
73
- this.destroy()
74
- } else {
72
+ this.destroy()
73
+ if (!this.readonly) {
75
74
  this.init();
76
75
  }
77
76
  }
@@ -219,15 +218,27 @@ export class Scrollbar {
219
218
 
220
219
  destroy() {
221
220
  this.view.callbacks.off('onCameraUpdated', this.onCameraUpdated);
222
- this.scrollbarX?.remove();
223
- this.scrollbarY?.remove();
224
- this.scrollbarX = undefined;
225
- this.scrollbarY = undefined;
226
-
227
- this.draggableX?.destroy();
228
- this.draggableY?.destroy();
229
- this.draggableX = undefined;
230
- this.draggableY = undefined;
221
+ if (this.scrollbarX && this.scrollbarContainerX) {
222
+ this.scrollbarContainerX.removeChild(this.scrollbarX);
223
+ this.scrollbarX.remove();
224
+ this.scrollbarContainerX.remove();
225
+ this.scrollbarX = undefined;
226
+ }
227
+ if (this.scrollbarY && this.scrollbarContainerY) {
228
+ this.scrollbarContainerY.removeChild(this.scrollbarY);
229
+ this.scrollbarY.remove();
230
+ this.scrollbarContainerY.remove();
231
+ this.scrollbarY = undefined;
232
+ }
233
+ if (this.draggableX) {
234
+ this.draggableX.destroy();
235
+ this.draggableX = undefined;
236
+ }
237
+ if (this.draggableY) {
238
+ this.draggableY.destroy();
239
+ this.draggableY = undefined;
240
+ }
241
+
231
242
  }
232
243
 
233
244
  }