@netless/forge-slide 1.0.0 → 1.0.2

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/dist/index.js CHANGED
@@ -61167,7 +61167,11 @@ var ElementModel = class _ElementModel {
61167
61167
  return this.root.get(_ElementModel.KEYS.pointsMatrix) || [1, 0, 0, 1, 0, 0];
61168
61168
  }
61169
61169
  get points() {
61170
- return this.root.get(_ElementModel.KEYS.points).toArray();
61170
+ const list = this.root.get(_ElementModel.KEYS.points);
61171
+ if (list) {
61172
+ return list.toArray();
61173
+ }
61174
+ return [];
61171
61175
  }
61172
61176
  set ownerId(value) {
61173
61177
  this.root.set(_ElementModel.KEYS.ownerId, value);
@@ -61810,7 +61814,12 @@ var LineTool = class extends WhiteboardTool {
61810
61814
  if (this.elementModel) {
61811
61815
  this.elementModel.dispose();
61812
61816
  }
61813
- this.elementModel = this.modelGetter().createLinePath(true);
61817
+ this.elementModel = null;
61818
+ this.modelGetter().then((model) => {
61819
+ if (model) {
61820
+ this.elementModel = model.createLinePath(true);
61821
+ }
61822
+ });
61814
61823
  this.from = event.point.clone();
61815
61824
  this.to = event.point.clone();
61816
61825
  }
@@ -63702,7 +63711,12 @@ var CurveTool = class extends WhiteboardTool {
63702
63711
  if (this.elementModel) {
63703
63712
  this.elementModel.dispose();
63704
63713
  }
63705
- this.elementModel = this.modelGetter().createCurve(true);
63714
+ this.elementModel = null;
63715
+ this.modelGetter().then((model) => {
63716
+ if (model) {
63717
+ this.elementModel = model.createCurve(true);
63718
+ }
63719
+ });
63706
63720
  }
63707
63721
  onMouseDrag(event) {
63708
63722
  if (this.pointCount > 1024) {
@@ -63729,34 +63743,41 @@ var CurveTool = class extends WhiteboardTool {
63729
63743
  }
63730
63744
  }
63731
63745
  onMouseUp(event) {
63732
- if (this.pointCount < 3 && this.elementModel) {
63733
- this.modelGetter().removeElementItem(this.elementModel.uuid);
63734
- }
63735
- if (this.elementModel) {
63736
- this.elementModel.shadow = "";
63737
- }
63738
- if (this.elementModel && event.event.metaKey) {
63739
- const result = this.recognizer.recognize(this.elementModel.points);
63740
- if (result) {
63741
- this.modelGetter().removeElementItem(this.elementModel.uuid);
63742
- if (/^rectangle/.test(result.shape)) {
63743
- const model = this.modelGetter().createRectangle(false);
63744
- model?.setPoints([result.minX, result.minY, result.maxX, result.maxY]);
63745
- } else if (/^circle/.test(result.shape)) {
63746
- const model = this.modelGetter().createSegmentedPath("ellipse", false);
63747
- const rect = new this.scope.Rectangle(new this.scope.Point(result.minX, result.minY), new this.scope.Point(result.maxX, result.maxY));
63748
- const pathRect = new this.scope.Path.Ellipse(rect);
63749
- const points = serializePath(pathRect);
63750
- model?.setPoints(points);
63751
- } else if (/^triangle/.test(result.shape)) {
63752
- const model = this.modelGetter().createTriangle(false);
63753
- model?.setPoints([result.minX + (result.maxX - result.minX) / 2, result.minY, result.minX, result.maxY, result.maxX, result.maxY]);
63754
- } else if (/^arrow/.test(result.shape)) {
63755
- const model = this.modelGetter().createLinePath(false);
63756
- model?.setPoints([result.minX, (result.maxY + result.minY) / 2, result.maxX, (result.maxY + result.minY) / 2]);
63746
+ this.modelGetter().then((model) => {
63747
+ if (!model) {
63748
+ return;
63749
+ }
63750
+ if (this.pointCount < 3 && this.elementModel) {
63751
+ if (this.elementModel) {
63752
+ model.removeElementItem(this.elementModel.uuid);
63757
63753
  }
63758
63754
  }
63759
- }
63755
+ if (this.elementModel) {
63756
+ this.elementModel.shadow = "";
63757
+ }
63758
+ if (this.elementModel && event.event.metaKey) {
63759
+ const result = this.recognizer.recognize(this.elementModel.points);
63760
+ if (result) {
63761
+ model.removeElementItem(this.elementModel.uuid);
63762
+ if (/^rectangle/.test(result.shape)) {
63763
+ const rect = model.createRectangle(false);
63764
+ rect?.setPoints([result.minX, result.minY, result.maxX, result.maxY]);
63765
+ } else if (/^circle/.test(result.shape)) {
63766
+ const circle = model.createSegmentedPath("ellipse", false);
63767
+ const rect = new this.scope.Rectangle(new this.scope.Point(result.minX, result.minY), new this.scope.Point(result.maxX, result.maxY));
63768
+ const pathRect = new this.scope.Path.Ellipse(rect);
63769
+ const points = serializePath(pathRect);
63770
+ circle?.setPoints(points);
63771
+ } else if (/^triangle/.test(result.shape)) {
63772
+ const triangle = model.createTriangle(false);
63773
+ triangle?.setPoints([result.minX + (result.maxX - result.minX) / 2, result.minY, result.minX, result.maxY, result.maxX, result.maxY]);
63774
+ } else if (/^arrow/.test(result.shape)) {
63775
+ const arrow = model.createLinePath(false);
63776
+ arrow?.setPoints([result.minX, (result.maxY + result.minY) / 2, result.maxX, (result.maxY + result.minY) / 2]);
63777
+ }
63778
+ }
63779
+ }
63780
+ });
63760
63781
  }
63761
63782
  };
63762
63783
  function _defineProperty20(e, r, t) {
@@ -63789,7 +63810,12 @@ var RectangleTool = class extends WhiteboardTool {
63789
63810
  if (this.elementModel) {
63790
63811
  this.elementModel.dispose();
63791
63812
  }
63792
- this.elementModel = this.modelGetter().createRectangle(true);
63813
+ this.elementModel = null;
63814
+ this.modelGetter().then((model) => {
63815
+ if (model) {
63816
+ this.elementModel = model.createRectangle(true);
63817
+ }
63818
+ });
63793
63819
  this.from = event.point.clone();
63794
63820
  this.to = event.point.clone();
63795
63821
  }
@@ -63804,7 +63830,11 @@ var RectangleTool = class extends WhiteboardTool {
63804
63830
  this.elementModel.shadow = "";
63805
63831
  }
63806
63832
  if (this.elementModel && this.from && this.from.getDistance(event.point) < 3) {
63807
- this.modelGetter().removeElementItem(this.elementModel.uuid);
63833
+ this.modelGetter().then((model) => {
63834
+ if (model && this.elementModel) {
63835
+ model.removeElementItem(this.elementModel.uuid);
63836
+ }
63837
+ });
63808
63838
  }
63809
63839
  }
63810
63840
  };
@@ -63942,11 +63972,16 @@ var SelectorTool = class extends WhiteboardTool {
63942
63972
  if (this.elementModel) {
63943
63973
  this.elementModel.dispose();
63944
63974
  }
63945
- this.elementModel = this.modelGetter().createSelector();
63946
- this.from = event.point.clone();
63947
- this.to = event.point.clone();
63948
- const rect = new this.scope.Rectangle(this.from, this.to);
63949
- this.elementModel?.setPoints([rect.topLeft.x, rect.topLeft.y, rect.size.width, rect.size.height]);
63975
+ this.elementModel = null;
63976
+ this.modelGetter().then((model) => {
63977
+ if (model) {
63978
+ this.elementModel = model.createSelector();
63979
+ this.from = event.point.clone();
63980
+ this.to = event.point.clone();
63981
+ const rect = new this.scope.Rectangle(this.from, this.to);
63982
+ this.elementModel?.setPoints([rect.topLeft.x, rect.topLeft.y, rect.size.width, rect.size.height]);
63983
+ }
63984
+ });
63950
63985
  this.selectElements.clear();
63951
63986
  }
63952
63987
  onMouseDrag(event) {
@@ -63968,7 +64003,11 @@ var SelectorTool = class extends WhiteboardTool {
63968
64003
  }
63969
64004
  onMouseUp(event) {
63970
64005
  if (this.elementModel) {
63971
- this.modelGetter().removeElementItem(this.elementModel.uuid);
64006
+ this.modelGetter().then((model) => {
64007
+ if (model && this.elementModel) {
64008
+ model.removeElementItem(this.elementModel.uuid);
64009
+ }
64010
+ });
63972
64011
  }
63973
64012
  const elements = Array.from(this.selectElements.keys()).reduce((result, next) => {
63974
64013
  result.push({
@@ -64894,41 +64933,46 @@ var TextTool = class extends WhiteboardTool {
64894
64933
  if (this.elementModel) {
64895
64934
  this.elementModel.dispose();
64896
64935
  }
64897
- this.elementModel = this.modelGetter().createPointText(x, y, true);
64898
- if (this.elementModel === null) {
64899
- return;
64900
- }
64901
- const editorContainer = window.document.createElement("div");
64902
- const canvasBounds = this.canvasElement.getBoundingClientRect();
64903
- editorContainer.style.cssText = `position:absolute;transform:translate(-50%, -50%);top:50%;left:50%;width:${canvasBounds.width}px;height:${canvasBounds.height}px;`;
64904
- const editor = new TextEditor(this.camera);
64905
- editor.setOrigin(x, y);
64906
- editorContainer.appendChild(editor.rootView);
64907
- this.rootView.appendChild(editorContainer);
64908
- editor.setFontSize(this.toolbarModel.fontSize);
64909
- editor.setFontFamily(this.toolbarModel.fontFamily);
64910
- this.camera.triggerZoom();
64911
- editor.on("caretOutRight", () => {
64912
- });
64913
- editor.on("change", (content) => {
64914
- if (this.elementModel) {
64915
- this.elementModel.content = content;
64916
- }
64917
- });
64918
- editor.on("done", () => {
64919
- if (this.elementModel) {
64920
- if (!this.elementModel.content || this.elementModel.content.length === 0) {
64921
- this.modelGetter().removeElementItem(this.elementModel.uuid);
64922
- } else {
64923
- this.elementModel.shadow = "";
64936
+ this.elementModel = null;
64937
+ this.modelGetter().then((model) => {
64938
+ if (model) {
64939
+ this.elementModel = model.createPointText(x, y, true);
64940
+ if (this.elementModel === null) {
64941
+ return;
64924
64942
  }
64943
+ const editorContainer = window.document.createElement("div");
64944
+ const canvasBounds = this.canvasElement.getBoundingClientRect();
64945
+ editorContainer.style.cssText = `position:absolute;transform:translate(-50%, -50%);top:50%;left:50%;width:${canvasBounds.width}px;height:${canvasBounds.height}px;`;
64946
+ const editor = new TextEditor(this.camera);
64947
+ editor.setOrigin(x, y);
64948
+ editorContainer.appendChild(editor.rootView);
64949
+ this.rootView.appendChild(editorContainer);
64950
+ editor.setFontSize(this.toolbarModel.fontSize);
64951
+ editor.setFontFamily(this.toolbarModel.fontFamily);
64952
+ this.camera.triggerZoom();
64953
+ editor.on("caretOutRight", () => {
64954
+ });
64955
+ editor.on("change", (content) => {
64956
+ if (this.elementModel) {
64957
+ this.elementModel.content = content;
64958
+ }
64959
+ });
64960
+ editor.on("done", () => {
64961
+ if (this.elementModel) {
64962
+ if (!this.elementModel.content || this.elementModel.content.length === 0) {
64963
+ model.removeElementItem(this.elementModel.uuid);
64964
+ } else {
64965
+ this.elementModel.shadow = "";
64966
+ }
64967
+ }
64968
+ editor.dispose();
64969
+ this.rootView.removeChild(editorContainer);
64970
+ });
64971
+ setTimeout(() => {
64972
+ editor.focus();
64973
+ }, 30);
64925
64974
  }
64926
- editor.dispose();
64927
- this.rootView.removeChild(editorContainer);
64928
64975
  });
64929
- setTimeout(() => {
64930
- editor.focus();
64931
- }, 30);
64932
64976
  }
64933
64977
  };
64934
64978
  function _defineProperty27(e, r, t) {
@@ -65435,7 +65479,12 @@ var EllipseTool = class extends WhiteboardTool {
65435
65479
  if (this.elementModel) {
65436
65480
  this.elementModel.dispose();
65437
65481
  }
65438
- this.elementModel = this.modelGetter().createSegmentedPath("ellipse", true);
65482
+ this.elementModel = null;
65483
+ this.modelGetter().then((model) => {
65484
+ if (model) {
65485
+ this.elementModel = model.createSegmentedPath("ellipse", true);
65486
+ }
65487
+ });
65439
65488
  this.from = event.point.clone();
65440
65489
  this.to = event.point.clone();
65441
65490
  }
@@ -65450,7 +65499,11 @@ var EllipseTool = class extends WhiteboardTool {
65450
65499
  }
65451
65500
  onMouseUp(event) {
65452
65501
  if (this.elementModel && this.from && this.from.getDistance(event.point) < 3) {
65453
- this.modelGetter().removeElementItem(this.elementModel.uuid);
65502
+ this.modelGetter().then((model) => {
65503
+ if (model && this.elementModel) {
65504
+ model.removeElementItem(this.elementModel.uuid);
65505
+ }
65506
+ });
65454
65507
  } else {
65455
65508
  if (this.elementModel) {
65456
65509
  this.elementModel.shadow = "";
@@ -65488,7 +65541,12 @@ var TriangleTool = class extends WhiteboardTool {
65488
65541
  if (this.elementModel) {
65489
65542
  this.elementModel.dispose();
65490
65543
  }
65491
- this.elementModel = this.modelGetter().createTriangle(true);
65544
+ this.elementModel = null;
65545
+ this.modelGetter().then((model) => {
65546
+ if (model) {
65547
+ this.elementModel = model.createTriangle(true);
65548
+ }
65549
+ });
65492
65550
  this.from = event.point.clone();
65493
65551
  this.to = event.point.clone();
65494
65552
  }
@@ -65500,7 +65558,11 @@ var TriangleTool = class extends WhiteboardTool {
65500
65558
  }
65501
65559
  onMouseUp(event) {
65502
65560
  if (this.elementModel && this.from && this.from.getDistance(event.point) < 3) {
65503
- this.modelGetter().removeElementItem(this.elementModel.uuid);
65561
+ this.modelGetter().then((model) => {
65562
+ if (model && this.elementModel) {
65563
+ model.removeElementItem(this.elementModel.uuid);
65564
+ }
65565
+ });
65504
65566
  }
65505
65567
  if (this.elementModel) {
65506
65568
  this.elementModel.shadow = "";
@@ -65529,6 +65591,7 @@ var Whiteboard = class extends import_eventemitter38.default {
65529
65591
  super();
65530
65592
  _defineProperty31(this, "view", void 0);
65531
65593
  _defineProperty31(this, "selfUserId", void 0);
65594
+ _defineProperty31(this, "window", void 0);
65532
65595
  _defineProperty31(this, "permissions", void 0);
65533
65596
  _defineProperty31(this, "tool", void 0);
65534
65597
  _defineProperty31(this, "fontSize", void 0);
@@ -65610,7 +65673,12 @@ var EraserTool = class extends WhiteboardTool {
65610
65673
  if (this.elementModel) {
65611
65674
  this.elementModel.dispose();
65612
65675
  }
65613
- this.elementModel = this.modelGetter().createEraser();
65676
+ this.elementModel = null;
65677
+ this.modelGetter().then((model) => {
65678
+ if (model) {
65679
+ this.elementModel = model.createEraser();
65680
+ }
65681
+ });
65614
65682
  }
65615
65683
  onMouseDrag(event) {
65616
65684
  if (this.pointCount > 1024) {
@@ -65643,7 +65711,11 @@ var EraserTool = class extends WhiteboardTool {
65643
65711
  }
65644
65712
  onMouseUp(_event) {
65645
65713
  if (this.elementModel) {
65646
- this.modelGetter().removeElementItem(this.elementModel.uuid);
65714
+ this.modelGetter().then((model) => {
65715
+ if (model && this.elementModel) {
65716
+ model.removeElementItem(this.elementModel.uuid);
65717
+ }
65718
+ });
65647
65719
  }
65648
65720
  this.trashedElementsModel.removeAllTrashedElementsForSelf();
65649
65721
  }
@@ -65795,7 +65867,12 @@ var LaserPointerTool = class extends WhiteboardTool {
65795
65867
  if (this.elementModel) {
65796
65868
  this.elementModel.dispose();
65797
65869
  }
65798
- this.elementModel = this.modelGetter().createLaserPointer();
65870
+ this.elementModel = null;
65871
+ this.modelGetter().then((model) => {
65872
+ if (model) {
65873
+ this.elementModel = model.createLaserPointer();
65874
+ }
65875
+ });
65799
65876
  }
65800
65877
  onMouseDrag(event) {
65801
65878
  if (this.pointCount > 1024) {
@@ -66405,7 +66482,12 @@ var StraightLineTool = class extends WhiteboardTool {
66405
66482
  if (this.elementModel) {
66406
66483
  this.elementModel.dispose();
66407
66484
  }
66408
- this.elementModel = this.modelGetter().createStraightLine(true);
66485
+ this.elementModel = null;
66486
+ this.modelGetter().then((model) => {
66487
+ if (model) {
66488
+ this.elementModel = model.createStraightLine(true);
66489
+ }
66490
+ });
66409
66491
  this.from = event.point.clone();
66410
66492
  this.to = event.point.clone();
66411
66493
  }
@@ -66420,7 +66502,11 @@ var StraightLineTool = class extends WhiteboardTool {
66420
66502
  this.elementModel.shadow = "";
66421
66503
  }
66422
66504
  if (this.elementModel && this.from && this.from.getDistance(event.point) < 3) {
66423
- this.modelGetter().removeElementItem(this.elementModel.uuid);
66505
+ this.modelGetter().then((model) => {
66506
+ if (model && this.elementModel) {
66507
+ model.removeElementItem(this.elementModel.uuid);
66508
+ }
66509
+ });
66424
66510
  }
66425
66511
  }
66426
66512
  };
@@ -66691,7 +66777,7 @@ var AsyncMap = class {
66691
66777
  if (!window.__forge_gl_wb_status__) {
66692
66778
  window.__forge_gl_wb_status__ = new AsyncMap();
66693
66779
  }
66694
- var WhiteboardApplication = class extends import_forge_room.AbstractApplication {
66780
+ var WhiteboardApplication = class _WhiteboardApplication extends import_forge_room.AbstractApplication {
66695
66781
  get undoManager() {
66696
66782
  const page = this.pageModel.getCurrentPage(this.userId);
66697
66783
  if (page) {
@@ -66894,12 +66980,20 @@ var WhiteboardApplication = class extends import_forge_room.AbstractApplication
66894
66980
  }
66895
66981
  }
66896
66982
  });
66897
- _defineProperty43(this, "getCurrentRenderableModel", () => {
66983
+ _defineProperty43(this, "getCurrentRendererModel", () => {
66898
66984
  const layerId = this.userMap(this.userId).get(WhiteboardKeys.currentPage);
66899
- if (!this.layers.has(layerId)) {
66900
- this.emitter.emit("error", 300002, `target page: ${layerId} not found`);
66985
+ if (this.layers.has(layerId)) {
66986
+ return Promise.resolve(this.layers.get(layerId));
66987
+ } else {
66988
+ return waitUntil(() => this.layers.has(layerId), 1e3).then(() => {
66989
+ if (this.layers.has(layerId)) {
66990
+ return this.layers.get(layerId);
66991
+ } else {
66992
+ this.emitter.emit("error", 300002, `target page: ${layerId} not found`);
66993
+ return null;
66994
+ }
66995
+ });
66901
66996
  }
66902
- return this.layers.get(layerId);
66903
66997
  });
66904
66998
  _defineProperty43(this, "handleElementClear", () => {
66905
66999
  this.shadowScope.project.activeLayer.removeChildren();
@@ -67195,11 +67289,17 @@ var WhiteboardApplication = class extends import_forge_room.AbstractApplication
67195
67289
  }
67196
67290
  };
67197
67291
  this.emitter.clearPage = () => {
67198
- const model = this.getCurrentRenderableModel();
67199
- model.elements.doc.transact(() => {
67200
- model.elements.clear();
67201
- }, elementsUndoOrigin);
67202
- model.elementModels.clear();
67292
+ this.getCurrentRendererModel().then((model) => {
67293
+ if (model) {
67294
+ if (model.elements.doc) {
67295
+ model.elements.doc.transact(() => {
67296
+ model.elements.clear();
67297
+ }, elementsUndoOrigin);
67298
+ } else {
67299
+ model.elementModels.clear();
67300
+ }
67301
+ }
67302
+ });
67203
67303
  };
67204
67304
  this.emitter.undo = () => {
67205
67305
  this.undoManager?.undo();
@@ -67234,9 +67334,11 @@ var WhiteboardApplication = class extends import_forge_room.AbstractApplication
67234
67334
  this.liveCursor.showLiveCursor = value;
67235
67335
  };
67236
67336
  this.emitter.updateViewport = (width, height) => {
67337
+ (0, import_forge_room.log)(`call updateViewport with width: ${width}, height: ${height}`);
67237
67338
  this.updateOptionSize(width, height);
67238
67339
  };
67239
67340
  this.emitter.__setMainCanvasVisible = (visible) => {
67341
+ (0, import_forge_room.log)(`call __setMainCanvasVisible with visible: ${visible}`);
67240
67342
  this.canvasElement.style.opacity = visible ? "1" : "0";
67241
67343
  };
67242
67344
  this.emitter.on("error", (errorCode, errorMessage) => {
@@ -67250,6 +67352,7 @@ var WhiteboardApplication = class extends import_forge_room.AbstractApplication
67250
67352
  return that.delayTranslateOut;
67251
67353
  },
67252
67354
  set(value) {
67355
+ (0, import_forge_room.log)(`call __delayTranslateOut with value: ${value}`);
67253
67356
  that.delayTranslateOut = value;
67254
67357
  }
67255
67358
  });
@@ -67347,6 +67450,8 @@ var WhiteboardApplication = class extends import_forge_room.AbstractApplication
67347
67450
  return this.getMap(`user/${userId}`);
67348
67451
  }
67349
67452
  async initialize(option) {
67453
+ _WhiteboardApplication.instanceCount.set(this.appId, (_WhiteboardApplication.instanceCount.get(this.appId) ?? 0) + 1);
67454
+ (0, import_forge_room.log)(`whiteboard ${this.appId} initialize. instance count: ${_WhiteboardApplication.instanceCount.get(this.appId) ?? 0}`, {}, "info");
67350
67455
  this.permissions = new WhiteboardPermissions(this.userManager, (userId) => {
67351
67456
  return this.userMap(userId);
67352
67457
  });
@@ -67421,18 +67526,18 @@ var WhiteboardApplication = class extends import_forge_room.AbstractApplication
67421
67526
  return this.userMap(userId);
67422
67527
  });
67423
67528
  this.tools = {
67424
- pointer: new PointerTool(this.enableToolEvent, this.getCurrentRenderableModel, this.shadowEmitter, this.paperScope),
67425
- curve: new CurveTool(this.enableToolEvent, this.getCurrentRenderableModel, this.shadowEmitter, this.paperScope),
67426
- rectangle: new RectangleTool(this.enableToolEvent, this.getCurrentRenderableModel, this.shadowEmitter, this.paperScope),
67427
- selector: new SelectorTool(this.enableToolEvent, this.getCurrentRenderableModel, this.shadowEmitter, this.paperScope, this.selectElementsModel),
67428
- arrow: new LineTool(this.enableToolEvent, this.getCurrentRenderableModel, this.shadowEmitter, this.paperScope),
67429
- line: new StraightLineTool(this.enableToolEvent, this.getCurrentRenderableModel, this.shadowEmitter, this.paperScope),
67430
- text: new TextTool(this.enableToolEvent, this.getCurrentRenderableModel, this.shadowEmitter, this.paperScope, this.rootElement, this.canvasElement, this.toolbarModel, this.camera),
67431
- ellipse: new EllipseTool(this.enableToolEvent, this.getCurrentRenderableModel, this.shadowEmitter, this.paperScope),
67432
- triangle: new TriangleTool(this.enableToolEvent, this.getCurrentRenderableModel, this.shadowEmitter, this.paperScope),
67433
- eraser: new EraserTool(this.enableToolEvent, this.getCurrentRenderableModel, this.shadowEmitter, this.paperScope, this.trashedElementsModel, this.shadowScope),
67434
- laser: new LaserPointerTool(this.enableToolEvent, this.getCurrentRenderableModel, this.shadowEmitter, this.paperScope),
67435
- grab: new GrabTool(this.enableToolEvent, this.getCurrentRenderableModel, this.shadowEmitter, this.paperScope, this.camera)
67529
+ pointer: new PointerTool(this.enableToolEvent, this.getCurrentRendererModel, this.shadowEmitter, this.paperScope),
67530
+ curve: new CurveTool(this.enableToolEvent, this.getCurrentRendererModel, this.shadowEmitter, this.paperScope),
67531
+ rectangle: new RectangleTool(this.enableToolEvent, this.getCurrentRendererModel, this.shadowEmitter, this.paperScope),
67532
+ selector: new SelectorTool(this.enableToolEvent, this.getCurrentRendererModel, this.shadowEmitter, this.paperScope, this.selectElementsModel),
67533
+ arrow: new LineTool(this.enableToolEvent, this.getCurrentRendererModel, this.shadowEmitter, this.paperScope),
67534
+ line: new StraightLineTool(this.enableToolEvent, this.getCurrentRendererModel, this.shadowEmitter, this.paperScope),
67535
+ text: new TextTool(this.enableToolEvent, this.getCurrentRendererModel, this.shadowEmitter, this.paperScope, this.rootElement, this.canvasElement, this.toolbarModel, this.camera),
67536
+ ellipse: new EllipseTool(this.enableToolEvent, this.getCurrentRendererModel, this.shadowEmitter, this.paperScope),
67537
+ triangle: new TriangleTool(this.enableToolEvent, this.getCurrentRendererModel, this.shadowEmitter, this.paperScope),
67538
+ eraser: new EraserTool(this.enableToolEvent, this.getCurrentRendererModel, this.shadowEmitter, this.paperScope, this.trashedElementsModel, this.shadowScope),
67539
+ laser: new LaserPointerTool(this.enableToolEvent, this.getCurrentRendererModel, this.shadowEmitter, this.paperScope),
67540
+ grab: new GrabTool(this.enableToolEvent, this.getCurrentRendererModel, this.shadowEmitter, this.paperScope, this.camera)
67436
67541
  };
67437
67542
  this.toolbarModel.on("update", (style) => {
67438
67543
  if (this.tools[style.tool]) {
@@ -67703,6 +67808,7 @@ var WhiteboardApplication = class extends import_forge_room.AbstractApplication
67703
67808
  this.camera.updateInitSize(new import_paper.default.Size(width, height));
67704
67809
  }
67705
67810
  async dispose(removeSubDoc) {
67811
+ _WhiteboardApplication.instanceCount.set(this.appId, (_WhiteboardApplication.instanceCount.get(this.appId) ?? 0) - 1);
67706
67812
  if (removeSubDoc) {
67707
67813
  this.deleteSubDoc(this.appId);
67708
67814
  }
@@ -67735,8 +67841,10 @@ var WhiteboardApplication = class extends import_forge_room.AbstractApplication
67735
67841
  this.emitter.indexedNavigation.dispose();
67736
67842
  this.permissions.dispose();
67737
67843
  (0, import_forge_room13.removeObserver)(this.userMap(this.userId), this.handleSyncedWhiteboardStatusChange);
67844
+ (0, import_forge_room.log)(`whiteboard ${this.appId} disposed. instance count: ${_WhiteboardApplication.instanceCount.get(this.appId) ?? 0}`, {}, "info");
67738
67845
  }
67739
67846
  };
67847
+ _defineProperty43(WhiteboardApplication, "instanceCount", /* @__PURE__ */ new Map());
67740
67848
  _defineProperty43(WhiteboardApplication, "applicationName", WHITEBOARD_APP_NAME);
67741
67849
 
67742
67850
  // src/SlideApplication.ts
@@ -67750,6 +67858,7 @@ var SlideForge = class extends import_eventemitter313.default {
67750
67858
  permissions;
67751
67859
  footView;
67752
67860
  sideBarView;
67861
+ window = void 0;
67753
67862
  /**
67754
67863
  * 当前页面索引, 从 0 开始
67755
67864
  */