microboard-temp 0.11.5 → 0.11.7

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.
@@ -22363,22 +22363,8 @@ class RichText extends BaseItem {
22363
22363
  const container = this.getTransformedContainer();
22364
22364
  const containerWidth = container.getWidth();
22365
22365
  const containerHeight = container.getHeight();
22366
- const worldMatrix = this.worldMatrixGetter?.();
22367
- let effectiveWidth = containerWidth;
22368
- let effectiveHeight = containerHeight;
22369
- if (worldMatrix) {
22370
- const localScaleX = this.transformation.getScale().x || 1;
22371
- const localScaleY = this.transformation.getScale().y || 1;
22372
- effectiveWidth = containerWidth * (worldMatrix.scaleX / localScaleX);
22373
- effectiveHeight = containerHeight * (worldMatrix.scaleY / localScaleY);
22374
- }
22375
- const optimal = findOptimalMaxWidthForTextAutoSize(nodes, effectiveWidth, effectiveHeight, effectiveWidth);
22376
- const worldTextScale = Math.min(effectiveWidth / optimal.bestMaxWidth, effectiveHeight / optimal.bestMaxHeight);
22377
- if (worldMatrix) {
22378
- const localScaleX = this.transformation.getScale().x || 1;
22379
- return worldTextScale * localScaleX / worldMatrix.scaleX;
22380
- }
22381
- return worldTextScale;
22366
+ const optimal = findOptimalMaxWidthForTextAutoSize(nodes, containerWidth, containerHeight, containerWidth);
22367
+ return Math.min(containerWidth / optimal.bestMaxWidth, containerHeight / optimal.bestMaxHeight);
22382
22368
  }
22383
22369
  applyAutoSizeScale(textScale, blockNodes) {
22384
22370
  const nodes = blockNodes ? blockNodes : this.getBlockNodes();
@@ -40496,17 +40482,24 @@ class Sticker extends BaseItem {
40496
40482
  this.transformPath();
40497
40483
  if (op.method === "applyMatrix") {
40498
40484
  const itemOp = op.items.find((i) => i.id === this.id);
40499
- if (itemOp && (itemOp.matrix.scaleX !== 1 || itemOp.matrix.scaleY !== 1)) {
40500
- if (this.text.isAutosize()) {
40501
- if (itemOp.matrix.scaleX !== itemOp.matrix.scaleY) {
40502
- this.text.applyAutoSizeScale(this.text.calcAutoSize());
40485
+ if (itemOp) {
40486
+ const prevScaleX = this.transformation.previous.scaleX;
40487
+ const prevScaleY = this.transformation.previous.scaleY;
40488
+ const currentScaleX = this.transformation.getScale().x;
40489
+ const currentScaleY = this.transformation.getScale().y;
40490
+ const scaleChanged = Math.abs(currentScaleX - prevScaleX) > 0.0001 || Math.abs(currentScaleY - prevScaleY) > 0.0001;
40491
+ if (scaleChanged) {
40492
+ if (this.text.isAutosize()) {
40493
+ if (Math.abs(currentScaleX - currentScaleY) > 0.0001) {
40494
+ this.text.applyAutoSizeScale(this.text.calcAutoSize());
40495
+ } else {
40496
+ this.text.scaleAutoSizeScale(currentScaleX / prevScaleX);
40497
+ }
40498
+ this.text.recoordinate();
40499
+ this.text.transformCanvas();
40503
40500
  } else {
40504
- this.text.scaleAutoSizeScale(itemOp.matrix.scaleX);
40501
+ this.text.handleInshapeScale();
40505
40502
  }
40506
- this.text.recoordinate();
40507
- this.text.transformCanvas();
40508
- } else {
40509
- this.text.handleInshapeScale();
40510
40503
  }
40511
40504
  }
40512
40505
  }
package/dist/cjs/index.js CHANGED
@@ -22363,22 +22363,8 @@ class RichText extends BaseItem {
22363
22363
  const container = this.getTransformedContainer();
22364
22364
  const containerWidth = container.getWidth();
22365
22365
  const containerHeight = container.getHeight();
22366
- const worldMatrix = this.worldMatrixGetter?.();
22367
- let effectiveWidth = containerWidth;
22368
- let effectiveHeight = containerHeight;
22369
- if (worldMatrix) {
22370
- const localScaleX = this.transformation.getScale().x || 1;
22371
- const localScaleY = this.transformation.getScale().y || 1;
22372
- effectiveWidth = containerWidth * (worldMatrix.scaleX / localScaleX);
22373
- effectiveHeight = containerHeight * (worldMatrix.scaleY / localScaleY);
22374
- }
22375
- const optimal = findOptimalMaxWidthForTextAutoSize(nodes, effectiveWidth, effectiveHeight, effectiveWidth);
22376
- const worldTextScale = Math.min(effectiveWidth / optimal.bestMaxWidth, effectiveHeight / optimal.bestMaxHeight);
22377
- if (worldMatrix) {
22378
- const localScaleX = this.transformation.getScale().x || 1;
22379
- return worldTextScale * localScaleX / worldMatrix.scaleX;
22380
- }
22381
- return worldTextScale;
22366
+ const optimal = findOptimalMaxWidthForTextAutoSize(nodes, containerWidth, containerHeight, containerWidth);
22367
+ return Math.min(containerWidth / optimal.bestMaxWidth, containerHeight / optimal.bestMaxHeight);
22382
22368
  }
22383
22369
  applyAutoSizeScale(textScale, blockNodes) {
22384
22370
  const nodes = blockNodes ? blockNodes : this.getBlockNodes();
@@ -40496,17 +40482,24 @@ class Sticker extends BaseItem {
40496
40482
  this.transformPath();
40497
40483
  if (op.method === "applyMatrix") {
40498
40484
  const itemOp = op.items.find((i) => i.id === this.id);
40499
- if (itemOp && (itemOp.matrix.scaleX !== 1 || itemOp.matrix.scaleY !== 1)) {
40500
- if (this.text.isAutosize()) {
40501
- if (itemOp.matrix.scaleX !== itemOp.matrix.scaleY) {
40502
- this.text.applyAutoSizeScale(this.text.calcAutoSize());
40485
+ if (itemOp) {
40486
+ const prevScaleX = this.transformation.previous.scaleX;
40487
+ const prevScaleY = this.transformation.previous.scaleY;
40488
+ const currentScaleX = this.transformation.getScale().x;
40489
+ const currentScaleY = this.transformation.getScale().y;
40490
+ const scaleChanged = Math.abs(currentScaleX - prevScaleX) > 0.0001 || Math.abs(currentScaleY - prevScaleY) > 0.0001;
40491
+ if (scaleChanged) {
40492
+ if (this.text.isAutosize()) {
40493
+ if (Math.abs(currentScaleX - currentScaleY) > 0.0001) {
40494
+ this.text.applyAutoSizeScale(this.text.calcAutoSize());
40495
+ } else {
40496
+ this.text.scaleAutoSizeScale(currentScaleX / prevScaleX);
40497
+ }
40498
+ this.text.recoordinate();
40499
+ this.text.transformCanvas();
40503
40500
  } else {
40504
- this.text.scaleAutoSizeScale(itemOp.matrix.scaleX);
40501
+ this.text.handleInshapeScale();
40505
40502
  }
40506
- this.text.recoordinate();
40507
- this.text.transformCanvas();
40508
- } else {
40509
- this.text.handleInshapeScale();
40510
40503
  }
40511
40504
  }
40512
40505
  }
package/dist/cjs/node.js CHANGED
@@ -24835,22 +24835,8 @@ class RichText extends BaseItem {
24835
24835
  const container = this.getTransformedContainer();
24836
24836
  const containerWidth = container.getWidth();
24837
24837
  const containerHeight = container.getHeight();
24838
- const worldMatrix = this.worldMatrixGetter?.();
24839
- let effectiveWidth = containerWidth;
24840
- let effectiveHeight = containerHeight;
24841
- if (worldMatrix) {
24842
- const localScaleX = this.transformation.getScale().x || 1;
24843
- const localScaleY = this.transformation.getScale().y || 1;
24844
- effectiveWidth = containerWidth * (worldMatrix.scaleX / localScaleX);
24845
- effectiveHeight = containerHeight * (worldMatrix.scaleY / localScaleY);
24846
- }
24847
- const optimal = findOptimalMaxWidthForTextAutoSize(nodes, effectiveWidth, effectiveHeight, effectiveWidth);
24848
- const worldTextScale = Math.min(effectiveWidth / optimal.bestMaxWidth, effectiveHeight / optimal.bestMaxHeight);
24849
- if (worldMatrix) {
24850
- const localScaleX = this.transformation.getScale().x || 1;
24851
- return worldTextScale * localScaleX / worldMatrix.scaleX;
24852
- }
24853
- return worldTextScale;
24838
+ const optimal = findOptimalMaxWidthForTextAutoSize(nodes, containerWidth, containerHeight, containerWidth);
24839
+ return Math.min(containerWidth / optimal.bestMaxWidth, containerHeight / optimal.bestMaxHeight);
24854
24840
  }
24855
24841
  applyAutoSizeScale(textScale, blockNodes) {
24856
24842
  const nodes = blockNodes ? blockNodes : this.getBlockNodes();
@@ -42969,17 +42955,24 @@ class Sticker extends BaseItem {
42969
42955
  this.transformPath();
42970
42956
  if (op.method === "applyMatrix") {
42971
42957
  const itemOp = op.items.find((i) => i.id === this.id);
42972
- if (itemOp && (itemOp.matrix.scaleX !== 1 || itemOp.matrix.scaleY !== 1)) {
42973
- if (this.text.isAutosize()) {
42974
- if (itemOp.matrix.scaleX !== itemOp.matrix.scaleY) {
42975
- this.text.applyAutoSizeScale(this.text.calcAutoSize());
42958
+ if (itemOp) {
42959
+ const prevScaleX = this.transformation.previous.scaleX;
42960
+ const prevScaleY = this.transformation.previous.scaleY;
42961
+ const currentScaleX = this.transformation.getScale().x;
42962
+ const currentScaleY = this.transformation.getScale().y;
42963
+ const scaleChanged = Math.abs(currentScaleX - prevScaleX) > 0.0001 || Math.abs(currentScaleY - prevScaleY) > 0.0001;
42964
+ if (scaleChanged) {
42965
+ if (this.text.isAutosize()) {
42966
+ if (Math.abs(currentScaleX - currentScaleY) > 0.0001) {
42967
+ this.text.applyAutoSizeScale(this.text.calcAutoSize());
42968
+ } else {
42969
+ this.text.scaleAutoSizeScale(currentScaleX / prevScaleX);
42970
+ }
42971
+ this.text.recoordinate();
42972
+ this.text.transformCanvas();
42976
42973
  } else {
42977
- this.text.scaleAutoSizeScale(itemOp.matrix.scaleX);
42974
+ this.text.handleInshapeScale();
42978
42975
  }
42979
- this.text.recoordinate();
42980
- this.text.transformCanvas();
42981
- } else {
42982
- this.text.handleInshapeScale();
42983
42976
  }
42984
42977
  }
42985
42978
  }
@@ -22192,22 +22192,8 @@ class RichText extends BaseItem {
22192
22192
  const container = this.getTransformedContainer();
22193
22193
  const containerWidth = container.getWidth();
22194
22194
  const containerHeight = container.getHeight();
22195
- const worldMatrix = this.worldMatrixGetter?.();
22196
- let effectiveWidth = containerWidth;
22197
- let effectiveHeight = containerHeight;
22198
- if (worldMatrix) {
22199
- const localScaleX = this.transformation.getScale().x || 1;
22200
- const localScaleY = this.transformation.getScale().y || 1;
22201
- effectiveWidth = containerWidth * (worldMatrix.scaleX / localScaleX);
22202
- effectiveHeight = containerHeight * (worldMatrix.scaleY / localScaleY);
22203
- }
22204
- const optimal = findOptimalMaxWidthForTextAutoSize(nodes, effectiveWidth, effectiveHeight, effectiveWidth);
22205
- const worldTextScale = Math.min(effectiveWidth / optimal.bestMaxWidth, effectiveHeight / optimal.bestMaxHeight);
22206
- if (worldMatrix) {
22207
- const localScaleX = this.transformation.getScale().x || 1;
22208
- return worldTextScale * localScaleX / worldMatrix.scaleX;
22209
- }
22210
- return worldTextScale;
22195
+ const optimal = findOptimalMaxWidthForTextAutoSize(nodes, containerWidth, containerHeight, containerWidth);
22196
+ return Math.min(containerWidth / optimal.bestMaxWidth, containerHeight / optimal.bestMaxHeight);
22211
22197
  }
22212
22198
  applyAutoSizeScale(textScale, blockNodes) {
22213
22199
  const nodes = blockNodes ? blockNodes : this.getBlockNodes();
@@ -40325,17 +40311,24 @@ class Sticker extends BaseItem {
40325
40311
  this.transformPath();
40326
40312
  if (op.method === "applyMatrix") {
40327
40313
  const itemOp = op.items.find((i) => i.id === this.id);
40328
- if (itemOp && (itemOp.matrix.scaleX !== 1 || itemOp.matrix.scaleY !== 1)) {
40329
- if (this.text.isAutosize()) {
40330
- if (itemOp.matrix.scaleX !== itemOp.matrix.scaleY) {
40331
- this.text.applyAutoSizeScale(this.text.calcAutoSize());
40314
+ if (itemOp) {
40315
+ const prevScaleX = this.transformation.previous.scaleX;
40316
+ const prevScaleY = this.transformation.previous.scaleY;
40317
+ const currentScaleX = this.transformation.getScale().x;
40318
+ const currentScaleY = this.transformation.getScale().y;
40319
+ const scaleChanged = Math.abs(currentScaleX - prevScaleX) > 0.0001 || Math.abs(currentScaleY - prevScaleY) > 0.0001;
40320
+ if (scaleChanged) {
40321
+ if (this.text.isAutosize()) {
40322
+ if (Math.abs(currentScaleX - currentScaleY) > 0.0001) {
40323
+ this.text.applyAutoSizeScale(this.text.calcAutoSize());
40324
+ } else {
40325
+ this.text.scaleAutoSizeScale(currentScaleX / prevScaleX);
40326
+ }
40327
+ this.text.recoordinate();
40328
+ this.text.transformCanvas();
40332
40329
  } else {
40333
- this.text.scaleAutoSizeScale(itemOp.matrix.scaleX);
40330
+ this.text.handleInshapeScale();
40334
40331
  }
40335
- this.text.recoordinate();
40336
- this.text.transformCanvas();
40337
- } else {
40338
- this.text.handleInshapeScale();
40339
40332
  }
40340
40333
  }
40341
40334
  }
package/dist/esm/index.js CHANGED
@@ -22185,22 +22185,8 @@ class RichText extends BaseItem {
22185
22185
  const container = this.getTransformedContainer();
22186
22186
  const containerWidth = container.getWidth();
22187
22187
  const containerHeight = container.getHeight();
22188
- const worldMatrix = this.worldMatrixGetter?.();
22189
- let effectiveWidth = containerWidth;
22190
- let effectiveHeight = containerHeight;
22191
- if (worldMatrix) {
22192
- const localScaleX = this.transformation.getScale().x || 1;
22193
- const localScaleY = this.transformation.getScale().y || 1;
22194
- effectiveWidth = containerWidth * (worldMatrix.scaleX / localScaleX);
22195
- effectiveHeight = containerHeight * (worldMatrix.scaleY / localScaleY);
22196
- }
22197
- const optimal = findOptimalMaxWidthForTextAutoSize(nodes, effectiveWidth, effectiveHeight, effectiveWidth);
22198
- const worldTextScale = Math.min(effectiveWidth / optimal.bestMaxWidth, effectiveHeight / optimal.bestMaxHeight);
22199
- if (worldMatrix) {
22200
- const localScaleX = this.transformation.getScale().x || 1;
22201
- return worldTextScale * localScaleX / worldMatrix.scaleX;
22202
- }
22203
- return worldTextScale;
22188
+ const optimal = findOptimalMaxWidthForTextAutoSize(nodes, containerWidth, containerHeight, containerWidth);
22189
+ return Math.min(containerWidth / optimal.bestMaxWidth, containerHeight / optimal.bestMaxHeight);
22204
22190
  }
22205
22191
  applyAutoSizeScale(textScale, blockNodes) {
22206
22192
  const nodes = blockNodes ? blockNodes : this.getBlockNodes();
@@ -40318,17 +40304,24 @@ class Sticker extends BaseItem {
40318
40304
  this.transformPath();
40319
40305
  if (op.method === "applyMatrix") {
40320
40306
  const itemOp = op.items.find((i) => i.id === this.id);
40321
- if (itemOp && (itemOp.matrix.scaleX !== 1 || itemOp.matrix.scaleY !== 1)) {
40322
- if (this.text.isAutosize()) {
40323
- if (itemOp.matrix.scaleX !== itemOp.matrix.scaleY) {
40324
- this.text.applyAutoSizeScale(this.text.calcAutoSize());
40307
+ if (itemOp) {
40308
+ const prevScaleX = this.transformation.previous.scaleX;
40309
+ const prevScaleY = this.transformation.previous.scaleY;
40310
+ const currentScaleX = this.transformation.getScale().x;
40311
+ const currentScaleY = this.transformation.getScale().y;
40312
+ const scaleChanged = Math.abs(currentScaleX - prevScaleX) > 0.0001 || Math.abs(currentScaleY - prevScaleY) > 0.0001;
40313
+ if (scaleChanged) {
40314
+ if (this.text.isAutosize()) {
40315
+ if (Math.abs(currentScaleX - currentScaleY) > 0.0001) {
40316
+ this.text.applyAutoSizeScale(this.text.calcAutoSize());
40317
+ } else {
40318
+ this.text.scaleAutoSizeScale(currentScaleX / prevScaleX);
40319
+ }
40320
+ this.text.recoordinate();
40321
+ this.text.transformCanvas();
40325
40322
  } else {
40326
- this.text.scaleAutoSizeScale(itemOp.matrix.scaleX);
40323
+ this.text.handleInshapeScale();
40327
40324
  }
40328
- this.text.recoordinate();
40329
- this.text.transformCanvas();
40330
- } else {
40331
- this.text.handleInshapeScale();
40332
40325
  }
40333
40326
  }
40334
40327
  }
package/dist/esm/node.js CHANGED
@@ -24652,22 +24652,8 @@ class RichText extends BaseItem {
24652
24652
  const container = this.getTransformedContainer();
24653
24653
  const containerWidth = container.getWidth();
24654
24654
  const containerHeight = container.getHeight();
24655
- const worldMatrix = this.worldMatrixGetter?.();
24656
- let effectiveWidth = containerWidth;
24657
- let effectiveHeight = containerHeight;
24658
- if (worldMatrix) {
24659
- const localScaleX = this.transformation.getScale().x || 1;
24660
- const localScaleY = this.transformation.getScale().y || 1;
24661
- effectiveWidth = containerWidth * (worldMatrix.scaleX / localScaleX);
24662
- effectiveHeight = containerHeight * (worldMatrix.scaleY / localScaleY);
24663
- }
24664
- const optimal = findOptimalMaxWidthForTextAutoSize(nodes, effectiveWidth, effectiveHeight, effectiveWidth);
24665
- const worldTextScale = Math.min(effectiveWidth / optimal.bestMaxWidth, effectiveHeight / optimal.bestMaxHeight);
24666
- if (worldMatrix) {
24667
- const localScaleX = this.transformation.getScale().x || 1;
24668
- return worldTextScale * localScaleX / worldMatrix.scaleX;
24669
- }
24670
- return worldTextScale;
24655
+ const optimal = findOptimalMaxWidthForTextAutoSize(nodes, containerWidth, containerHeight, containerWidth);
24656
+ return Math.min(containerWidth / optimal.bestMaxWidth, containerHeight / optimal.bestMaxHeight);
24671
24657
  }
24672
24658
  applyAutoSizeScale(textScale, blockNodes) {
24673
24659
  const nodes = blockNodes ? blockNodes : this.getBlockNodes();
@@ -42786,17 +42772,24 @@ class Sticker extends BaseItem {
42786
42772
  this.transformPath();
42787
42773
  if (op.method === "applyMatrix") {
42788
42774
  const itemOp = op.items.find((i) => i.id === this.id);
42789
- if (itemOp && (itemOp.matrix.scaleX !== 1 || itemOp.matrix.scaleY !== 1)) {
42790
- if (this.text.isAutosize()) {
42791
- if (itemOp.matrix.scaleX !== itemOp.matrix.scaleY) {
42792
- this.text.applyAutoSizeScale(this.text.calcAutoSize());
42775
+ if (itemOp) {
42776
+ const prevScaleX = this.transformation.previous.scaleX;
42777
+ const prevScaleY = this.transformation.previous.scaleY;
42778
+ const currentScaleX = this.transformation.getScale().x;
42779
+ const currentScaleY = this.transformation.getScale().y;
42780
+ const scaleChanged = Math.abs(currentScaleX - prevScaleX) > 0.0001 || Math.abs(currentScaleY - prevScaleY) > 0.0001;
42781
+ if (scaleChanged) {
42782
+ if (this.text.isAutosize()) {
42783
+ if (Math.abs(currentScaleX - currentScaleY) > 0.0001) {
42784
+ this.text.applyAutoSizeScale(this.text.calcAutoSize());
42785
+ } else {
42786
+ this.text.scaleAutoSizeScale(currentScaleX / prevScaleX);
42787
+ }
42788
+ this.text.recoordinate();
42789
+ this.text.transformCanvas();
42793
42790
  } else {
42794
- this.text.scaleAutoSizeScale(itemOp.matrix.scaleX);
42791
+ this.text.handleInshapeScale();
42795
42792
  }
42796
- this.text.recoordinate();
42797
- this.text.transformCanvas();
42798
- } else {
42799
- this.text.handleInshapeScale();
42800
42793
  }
42801
42794
  }
42802
42795
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.11.5",
3
+ "version": "0.11.7",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",