@netless/forge-whiteboard 1.2.0-beta.0 → 1.2.0

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/changelog.md CHANGED
@@ -76,7 +76,9 @@
76
76
  ### 1.2.0
77
77
 
78
78
  - 修复 Apple Pencil 手掌误触导致笔迹中断的问题
79
- - 优化曲线笔迹质量,支持真实 Apple Pencil 压感
80
- - 缩放感知的 perfect-freehand 参数,跟踪 zoom 变化
81
- - WhiteboardTool 基类增加拖拽事件节流
79
+ - 优化曲线笔迹质量与缩放场景下的书写一致性,减少缩放后笔迹表现失真
80
+ - WhiteboardTool 基类增加拖拽事件节流,降低高频拖拽带来的卡顿
81
+ - 插入图片时自动按当前视口居中并按比例适配展示
82
+ - 点文本初始化流程优化,避免首次创建时 points 重复设置
83
+ - 图片渲染与截图流程增加跨域处理和错误兜底,提升导出稳定性
82
84
  - FPS 指标改为每 60 秒上报,增加 P90 百分位
@@ -1 +1 @@
1
- {"version":3,"file":"RenderableModel.d.ts","sourceRoot":"","sources":["../../src/model/RenderableModel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,YAAY,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAuB,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAE5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,YAAY,E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,iBAAiB,GAAG,IAAI;IA4B7D,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI;IA8BjD,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,cAAc,GAAG,IAAI;IA6B7E,YAAY;IAgBZ,OAAO,CAAC,aAAa,EAAE,OAAO;CAUtC"}
@@ -11,8 +11,6 @@ export declare class CurveModel extends ElementModel<paper.Path> {
11
11
  constructor(root: Y.Map<any>, scope: paper.PaperScope, liveCursor: LiveCursor, isPerformanceMode: () => boolean);
12
12
  private average;
13
13
  private parsePoints;
14
- private isPressureValue;
15
- private pointStride;
16
14
  private matrixedPoints;
17
15
  private createPath;
18
16
  protected onVectorUpdate(): void;
@@ -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;AAEzB,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,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;IAUtH,OAAO,CAAC,OAAO;IAIf,OAAO,CAAC,WAAW;IA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AAS;CAqD3C"}
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;IA6B5C,SAAS,CAAC,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS;CAqD3C"}
@@ -23278,7 +23278,7 @@ var require_lodash = __commonJS({
23278
23278
  result2.__values__ = wrapper.__values__;
23279
23279
  return result2;
23280
23280
  }
23281
- function chunk7(array, size2, guard) {
23281
+ function chunk8(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 = chunk7;
25153
+ lodash.chunk = chunk8;
25154
25154
  lodash.compact = compact;
25155
25155
  lodash.concat = concat;
25156
25156
  lodash.cond = cond;
@@ -25640,6 +25640,7 @@ import { v4 as uuidv4 } from "uuid";
25640
25640
  import { log, removeObserver as removeObserver3 } from "@netless/forge-room";
25641
25641
 
25642
25642
  // src/model/renderable/CurveModel.ts
25643
+ var import_lodash = __toESM(require_lodash(), 1);
25643
25644
  import * as Y2 from "yjs";
25644
25645
 
25645
25646
  // ../../node_modules/.pnpm/perfect-freehand@1.2.2/node_modules/perfect-freehand/dist/esm/index.mjs
@@ -26198,7 +26199,7 @@ var CurveModel = class extends ElementModel {
26198
26199
  _defineProperty3(this, "debug", false);
26199
26200
  _defineProperty3(this, "clearLocalPointsWhenYPointsChange", false);
26200
26201
  _defineProperty3(this, "shouldUseLocalPoints", true);
26201
- _defineProperty3(this, "localPointsPick", 6);
26202
+ _defineProperty3(this, "localPointsPick", 4);
26202
26203
  if (!this.root.doc || !this.root.has("type")) {
26203
26204
  this.root.set("type", "curve");
26204
26205
  }
@@ -26210,7 +26211,6 @@ var CurveModel = class extends ElementModel {
26210
26211
  return (a2 + b2) / 2;
26211
26212
  }
26212
26213
  parsePoints(points) {
26213
- const hasRealPressure = points.some((p) => p.length >= 3 && p[2] > 0);
26214
26214
  const viewScale = this.scope.project.view.matrix.scaling.x || 1;
26215
26215
  const taper = this.strokeWidth * 5 / viewScale;
26216
26216
  const streamline = Math.min(0.7, 0.7 * viewScale);
@@ -26219,7 +26219,7 @@ var CurveModel = class extends ElementModel {
26219
26219
  smoothing: 0.7,
26220
26220
  thinning: 0.5,
26221
26221
  streamline,
26222
- simulatePressure: !hasRealPressure,
26222
+ simulatePressure: true,
26223
26223
  start: {
26224
26224
  taper,
26225
26225
  cap: true
@@ -26230,36 +26230,13 @@ var CurveModel = class extends ElementModel {
26230
26230
  }
26231
26231
  });
26232
26232
  }
26233
- isPressureValue(value) {
26234
- return typeof value === "number" && Number.isFinite(value) && value >= 0 && value <= 1;
26235
- }
26236
- pointStride(points) {
26237
- if (points.length >= 3 && points.length % 3 === 0) {
26238
- let hasPressureSlot = false;
26239
- for (let i = 2; i < points.length; i += 3) {
26240
- if (!this.isPressureValue(points[i])) {
26241
- return 2;
26242
- }
26243
- hasPressureSlot = true;
26244
- }
26245
- if (hasPressureSlot) {
26246
- return 3;
26247
- }
26248
- }
26249
- return 2;
26250
- }
26251
26233
  matrixedPoints() {
26252
26234
  const points = this.localPoints.length === 0 ? this.points : this.localPoints;
26253
26235
  const matrix = new this.scope.Matrix(this.pointsMatrix);
26254
- const output = [];
26255
- const stride = this.pointStride(points);
26256
- for (let i = 0, len = points.length; i + 1 < len; i += stride) {
26257
- const p = new this.scope.Point(points[i], points[i + 1]);
26258
- const tp = p.transform(matrix);
26259
- const pressure = stride === 3 ? points[i + 2] ?? 0 : 0;
26260
- output.push([tp.x, tp.y, pressure]);
26261
- }
26262
- return output;
26236
+ return (0, import_lodash.chunk)(points, 2).filter((point) => point.length === 2).map((_ref) => {
26237
+ let [x, y] = _ref;
26238
+ return new this.scope.Point(x, y).transform(matrix);
26239
+ }).map((point) => [point.x, point.y]);
26263
26240
  }
26264
26241
  createPath(points) {
26265
26242
  const path = new this.scope.Path();
@@ -26333,12 +26310,11 @@ var CurveModel = class extends ElementModel {
26333
26310
  liveCursorPoint() {
26334
26311
  const yArray = this.root.get(ElementModel.KEYS.points);
26335
26312
  const points = yArray.toArray();
26336
- const stride = this.pointStride(points);
26337
- if (points.length < stride) {
26313
+ if (points.length < 2) {
26338
26314
  return null;
26339
26315
  }
26340
26316
  const len = points.length;
26341
- const point = new this.scope.Point(points[len - stride], points[len - stride + 1]);
26317
+ const point = new this.scope.Point(points[len - 2], points[len - 1]);
26342
26318
  return point.transform(new this.scope.Matrix(this.pointsMatrix));
26343
26319
  }
26344
26320
  onStyleKeyUpdate(key) {
@@ -26439,7 +26415,7 @@ var SelectorModel = class extends ElementModel {
26439
26415
  import * as Y4 from "yjs";
26440
26416
 
26441
26417
  // src/utils/paperjs.ts
26442
- var import_lodash = __toESM(require_lodash(), 1);
26418
+ var import_lodash2 = __toESM(require_lodash(), 1);
26443
26419
  import { metrics } from "@netless/forge-room";
26444
26420
  function _defineProperty5(e, r, t) {
26445
26421
  return (r = _toPropertyKey5(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
@@ -26473,7 +26449,7 @@ function serializePath(path) {
26473
26449
  }, []);
26474
26450
  }
26475
26451
  function deserializePath(points, scope, matrix) {
26476
- const segmentGroup = (0, import_lodash.chunk)(points, 6);
26452
+ const segmentGroup = (0, import_lodash2.chunk)(points, 6);
26477
26453
  const path = new scope.Path();
26478
26454
  path.segments = segmentGroup.map((v) => deserializeSegment(v, scope, matrix));
26479
26455
  return path;
@@ -26615,7 +26591,7 @@ var SegmentsModel = class extends ElementModel {
26615
26591
  };
26616
26592
 
26617
26593
  // src/model/renderable/LineModel.ts
26618
- var import_lodash3 = __toESM(require_lodash(), 1);
26594
+ var import_lodash4 = __toESM(require_lodash(), 1);
26619
26595
  import * as Y5 from "yjs";
26620
26596
 
26621
26597
  // src/tool/WhiteboardTool.ts
@@ -26715,7 +26691,7 @@ var WhiteboardTool = class {
26715
26691
  };
26716
26692
 
26717
26693
  // src/tool/LineTool.ts
26718
- var import_lodash2 = __toESM(require_lodash(), 1);
26694
+ var import_lodash3 = __toESM(require_lodash(), 1);
26719
26695
  function _defineProperty8(e, r, t) {
26720
26696
  return (r = _toPropertyKey8(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
26721
26697
  }
@@ -26764,7 +26740,7 @@ var LineTool = class extends WhiteboardTool {
26764
26740
  const point = path.getPointAt(distance);
26765
26741
  return [point.x, point.y];
26766
26742
  });
26767
- this.elementModel.setPoints((0, import_lodash2.flattenDeep)(points));
26743
+ this.elementModel.setPoints((0, import_lodash3.flattenDeep)(points));
26768
26744
  }
26769
26745
  }
26770
26746
  onMouseUp(_event) {
@@ -26847,7 +26823,7 @@ var LineModel = class extends ElementModel {
26847
26823
  }
26848
26824
  renderLine() {
26849
26825
  const matrix = new this.scope.Matrix(this.pointsMatrix);
26850
- const papperPoints = (0, import_lodash3.chunk)(this.drawPoints, 2).map((item) => {
26826
+ const papperPoints = (0, import_lodash4.chunk)(this.drawPoints, 2).map((item) => {
26851
26827
  return new this.scope.Point(item[0], item[1]).transform(matrix);
26852
26828
  });
26853
26829
  const path = new this.scope.Path();
@@ -26983,7 +26959,7 @@ var LineControlPoint = class {
26983
26959
  const invertedPoint = point.transform(pointsMatrix.inverted());
26984
26960
  const points = this.model["drawPoints"];
26985
26961
  this.position = invertedPoint;
26986
- const clonedPoints = (0, import_lodash3.cloneDeep)(points);
26962
+ const clonedPoints = (0, import_lodash4.cloneDeep)(points);
26987
26963
  clonedPoints[this.options.index * 2] = invertedPoint.x;
26988
26964
  clonedPoints[this.options.index * 2 + 1] = invertedPoint.y;
26989
26965
  this.model.setPoints(clonedPoints);
@@ -27467,7 +27443,7 @@ var RectangleModel = class extends ElementModel {
27467
27443
  var elementsUndoOrigin = "elementsUndoOrigin";
27468
27444
 
27469
27445
  // src/model/renderable/EraserModel.ts
27470
- var import_lodash4 = __toESM(require_lodash(), 1);
27446
+ var import_lodash5 = __toESM(require_lodash(), 1);
27471
27447
  import * as Y9 from "yjs";
27472
27448
  function _defineProperty13(e, r, t) {
27473
27449
  return (r = _toPropertyKey13(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
@@ -27536,7 +27512,7 @@ var EraserModel = class extends ElementModel {
27536
27512
  return path;
27537
27513
  }
27538
27514
  parsePoints(points) {
27539
- const groupPoints = (0, import_lodash4.chunk)(points, 2);
27515
+ const groupPoints = (0, import_lodash5.chunk)(points, 2);
27540
27516
  return ae(groupPoints, {
27541
27517
  size: this.strokeWidth,
27542
27518
  smoothing: 0.5,
@@ -27554,7 +27530,7 @@ var EraserModel = class extends ElementModel {
27554
27530
  });
27555
27531
  }
27556
27532
  matrixedPoints() {
27557
- const currentPoints = (0, import_lodash4.chunk)(this.drawPoints, 2).slice(this.sliceBegin);
27533
+ const currentPoints = (0, import_lodash5.chunk)(this.drawPoints, 2).slice(this.sliceBegin);
27558
27534
  return currentPoints.map((_ref) => {
27559
27535
  let [x, y] = _ref;
27560
27536
  return new this.scope.Point(x, y);
@@ -27619,7 +27595,7 @@ var EraserModel = class extends ElementModel {
27619
27595
  };
27620
27596
 
27621
27597
  // src/model/renderable/LaserPointerModel.ts
27622
- var import_lodash5 = __toESM(require_lodash(), 1);
27598
+ var import_lodash6 = __toESM(require_lodash(), 1);
27623
27599
  import * as Y10 from "yjs";
27624
27600
  import { removeObserver as removeObserver2 } from "@netless/forge-room";
27625
27601
  function _defineProperty14(e, r, t) {
@@ -27747,7 +27723,7 @@ var LaserPointerModel = class extends ElementModel {
27747
27723
  const matrix = new this.scope.Matrix(this.pointsMatrix);
27748
27724
  const points = this.cachedPoints || this.points;
27749
27725
  console.log("[][][] ,", this.points.length, this.cachedPoints?.length, this.localPoints.length);
27750
- const groupPoints = (0, import_lodash5.chunk)(points, 2).slice(this.sliceBegin);
27726
+ const groupPoints = (0, import_lodash6.chunk)(points, 2).slice(this.sliceBegin);
27751
27727
  return groupPoints.map((_ref) => {
27752
27728
  let [x, y] = _ref;
27753
27729
  return matrix.transform([x, y]);
@@ -27826,7 +27802,7 @@ var WhiteboardPermissions = class extends AbstractApplicationPermissions {
27826
27802
  };
27827
27803
 
27828
27804
  // src/model/renderable/StraightLineModel.ts
27829
- var import_lodash6 = __toESM(require_lodash(), 1);
27805
+ var import_lodash7 = __toESM(require_lodash(), 1);
27830
27806
  import * as Y11 from "yjs";
27831
27807
  function _defineProperty15(e, r, t) {
27832
27808
  return (r = _toPropertyKey15(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
@@ -27886,7 +27862,7 @@ var StraightLineModel = class extends ElementModel {
27886
27862
  }
27887
27863
  renderLine() {
27888
27864
  const matrix = new this.scope.Matrix(this.pointsMatrix);
27889
- const papperPoints = (0, import_lodash6.chunk)(this.drawPoints, 2).map((item) => {
27865
+ const papperPoints = (0, import_lodash7.chunk)(this.drawPoints, 2).map((item) => {
27890
27866
  return new this.scope.Point(item[0], item[1]).transform(matrix);
27891
27867
  });
27892
27868
  const path = new this.scope.Path();
@@ -28520,7 +28496,7 @@ var RenderableModel = class extends EventEmitter {
28520
28496
  if (shadow) {
28521
28497
  yMap.set(ElementModel.KEYS.shadow, "layer");
28522
28498
  }
28523
- yMap.set(ElementModel.KEYS.points, new Y12.Array());
28499
+ yMap.set(ElementModel.KEYS.points, Y12.Array.from([x, y]));
28524
28500
  yMap.set(ElementModel.KEYS.strokeWidth, this.toolbarModel.strokeWidth);
28525
28501
  yMap.set(ElementModel.KEYS.strokeColor, this.toolbarModel.strokeColor);
28526
28502
  yMap.set(ElementModel.KEYS.fillColor, this.toolbarModel.fillColor);
@@ -28528,7 +28504,6 @@ var RenderableModel = class extends EventEmitter {
28528
28504
  this.elements.set(uuid, yMap);
28529
28505
  }, elementsUndoOrigin);
28530
28506
  pointTextModel.bindObserver();
28531
- pointTextModel.setPoints([x, y]);
28532
28507
  pointTextModel.fontSize = this.toolbarModel.fontSize;
28533
28508
  pointTextModel.fontFamily = this.toolbarModel.fontFamily;
28534
28509
  this.initElement(pointTextModel);
@@ -28562,7 +28537,7 @@ var RenderableModel = class extends EventEmitter {
28562
28537
  };
28563
28538
 
28564
28539
  // src/utils/Recognizer.ts
28565
- var import_lodash7 = __toESM(require_lodash(), 1);
28540
+ var import_lodash8 = __toESM(require_lodash(), 1);
28566
28541
 
28567
28542
  // src/utils/UnistrokeRecognizer.js
28568
28543
  function Point(x, y) {
@@ -28809,7 +28784,7 @@ var Recognizer = class {
28809
28784
  let maxX = -Number.MAX_VALUE;
28810
28785
  let minY = Number.MAX_VALUE;
28811
28786
  let maxY = -Number.MAX_VALUE;
28812
- const result = this.dollar.Recognize((0, import_lodash7.chunk)(points, 3).map((v) => {
28787
+ const result = this.dollar.Recognize((0, import_lodash8.chunk)(points, 2).map((v) => {
28813
28788
  minX = Math.min(minX, v[0]);
28814
28789
  maxX = Math.max(maxX, v[0]);
28815
28790
  minY = Math.min(minY, v[1]);
@@ -28889,22 +28864,20 @@ var CurveTool = class extends WhiteboardTool {
28889
28864
  if (this.elementModel) {
28890
28865
  let lastX = 0;
28891
28866
  let lastY = 0;
28892
- if (this.pendingPoints.length >= 3) {
28893
- lastX = this.pendingPoints[this.pendingPoints.length - 3];
28894
- lastY = this.pendingPoints[this.pendingPoints.length - 2];
28867
+ if (this.pendingPoints.length >= 2) {
28868
+ lastX = this.pendingPoints[this.pendingPoints.length - 2];
28869
+ lastY = this.pendingPoints[this.pendingPoints.length - 1];
28895
28870
  } else {
28896
28871
  const len = this.elementModel.points.length;
28897
- if (len >= 3) {
28898
- lastX = this.elementModel.points[len - 3];
28899
- lastY = this.elementModel.points[len - 2];
28872
+ if (len >= 2) {
28873
+ lastX = this.elementModel.points[len - 2];
28874
+ lastY = this.elementModel.points[len - 1];
28900
28875
  }
28901
28876
  }
28902
28877
  const dist = Math.max(Math.abs(lastX - event.point.x), Math.abs(lastY - event.point.y));
28903
28878
  if (dist >= MIN_DISTANCE) {
28904
28879
  this.pointCount += 1;
28905
- const nativeEvent = event.event;
28906
- const pressure = nativeEvent.pointerType === "pen" && nativeEvent.pressure > 0 ? nativeEvent.pressure : 0;
28907
- this.pendingPoints.push(event.point.x, event.point.y, pressure);
28880
+ this.pendingPoints.push(event.point.x, event.point.y);
28908
28881
  if (!this.flushRafId) {
28909
28882
  this.flushRafId = requestAnimationFrame(this.flushPendingPoints);
28910
28883
  }