@netless/forge-whiteboard 1.1.1 → 1.1.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.
@@ -81,6 +81,7 @@ export declare class WhiteboardApplication extends AbstractApplication<Whiteboar
81
81
  private permissions;
82
82
  private inputType;
83
83
  private isPenEvent;
84
+ private activePenPointerId;
84
85
  private hasPenInput;
85
86
  private disableViewModelUpdate;
86
87
  private internalResizeObserver;
@@ -1 +1 @@
1
- {"version":3,"file":"WhiteboardApplication.d.ts","sourceRoot":"","sources":["../src/WhiteboardApplication.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAO,MAAM,qBAAqB,CAAC;AAS/D,OAAO,EAAgB,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAUhF,OAAO,EAA0C,UAAU,EAAE,MAAM,cAAc,CAAC;AAmBlF;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAC5C;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,eAAO,MAAM,mBAAmB,eAAe,CAAC;AAEhD,MAAM,MAAM,kBAAkB,GAC9B,OAAO,GACL,WAAW,GACX,UAAU,GACV,MAAM,GACN,OAAO,GACP,MAAM,GACN,SAAS,GACT,UAAU,GACV,QAAQ,GACR,OAAO,GACP,MAAM,GACN,SAAS,CAAC;AAEZ,UAAU,sBAAsB;IAC9B,WAAW,EAAE,kBAAkB,CAAC;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC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O,CAAC,aAAa,CAEnB;IAEF,OAAO,CAAC,iBAAiB,CAEvB;IAEF,OAAO,CAAC,oBAAoB,CAI1B;IAEF,OAAO,CAAC,qBAAqB,CAG3B;IAEF,OAAO,CAAC,kBAAkB,CA8CxB;IAEF,OAAO,CAAC,aAAa;IAkBrB,OAAO,CAAC,uBAAuB,CAe7B;IAEF,OAAO,CAAC,kBAAkB,CAGxB;IAEF,OAAO,CAAC,gBAAgB;IAmBxB,OAAO,CAAC,mBAAmB,CAczB;IAEF,OAAO,CAAC,qBAAqB;IAY7B,OAAO,CAAC,mBAAmB,CAUzB;IAEF,OAAO,CAAC,iCAAiC,CAOvC;IAEF,OAAO,CAAC,mBAAmB,CAczB;IAEF,OAAO,CAAC,oBAAoB,CAqD1B;IAEF,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,SAAS;IAqEV,gBAAgB;IAIhB,gBAAgB,CAAC,QAAQ,EAAE,MAAM;IAiBjC,MAAM;IAIb,OAAO,CAAC,kCAAkC,CAwBxC;IAGK,gBAAgB,GAAI,YAAY,MAAM,EAAE,aAAa,MAAM,UAwBhE;IAEK,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAKzC,WAAW,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;IAK/B,gBAAgB,IAAI,MAAM;IAI1B,kCAAkC,CAAC,KAAK,EAAE,OAAO;IAIjD,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAMxC,OAAO,CAAC,YAAY,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CAoC3D"}
@@ -4,7 +4,6 @@ import { EditorConfig } from '../../edit/EditorConfig';
4
4
  import { LiveCursor } from '../../LiveCursor';
5
5
  export declare class CurveModel extends ElementModel<paper.Path> {
6
6
  item: paper.Path | null;
7
- private debugPath;
8
7
  private debug;
9
8
  protected clearLocalPointsWhenYPointsChange: boolean;
10
9
  protected shouldUseLocalPoints: boolean;
@@ -14,7 +13,6 @@ export declare class CurveModel extends ElementModel<paper.Path> {
14
13
  private parsePoints;
15
14
  private matrixedPoints;
16
15
  private createPath;
17
- private updateDebugPath;
18
16
  protected onVectorUpdate(): void;
19
17
  createPaperItem(): void;
20
18
  editorConfig(): EditorConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"CurveModel.d.ts","sourceRoot":"","sources":["../../../src/model/renderable/CurveModel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAGzB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,qBAAa,UAAW,SAAQ,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC;IAE/C,IAAI,EAAE,KAAK,CAAC,IAAI,GAAG,IAAI,CAAQ;IAEtC,OAAO,CAAC,SAAS,CAAa;IAC9B,OAAO,CAAC,KAAK,CAAkB;IAC/B,SAAS,CAAC,iCAAiC,UAAS;IACpD,SAAS,CAAC,oBAAoB,UAAQ;IACtC,SAAS,CAAC,eAAe,SAAK;gBAEX,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,OAAO;IAWtH,OAAO,CAAC,OAAO;IAIf,OAAO,CAAC,WAAW;IAkBnB,OAAO,CAAC,cAAc;IAYtB,OAAO,CAAC,UAAU;IAkClB,OAAO,CAAC,eAAe;IAevB,SAAS,CAAC,cAAc;IAkBjB,eAAe,IAAI,IAAI;IAOvB,YAAY,IAAI,YAAY;IAInC,SAAS,CAAC,UAAU,IAAI,MAAM,EAAE;IAIhC,SAAS,CAAC,SAAS,IAAI;QAAE,OAAO,EAAE,MAAM,EAAE,CAAC;QAAC,OAAO,EAAE,M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IAAI;IAU/C,SAAS,CAAC,gBAAgB,CAAC,GAAG,EAAE,MAAM;IAYtC,SAAS,CAAC,UAAU;CACrB"}
@@ -5,8 +5,11 @@ export declare class CurveTool extends WhiteboardTool {
5
5
  private elementModel;
6
6
  private recognizer;
7
7
  private pointCount;
8
+ private pendingPoints;
9
+ private flushRafId;
8
10
  protected showLiveCursor: boolean;
9
11
  constructor(enableToolEvent: () => boolean, modelGetter: () => Promise<RenderableModel | null>, shadowEmitter: ShadowEmitter, scope: paper.PaperScope);
12
+ private flushPendingPoints;
10
13
  protected onMouseDown(_event: paper.ToolEvent): void;
11
14
  protected onMouseDrag(event: paper.ToolEvent): void;
12
15
  protected onMouseUp(event: paper.ToolEvent): void;
@@ -1 +1 @@
1
- {"version":3,"file":"CurveTool.d.ts","sourceRoot":"","sources":["../../src/tool/CurveTool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,qBAAa,SAAU,SAAQ,cAAc;IAE3C,OAAO,CAAC,YAAY,CAA2B;IAC/C,OAAO,CAAC,UAAU,CAAoB;IACtC,OAAO,CAAC,UAAU,CAAa;IAE/B,SAAS,CAAC,cAAc,UAAQ;gBAEb,eAAe,EAAE,MAAM,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,EAAE,aAAa,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,CAAC,UAAU;IAK5J,SAAS,CAAC,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,SAAS;IAa7C,SAAS,CAAC,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS;IAsB5C,SAAS,CAAC,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS;CAgD3C"}
1
+ {"version":3,"file":"CurveTool.d.ts","sourceRoot":"","sources":["../../src/tool/CurveTool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,qBAAa,SAAU,SAAQ,cAAc;IAE3C,OAAO,CAAC,YAAY,CAA2B;IAC/C,OAAO,CAAC,UAAU,CAAoB;IACtC,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,UAAU,CAAa;IAE/B,SAAS,CAAC,cAAc,UAAQ;gBAEb,eAAe,EAAE,MAAM,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,EAAE,aAAa,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,CAAC,UAAU;IAI5J,OAAO,CAAC,kBAAkB,CAMxB;IAEF,SAAS,CAAC,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,SAAS;IAkB7C,SAAS,CAAC,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS;IAkC5C,SAAS,CAAC,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS;CAqD3C"}
@@ -7,11 +7,15 @@ export declare abstract class WhiteboardTool {
7
7
  shadowEmitter: ShadowEmitter;
8
8
  private enableToolEvent;
9
9
  private eventAvailable;
10
+ private lastDragTime;
11
+ private dragRafId;
12
+ private pendingDragEvent;
10
13
  constructor(enableToolEvent: () => boolean, modelGetter: () => Promise<RenderableModel | null>, shadowEmitter: ShadowEmitter, scope: paper.PaperScope);
11
14
  protected abstract onMouseDown(event: paper.ToolEvent): void;
12
15
  protected abstract onMouseDrag(event: paper.ToolEvent): void;
13
16
  protected abstract onMouseUp(event: paper.ToolEvent): void;
14
17
  private onMouseDownSelf;
18
+ private flushPendingDrag;
15
19
  private onMouseDragSelf;
16
20
  private onMouseUpSelf;
17
21
  }
@@ -1 +1 @@
1
- {"version":3,"file":"WhiteboardTool.d.ts","sourceRoot":"","sources":["../../src/tool/WhiteboardTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,8BAAsB,cAAc;IAElC,SAAS,CAAC,WAAW,EAAE,MAAM,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAAC;IAC7D,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC;IAClC,SAAgB,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC;IAC1B,aAAa,EAAE,aAAa,CAAC;IACpC,OAAO,CAAC,eAAe,CAAgB;IACvC,OAAO,CAAC,cAAc,CAAkB;gBAGtC,eAAe,EAAE,MAAM,OAAO,EAC9B,WAAW,EAAE,MAAM,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,EAClD,aAAa,EAAE,aAAa,EAC5B,KAAK,EAAE,KAAK,CAAC,UAAU;IAYvB,SAAS,CAAC,QAAQ,CAAC,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,GAAG,IAAI;IAC5D,SAAS,CAAC,QAAQ,CAAC,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,GAAG,IAAI;IAC5D,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,GAAG,IAAI;IAE1D,OAAO,CAAC,eAAe,CAOrB;IAEF,OAAO,CAAC,eAAe,CAKrB;IAEF,OAAO,CAAC,aAAa,CAMnB;CACL"}
1
+ {"version":3,"file":"WhiteboardTool.d.ts","sourceRoot":"","sources":["../../src/tool/WhiteboardTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AA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,MAAM,GAAG,KAAK,CAAC,OAAO,CAQjH;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,GAAG,MAAM,EAAE,CAKxD;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,IAAI,CAK3G;AAiCD,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,QAKhE;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,KAAK,CAAC,SAAS,GAAG,UAAU,GAAG,IAAI,CAOpE"}
1
+ {"version":3,"file":"paperjs.d.ts","sourceRoot":"","sources":["../../src/utils/paperjs.ts"],"names":[],"mappings":"AAGA,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,GAAG,MAAM,EAAE,CASjE;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,OAAO,CAQjH;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,GAAG,MAAM,EAAE,CAKxD;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,IAAI,CAK3G;AAoDD,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,QAKhE;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,KAAK,CAAC,SAAS,GAAG,UAAU,GAAG,IAAI,CAOpE"}
@@ -23278,7 +23278,7 @@ var require_lodash = __commonJS({
23278
23278
  result2.__values__ = wrapper.__values__;
23279
23279
  return result2;
23280
23280
  }
23281
- function chunk8(array, size2, guard) {
23281
+ function chunk7(array, size2, guard) {
23282
23282
  if (guard ? isIterateeCall(array, size2, guard) : size2 === undefined2) {
23283
23283
  size2 = 1;
23284
23284
  } else {
@@ -25150,7 +25150,7 @@ var require_lodash = __commonJS({
25150
25150
  lodash.bindKey = bindKey;
25151
25151
  lodash.castArray = castArray;
25152
25152
  lodash.chain = chain;
25153
- lodash.chunk = chunk8;
25153
+ lodash.chunk = chunk7;
25154
25154
  lodash.compact = compact;
25155
25155
  lodash.concat = concat;
25156
25156
  lodash.cond = cond;
@@ -25790,9 +25790,6 @@ function ae(e, t = {}) {
25790
25790
  return ce(me(e, t), t);
25791
25791
  }
25792
25792
 
25793
- // src/model/renderable/CurveModel.ts
25794
- var import_lodash = __toESM(require_lodash(), 1);
25795
-
25796
25793
  // src/model/renderable/ElementModel.ts
25797
25794
  import * as Y from "yjs";
25798
25795
  import { removeDeepObserver } from "@netless/forge-room";
@@ -26182,35 +26179,37 @@ var CurveModel = class extends ElementModel {
26182
26179
  constructor(root, scope, liveCursor, isPerformanceMode) {
26183
26180
  super(root, scope, liveCursor, isPerformanceMode);
26184
26181
  _defineProperty3(this, "item", null);
26185
- _defineProperty3(this, "debugPath", void 0);
26186
26182
  _defineProperty3(this, "debug", false);
26187
26183
  _defineProperty3(this, "clearLocalPointsWhenYPointsChange", false);
26188
26184
  _defineProperty3(this, "shouldUseLocalPoints", true);
26189
- _defineProperty3(this, "localPointsPick", 4);
26185
+ _defineProperty3(this, "localPointsPick", 6);
26190
26186
  if (!this.root.doc || !this.root.has("type")) {
26191
26187
  this.root.set("type", "curve");
26192
26188
  }
26193
26189
  if (!this.root.doc || !this.root.has("points")) {
26194
26190
  this.root.set("points", new Y2.Array());
26195
26191
  }
26196
- this.debugPath = new scope.Path();
26197
26192
  }
26198
26193
  average(a2, b2) {
26199
26194
  return (a2 + b2) / 2;
26200
26195
  }
26201
26196
  parsePoints(points) {
26197
+ const hasRealPressure = points.some((p) => p.length >= 3 && p[2] > 0);
26198
+ const viewScale = this.scope.project.view.matrix.scaling.x || 1;
26199
+ const taper = this.strokeWidth * 5 / viewScale;
26200
+ const streamline = Math.min(0.7, 0.7 * viewScale);
26202
26201
  return ae(points, {
26203
26202
  size: this.strokeWidth,
26204
- smoothing: 0.5,
26205
- thinning: -0.5,
26206
- streamline: 0.5,
26207
- simulatePressure: true,
26203
+ smoothing: 0.7,
26204
+ thinning: 0.5,
26205
+ streamline,
26206
+ simulatePressure: !hasRealPressure,
26208
26207
  start: {
26209
- taper: this.strokeWidth * 10,
26208
+ taper,
26210
26209
  cap: true
26211
26210
  },
26212
26211
  end: {
26213
- taper: this.strokeWidth * 20,
26212
+ taper,
26214
26213
  cap: true
26215
26214
  }
26216
26215
  });
@@ -26219,10 +26218,11 @@ var CurveModel = class extends ElementModel {
26219
26218
  const points = this.localPoints.length === 0 ? this.points : this.localPoints;
26220
26219
  const matrix = new this.scope.Matrix(this.pointsMatrix);
26221
26220
  const output = [];
26222
- for (let i = 0, len = points.length; i < len; i += 2) {
26221
+ for (let i = 0, len = points.length; i < len; i += 3) {
26223
26222
  const p = new this.scope.Point(points[i], points[i + 1]);
26224
26223
  const tp = p.transform(matrix);
26225
- output.push([tp.x, tp.y]);
26224
+ const pressure = points[i + 2] ?? 0;
26225
+ output.push([tp.x, tp.y, pressure]);
26226
26226
  }
26227
26227
  return output;
26228
26228
  }
@@ -26251,34 +26251,30 @@ var CurveModel = class extends ElementModel {
26251
26251
  }
26252
26252
  return path;
26253
26253
  }
26254
- updateDebugPath() {
26255
- this.debugPath = new this.scope.Path();
26256
- const points = (0, import_lodash.chunk)(this.points, 2);
26257
- for (let i = 0, len = points.length; i < len; i++) {
26258
- const point = new this.scope.Point(points[i][0], points[i][1]);
26259
- if (i === 0) {
26260
- this.debugPath.moveTo(point);
26261
- } else {
26262
- this.debugPath.lineTo(point);
26263
- }
26264
- this.debugPath.strokeWidth = 1;
26265
- this.debugPath.strokeColor = new this.scope.Color(1, 0, 0, 1);
26266
- }
26267
- }
26268
26254
  onVectorUpdate() {
26269
26255
  if (!this.item) {
26270
26256
  return;
26271
26257
  }
26258
+ const matrixedPts = this.matrixedPoints();
26272
26259
  if (this.debug) {
26273
- this.debugPath.remove();
26274
- this.updateDebugPath();
26275
- }
26276
- const points = this.parsePoints(this.matrixedPoints());
26277
- const path = this.createPath(points);
26278
- this.item.removeSegments();
26279
- this.item.addSegments(path.segments);
26280
- if (this.debug) {
26281
- this.item.addChild(this.debugPath);
26260
+ const path = new this.scope.Path();
26261
+ for (let i = 0; i < matrixedPts.length; i++) {
26262
+ const p = new this.scope.Point(matrixedPts[i][0], matrixedPts[i][1]);
26263
+ if (i === 0) {
26264
+ path.moveTo(p);
26265
+ } else {
26266
+ path.lineTo(p);
26267
+ }
26268
+ }
26269
+ this.item.removeSegments();
26270
+ this.item.addSegments(path.segments);
26271
+ this.item.fillColor = null;
26272
+ this.item.strokeWidth = this.strokeWidth;
26273
+ } else {
26274
+ const points = this.parsePoints(matrixedPts);
26275
+ const path = this.createPath(points);
26276
+ this.item.removeSegments();
26277
+ this.item.addSegments(path.segments);
26282
26278
  }
26283
26279
  }
26284
26280
  createPaperItem() {
@@ -26301,11 +26297,11 @@ var CurveModel = class extends ElementModel {
26301
26297
  }
26302
26298
  liveCursorPoint() {
26303
26299
  const yArray = this.root.get(ElementModel.KEYS.points);
26304
- if (yArray.length < 2) {
26300
+ if (yArray.length < 3) {
26305
26301
  return null;
26306
26302
  }
26307
26303
  const len = yArray.length;
26308
- const point = new this.scope.Point(yArray.get(len - 2), yArray.get(len - 1));
26304
+ const point = new this.scope.Point(yArray.get(len - 3), yArray.get(len - 2));
26309
26305
  return point.transform(new this.scope.Matrix(this.pointsMatrix));
26310
26306
  }
26311
26307
  onStyleKeyUpdate(key) {
@@ -26406,7 +26402,8 @@ var SelectorModel = class extends ElementModel {
26406
26402
  import * as Y4 from "yjs";
26407
26403
 
26408
26404
  // src/utils/paperjs.ts
26409
- var import_lodash2 = __toESM(require_lodash(), 1);
26405
+ var import_lodash = __toESM(require_lodash(), 1);
26406
+ import { metrics } from "@netless/forge-room";
26410
26407
  function _defineProperty5(e, r, t) {
26411
26408
  return (r = _toPropertyKey5(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
26412
26409
  }
@@ -26439,7 +26436,7 @@ function serializePath(path) {
26439
26436
  }, []);
26440
26437
  }
26441
26438
  function deserializePath(points, scope, matrix) {
26442
- const segmentGroup = (0, import_lodash2.chunk)(points, 6);
26439
+ const segmentGroup = (0, import_lodash.chunk)(points, 6);
26443
26440
  const path = new scope.Path();
26444
26441
  path.segments = segmentGroup.map((v) => deserializeSegment(v, scope, matrix));
26445
26442
  return path;
@@ -26449,7 +26446,27 @@ var AnimationFrame = class {
26449
26446
  _defineProperty5(this, "callbacks", []);
26450
26447
  _defineProperty5(this, "lastTime", 0);
26451
26448
  _defineProperty5(this, "fps", 45);
26449
+ _defineProperty5(this, "lastCallbackTime", 0);
26450
+ _defineProperty5(this, "fpsBuffer", []);
26451
+ _defineProperty5(this, "FPS_REPORT_INTERVAL", 2700);
26452
26452
  _defineProperty5(this, "handleCallbacks", () => {
26453
+ const now = performance.now();
26454
+ if (this.lastCallbackTime > 0) {
26455
+ const actualFps = 1e3 / (now - this.lastCallbackTime);
26456
+ this.fpsBuffer.push(actualFps);
26457
+ if (this.fpsBuffer.length >= this.FPS_REPORT_INTERVAL) {
26458
+ const avg = this.fpsBuffer.reduce((a2, b2) => a2 + b2, 0) / this.fpsBuffer.length;
26459
+ const min = Math.min(...this.fpsBuffer);
26460
+ const sorted = [...this.fpsBuffer].sort((a2, b2) => a2 - b2);
26461
+ const p90 = sorted[Math.floor(sorted.length * 0.9)];
26462
+ metrics().gauge("fps", Math.round(avg), {
26463
+ min: Math.round(min),
26464
+ p90: Math.round(p90)
26465
+ });
26466
+ this.fpsBuffer = [];
26467
+ }
26468
+ }
26469
+ this.lastCallbackTime = now;
26453
26470
  const functions = this.callbacks;
26454
26471
  this.callbacks = [];
26455
26472
  for (let i = 0, l2 = functions.length; i < l2; i++) {
@@ -26561,7 +26578,7 @@ var SegmentsModel = class extends ElementModel {
26561
26578
  };
26562
26579
 
26563
26580
  // src/model/renderable/LineModel.ts
26564
- var import_lodash4 = __toESM(require_lodash(), 1);
26581
+ var import_lodash3 = __toESM(require_lodash(), 1);
26565
26582
  import * as Y5 from "yjs";
26566
26583
 
26567
26584
  // src/tool/WhiteboardTool.ts
@@ -26582,6 +26599,8 @@ function _toPrimitive7(t, r) {
26582
26599
  }
26583
26600
  return ("string" === r ? String : Number)(t);
26584
26601
  }
26602
+ var DRAG_FPS = 10;
26603
+ var DRAG_FRAME_MS = 1e3 / DRAG_FPS;
26585
26604
  var WhiteboardTool = class {
26586
26605
  constructor(enableToolEvent, modelGetter, shadowEmitter, scope) {
26587
26606
  _defineProperty7(this, "modelGetter", void 0);
@@ -26590,24 +26609,60 @@ var WhiteboardTool = class {
26590
26609
  _defineProperty7(this, "shadowEmitter", void 0);
26591
26610
  _defineProperty7(this, "enableToolEvent", void 0);
26592
26611
  _defineProperty7(this, "eventAvailable", false);
26612
+ _defineProperty7(this, "lastDragTime", 0);
26613
+ _defineProperty7(this, "dragRafId", 0);
26614
+ _defineProperty7(this, "pendingDragEvent", null);
26593
26615
  _defineProperty7(this, "onMouseDownSelf", (event) => {
26594
26616
  this.eventAvailable = this.enableToolEvent();
26595
26617
  if (!this.eventAvailable) {
26596
26618
  return;
26597
26619
  }
26620
+ this.lastDragTime = 0;
26621
+ if (this.dragRafId) {
26622
+ cancelAnimationFrame(this.dragRafId);
26623
+ this.dragRafId = 0;
26624
+ }
26625
+ this.pendingDragEvent = null;
26598
26626
  this.shadowEmitter.setActive(true);
26599
26627
  this.onMouseDown(event);
26600
26628
  });
26629
+ _defineProperty7(this, "flushPendingDrag", () => {
26630
+ this.dragRafId = 0;
26631
+ if (this.pendingDragEvent) {
26632
+ this.lastDragTime = performance.now();
26633
+ const event = this.pendingDragEvent;
26634
+ this.pendingDragEvent = null;
26635
+ this.onMouseDrag(event);
26636
+ }
26637
+ });
26601
26638
  _defineProperty7(this, "onMouseDragSelf", (event) => {
26602
26639
  if (!this.eventAvailable) {
26603
26640
  return;
26604
26641
  }
26605
- this.onMouseDrag(event);
26642
+ const now = performance.now();
26643
+ if (now - this.lastDragTime >= DRAG_FRAME_MS) {
26644
+ this.lastDragTime = now;
26645
+ this.pendingDragEvent = null;
26646
+ this.onMouseDrag(event);
26647
+ } else {
26648
+ this.pendingDragEvent = event;
26649
+ if (!this.dragRafId) {
26650
+ this.dragRafId = requestAnimationFrame(this.flushPendingDrag);
26651
+ }
26652
+ }
26606
26653
  });
26607
26654
  _defineProperty7(this, "onMouseUpSelf", (event) => {
26608
26655
  if (!this.eventAvailable) {
26609
26656
  return;
26610
26657
  }
26658
+ if (this.dragRafId) {
26659
+ cancelAnimationFrame(this.dragRafId);
26660
+ this.dragRafId = 0;
26661
+ }
26662
+ if (this.pendingDragEvent) {
26663
+ this.onMouseDrag(this.pendingDragEvent);
26664
+ this.pendingDragEvent = null;
26665
+ }
26611
26666
  this.onMouseUp(event);
26612
26667
  this.shadowEmitter.setActive(false);
26613
26668
  });
@@ -26623,7 +26678,7 @@ var WhiteboardTool = class {
26623
26678
  };
26624
26679
 
26625
26680
  // src/tool/LineTool.ts
26626
- var import_lodash3 = __toESM(require_lodash(), 1);
26681
+ var import_lodash2 = __toESM(require_lodash(), 1);
26627
26682
  function _defineProperty8(e, r, t) {
26628
26683
  return (r = _toPropertyKey8(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
26629
26684
  }
@@ -26672,7 +26727,7 @@ var LineTool = class extends WhiteboardTool {
26672
26727
  const point = path.getPointAt(distance);
26673
26728
  return [point.x, point.y];
26674
26729
  });
26675
- this.elementModel.setPoints((0, import_lodash3.flattenDeep)(points));
26730
+ this.elementModel.setPoints((0, import_lodash2.flattenDeep)(points));
26676
26731
  }
26677
26732
  }
26678
26733
  onMouseUp(_event) {
@@ -26755,7 +26810,7 @@ var LineModel = class extends ElementModel {
26755
26810
  }
26756
26811
  renderLine() {
26757
26812
  const matrix = new this.scope.Matrix(this.pointsMatrix);
26758
- const papperPoints = (0, import_lodash4.chunk)(this.drawPoints, 2).map((item) => {
26813
+ const papperPoints = (0, import_lodash3.chunk)(this.drawPoints, 2).map((item) => {
26759
26814
  return new this.scope.Point(item[0], item[1]).transform(matrix);
26760
26815
  });
26761
26816
  const path = new this.scope.Path();
@@ -26891,7 +26946,7 @@ var LineControlPoint = class {
26891
26946
  const invertedPoint = point.transform(pointsMatrix.inverted());
26892
26947
  const points = this.model["drawPoints"];
26893
26948
  this.position = invertedPoint;
26894
- const clonedPoints = (0, import_lodash4.cloneDeep)(points);
26949
+ const clonedPoints = (0, import_lodash3.cloneDeep)(points);
26895
26950
  clonedPoints[this.options.index * 2] = invertedPoint.x;
26896
26951
  clonedPoints[this.options.index * 2 + 1] = invertedPoint.y;
26897
26952
  this.model.setPoints(clonedPoints);
@@ -27371,7 +27426,7 @@ var RectangleModel = class extends ElementModel {
27371
27426
  var elementsUndoOrigin = "elementsUndoOrigin";
27372
27427
 
27373
27428
  // src/model/renderable/EraserModel.ts
27374
- var import_lodash5 = __toESM(require_lodash(), 1);
27429
+ var import_lodash4 = __toESM(require_lodash(), 1);
27375
27430
  import * as Y9 from "yjs";
27376
27431
  function _defineProperty13(e, r, t) {
27377
27432
  return (r = _toPropertyKey13(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
@@ -27440,7 +27495,7 @@ var EraserModel = class extends ElementModel {
27440
27495
  return path;
27441
27496
  }
27442
27497
  parsePoints(points) {
27443
- const groupPoints = (0, import_lodash5.chunk)(points, 2);
27498
+ const groupPoints = (0, import_lodash4.chunk)(points, 2);
27444
27499
  return ae(groupPoints, {
27445
27500
  size: this.strokeWidth,
27446
27501
  smoothing: 0.5,
@@ -27458,7 +27513,7 @@ var EraserModel = class extends ElementModel {
27458
27513
  });
27459
27514
  }
27460
27515
  matrixedPoints() {
27461
- const currentPoints = (0, import_lodash5.chunk)(this.drawPoints, 2).slice(this.sliceBegin);
27516
+ const currentPoints = (0, import_lodash4.chunk)(this.drawPoints, 2).slice(this.sliceBegin);
27462
27517
  return currentPoints.map((_ref) => {
27463
27518
  let [x, y] = _ref;
27464
27519
  return new this.scope.Point(x, y);
@@ -27523,7 +27578,7 @@ var EraserModel = class extends ElementModel {
27523
27578
  };
27524
27579
 
27525
27580
  // src/model/renderable/LaserPointerModel.ts
27526
- var import_lodash6 = __toESM(require_lodash(), 1);
27581
+ var import_lodash5 = __toESM(require_lodash(), 1);
27527
27582
  import * as Y10 from "yjs";
27528
27583
  function _defineProperty14(e, r, t) {
27529
27584
  return (r = _toPropertyKey14(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
@@ -27641,7 +27696,7 @@ var LaserPointerModel = class extends ElementModel {
27641
27696
  const matrix = new this.scope.Matrix(this.pointsMatrix);
27642
27697
  const points = this.cachedPoints || this.points;
27643
27698
  console.log("[][][] ,", this.points.length, this.cachedPoints?.length, this.localPoints.length);
27644
- const groupPoints = (0, import_lodash6.chunk)(points, 2).slice(this.sliceBegin);
27699
+ const groupPoints = (0, import_lodash5.chunk)(points, 2).slice(this.sliceBegin);
27645
27700
  return groupPoints.map((_ref) => {
27646
27701
  let [x, y] = _ref;
27647
27702
  return matrix.transform([x, y]);
@@ -27722,7 +27777,7 @@ var WhiteboardPermissions = class extends AbstractApplicationPermissions {
27722
27777
  };
27723
27778
 
27724
27779
  // src/model/renderable/StraightLineModel.ts
27725
- var import_lodash7 = __toESM(require_lodash(), 1);
27780
+ var import_lodash6 = __toESM(require_lodash(), 1);
27726
27781
  import * as Y11 from "yjs";
27727
27782
  function _defineProperty15(e, r, t) {
27728
27783
  return (r = _toPropertyKey15(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
@@ -27782,7 +27837,7 @@ var StraightLineModel = class extends ElementModel {
27782
27837
  }
27783
27838
  renderLine() {
27784
27839
  const matrix = new this.scope.Matrix(this.pointsMatrix);
27785
- const papperPoints = (0, import_lodash7.chunk)(this.drawPoints, 2).map((item) => {
27840
+ const papperPoints = (0, import_lodash6.chunk)(this.drawPoints, 2).map((item) => {
27786
27841
  return new this.scope.Point(item[0], item[1]).transform(matrix);
27787
27842
  });
27788
27843
  const path = new this.scope.Path();
@@ -28402,7 +28457,7 @@ var RenderableModel = class extends EventEmitter {
28402
28457
  };
28403
28458
 
28404
28459
  // src/utils/Recognizer.ts
28405
- var import_lodash8 = __toESM(require_lodash(), 1);
28460
+ var import_lodash7 = __toESM(require_lodash(), 1);
28406
28461
 
28407
28462
  // src/utils/UnistrokeRecognizer.js
28408
28463
  function Point(x, y) {
@@ -28649,7 +28704,7 @@ var Recognizer = class {
28649
28704
  let maxX = -Number.MAX_VALUE;
28650
28705
  let minY = Number.MAX_VALUE;
28651
28706
  let maxY = -Number.MAX_VALUE;
28652
- const result = this.dollar.Recognize((0, import_lodash8.chunk)(points, 2).map((v) => {
28707
+ const result = this.dollar.Recognize((0, import_lodash7.chunk)(points, 3).map((v) => {
28653
28708
  minX = Math.min(minX, v[0]);
28654
28709
  maxX = Math.max(maxX, v[0]);
28655
28710
  minY = Math.min(minY, v[1]);
@@ -28693,11 +28748,24 @@ var CurveTool = class extends WhiteboardTool {
28693
28748
  _defineProperty19(this, "elementModel", null);
28694
28749
  _defineProperty19(this, "recognizer", new Recognizer());
28695
28750
  _defineProperty19(this, "pointCount", 0);
28751
+ _defineProperty19(this, "pendingPoints", []);
28752
+ _defineProperty19(this, "flushRafId", 0);
28696
28753
  _defineProperty19(this, "showLiveCursor", true);
28697
- this.tool.minDistance = 20;
28754
+ _defineProperty19(this, "flushPendingPoints", () => {
28755
+ this.flushRafId = 0;
28756
+ if (this.elementModel && this.pendingPoints.length > 0) {
28757
+ this.elementModel.appendPoints(this.pendingPoints);
28758
+ this.pendingPoints = [];
28759
+ }
28760
+ });
28698
28761
  }
28699
28762
  onMouseDown(_event) {
28700
28763
  this.pointCount = 0;
28764
+ this.pendingPoints = [];
28765
+ if (this.flushRafId) {
28766
+ cancelAnimationFrame(this.flushRafId);
28767
+ this.flushRafId = 0;
28768
+ }
28701
28769
  if (this.elementModel) {
28702
28770
  this.elementModel.dispose();
28703
28771
  }
@@ -28712,27 +28780,38 @@ var CurveTool = class extends WhiteboardTool {
28712
28780
  if (this.pointCount > 1024) {
28713
28781
  return;
28714
28782
  }
28715
- const MIN_DISTANCE = 4;
28783
+ const MIN_DISTANCE = 2;
28716
28784
  if (this.elementModel) {
28717
- const len = this.elementModel.points.length;
28718
- let last = {
28719
- x: 0,
28720
- y: 0
28721
- };
28722
- if (len >= 2) {
28723
- last = {
28724
- x: this.elementModel.points[len - 2],
28725
- y: this.elementModel.points[len - 1]
28726
- };
28785
+ let lastX = 0;
28786
+ let lastY = 0;
28787
+ if (this.pendingPoints.length >= 3) {
28788
+ lastX = this.pendingPoints[this.pendingPoints.length - 3];
28789
+ lastY = this.pendingPoints[this.pendingPoints.length - 2];
28790
+ } else {
28791
+ const len = this.elementModel.points.length;
28792
+ if (len >= 3) {
28793
+ lastX = this.elementModel.points[len - 3];
28794
+ lastY = this.elementModel.points[len - 2];
28795
+ }
28727
28796
  }
28728
- const dist = Math.max(Math.abs(last.x - event.point.x), Math.abs(last.y - event.point.y));
28797
+ const dist = Math.max(Math.abs(lastX - event.point.x), Math.abs(lastY - event.point.y));
28729
28798
  if (dist >= MIN_DISTANCE) {
28730
28799
  this.pointCount += 1;
28731
- this.elementModel.appendPoints([Math.round(event.point.x), Math.round(event.point.y)]);
28800
+ const nativeEvent = event.event;
28801
+ const pressure = nativeEvent.pointerType === "pen" && nativeEvent.pressure > 0 ? nativeEvent.pressure : 0;
28802
+ this.pendingPoints.push(event.point.x, event.point.y, pressure);
28803
+ if (!this.flushRafId) {
28804
+ this.flushRafId = requestAnimationFrame(this.flushPendingPoints);
28805
+ }
28732
28806
  }
28733
28807
  }
28734
28808
  }
28735
28809
  onMouseUp(event) {
28810
+ if (this.flushRafId) {
28811
+ cancelAnimationFrame(this.flushRafId);
28812
+ this.flushRafId = 0;
28813
+ }
28814
+ this.flushPendingPoints();
28736
28815
  this.modelGetter().then((model) => {
28737
28816
  if (!model) {
28738
28817
  return;
@@ -31962,6 +32041,7 @@ var WhiteboardApplication = class _WhiteboardApplication extends AbstractApplica
31962
32041
  _defineProperty43(this, "permissions", void 0);
31963
32042
  _defineProperty43(this, "inputType", "any");
31964
32043
  _defineProperty43(this, "isPenEvent", false);
32044
+ _defineProperty43(this, "activePenPointerId", null);
31965
32045
  _defineProperty43(this, "hasPenInput", null);
31966
32046
  _defineProperty43(this, "disableViewModelUpdate", false);
31967
32047
  _defineProperty43(this, "internalResizeObserver", true);
@@ -32290,11 +32370,34 @@ var WhiteboardApplication = class _WhiteboardApplication extends AbstractApplica
32290
32370
  this.imageSets.setAttribute("data-image-sets", "");
32291
32371
  this.rootElement.appendChild(this.imageSets);
32292
32372
  document.body.addEventListener("pointerdown", (evt) => {
32293
- this.isPenEvent = evt.pointerType === "pen";
32294
- if (evt.pointerType === "pen" && this.hasPenInput === null) {
32295
- this.hasPenInput = true;
32296
- this.inputType = "pen";
32297
- this.emitter.emit("inputTypeChange", this.inputType);
32373
+ if (evt.pointerType === "pen") {
32374
+ this.isPenEvent = true;
32375
+ this.activePenPointerId = evt.pointerId;
32376
+ if (this.hasPenInput === null) {
32377
+ this.hasPenInput = true;
32378
+ this.inputType = "pen";
32379
+ this.emitter.emit("inputTypeChange", this.inputType);
32380
+ }
32381
+ } else {
32382
+ if (this.activePenPointerId === null) {
32383
+ this.isPenEvent = false;
32384
+ }
32385
+ }
32386
+ }, {
32387
+ capture: true
32388
+ });
32389
+ document.body.addEventListener("pointerup", (evt) => {
32390
+ if (evt.pointerId === this.activePenPointerId) {
32391
+ this.activePenPointerId = null;
32392
+ this.isPenEvent = false;
32393
+ }
32394
+ }, {
32395
+ capture: true
32396
+ });
32397
+ document.body.addEventListener("pointercancel", (evt) => {
32398
+ if (evt.pointerId === this.activePenPointerId) {
32399
+ this.activePenPointerId = null;
32400
+ this.isPenEvent = false;
32298
32401
  }
32299
32402
  }, {
32300
32403
  capture: true