microboard-temp 0.11.4 → 0.11.6

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.
@@ -20932,7 +20932,7 @@ class LayeredIndex {
20932
20932
 
20933
20933
  // src/SpatialIndex/SpacialIndex.ts
20934
20934
  function worldBoundsToLocal(container, left, top, right, bottom) {
20935
- const inv = container.getWorldMatrix().getInverse();
20935
+ const inv = container.getNestingMatrix().getInverse();
20936
20936
  const corners = [
20937
20937
  new Point(left, top),
20938
20938
  new Point(right, top),
@@ -21227,7 +21227,7 @@ class SpatialIndex {
21227
21227
  const clearItems = items.filter((item) => {
21228
21228
  if ("index" in item && item.index) {
21229
21229
  const localPt = new Point(point3.x, point3.y);
21230
- item.getWorldMatrix().getInverse().apply(localPt);
21230
+ item.getNestingMatrix().getInverse().apply(localPt);
21231
21231
  children.push(...item.index.getUnderPoint(localPt, tolerance));
21232
21232
  if (!item.getMbr().isUnderPoint(point3)) {
21233
21233
  return false;
@@ -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();
@@ -22861,8 +22847,11 @@ class RichText extends BaseItem {
22861
22847
  const { ctx } = context;
22862
22848
  ctx.save();
22863
22849
  ctx.translate(this.left, this.top);
22864
- const { scaleX, scaleY } = this.transformation.getMatrixData();
22865
- ctx.scale(scaleX, scaleY);
22850
+ const shouldScale = !this.isInShape && !this.autoSize;
22851
+ if (shouldScale) {
22852
+ const { scaleX, scaleY } = this.transformation.getMatrixData();
22853
+ ctx.scale(scaleX, scaleY);
22854
+ }
22866
22855
  const shouldClip = this.insideOf === "Shape" || this.insideOf === "Sticker";
22867
22856
  if (shouldClip) {
22868
22857
  ctx.clip(this.clipPath.nativePath);
package/dist/cjs/index.js CHANGED
@@ -20932,7 +20932,7 @@ class LayeredIndex {
20932
20932
 
20933
20933
  // src/SpatialIndex/SpacialIndex.ts
20934
20934
  function worldBoundsToLocal(container, left, top, right, bottom) {
20935
- const inv = container.getWorldMatrix().getInverse();
20935
+ const inv = container.getNestingMatrix().getInverse();
20936
20936
  const corners = [
20937
20937
  new Point(left, top),
20938
20938
  new Point(right, top),
@@ -21227,7 +21227,7 @@ class SpatialIndex {
21227
21227
  const clearItems = items.filter((item) => {
21228
21228
  if ("index" in item && item.index) {
21229
21229
  const localPt = new Point(point3.x, point3.y);
21230
- item.getWorldMatrix().getInverse().apply(localPt);
21230
+ item.getNestingMatrix().getInverse().apply(localPt);
21231
21231
  children.push(...item.index.getUnderPoint(localPt, tolerance));
21232
21232
  if (!item.getMbr().isUnderPoint(point3)) {
21233
21233
  return false;
@@ -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();
@@ -22861,8 +22847,11 @@ class RichText extends BaseItem {
22861
22847
  const { ctx } = context;
22862
22848
  ctx.save();
22863
22849
  ctx.translate(this.left, this.top);
22864
- const { scaleX, scaleY } = this.transformation.getMatrixData();
22865
- ctx.scale(scaleX, scaleY);
22850
+ const shouldScale = !this.isInShape && !this.autoSize;
22851
+ if (shouldScale) {
22852
+ const { scaleX, scaleY } = this.transformation.getMatrixData();
22853
+ ctx.scale(scaleX, scaleY);
22854
+ }
22866
22855
  const shouldClip = this.insideOf === "Shape" || this.insideOf === "Sticker";
22867
22856
  if (shouldClip) {
22868
22857
  ctx.clip(this.clipPath.nativePath);
package/dist/cjs/node.js CHANGED
@@ -23404,7 +23404,7 @@ class LayeredIndex {
23404
23404
 
23405
23405
  // src/SpatialIndex/SpacialIndex.ts
23406
23406
  function worldBoundsToLocal(container, left, top, right, bottom) {
23407
- const inv = container.getWorldMatrix().getInverse();
23407
+ const inv = container.getNestingMatrix().getInverse();
23408
23408
  const corners = [
23409
23409
  new Point(left, top),
23410
23410
  new Point(right, top),
@@ -23699,7 +23699,7 @@ class SpatialIndex {
23699
23699
  const clearItems = items.filter((item) => {
23700
23700
  if ("index" in item && item.index) {
23701
23701
  const localPt = new Point(point3.x, point3.y);
23702
- item.getWorldMatrix().getInverse().apply(localPt);
23702
+ item.getNestingMatrix().getInverse().apply(localPt);
23703
23703
  children.push(...item.index.getUnderPoint(localPt, tolerance));
23704
23704
  if (!item.getMbr().isUnderPoint(point3)) {
23705
23705
  return false;
@@ -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();
@@ -25333,8 +25319,11 @@ class RichText extends BaseItem {
25333
25319
  const { ctx } = context;
25334
25320
  ctx.save();
25335
25321
  ctx.translate(this.left, this.top);
25336
- const { scaleX, scaleY } = this.transformation.getMatrixData();
25337
- ctx.scale(scaleX, scaleY);
25322
+ const shouldScale = !this.isInShape && !this.autoSize;
25323
+ if (shouldScale) {
25324
+ const { scaleX, scaleY } = this.transformation.getMatrixData();
25325
+ ctx.scale(scaleX, scaleY);
25326
+ }
25338
25327
  const shouldClip = this.insideOf === "Shape" || this.insideOf === "Sticker";
25339
25328
  if (shouldClip) {
25340
25329
  ctx.clip(this.clipPath.nativePath);
@@ -20761,7 +20761,7 @@ class LayeredIndex {
20761
20761
 
20762
20762
  // src/SpatialIndex/SpacialIndex.ts
20763
20763
  function worldBoundsToLocal(container, left, top, right, bottom) {
20764
- const inv = container.getWorldMatrix().getInverse();
20764
+ const inv = container.getNestingMatrix().getInverse();
20765
20765
  const corners = [
20766
20766
  new Point(left, top),
20767
20767
  new Point(right, top),
@@ -21056,7 +21056,7 @@ class SpatialIndex {
21056
21056
  const clearItems = items.filter((item) => {
21057
21057
  if ("index" in item && item.index) {
21058
21058
  const localPt = new Point(point3.x, point3.y);
21059
- item.getWorldMatrix().getInverse().apply(localPt);
21059
+ item.getNestingMatrix().getInverse().apply(localPt);
21060
21060
  children.push(...item.index.getUnderPoint(localPt, tolerance));
21061
21061
  if (!item.getMbr().isUnderPoint(point3)) {
21062
21062
  return false;
@@ -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();
@@ -22690,8 +22676,11 @@ class RichText extends BaseItem {
22690
22676
  const { ctx } = context;
22691
22677
  ctx.save();
22692
22678
  ctx.translate(this.left, this.top);
22693
- const { scaleX, scaleY } = this.transformation.getMatrixData();
22694
- ctx.scale(scaleX, scaleY);
22679
+ const shouldScale = !this.isInShape && !this.autoSize;
22680
+ if (shouldScale) {
22681
+ const { scaleX, scaleY } = this.transformation.getMatrixData();
22682
+ ctx.scale(scaleX, scaleY);
22683
+ }
22695
22684
  const shouldClip = this.insideOf === "Shape" || this.insideOf === "Sticker";
22696
22685
  if (shouldClip) {
22697
22686
  ctx.clip(this.clipPath.nativePath);
package/dist/esm/index.js CHANGED
@@ -20754,7 +20754,7 @@ class LayeredIndex {
20754
20754
 
20755
20755
  // src/SpatialIndex/SpacialIndex.ts
20756
20756
  function worldBoundsToLocal(container, left, top, right, bottom) {
20757
- const inv = container.getWorldMatrix().getInverse();
20757
+ const inv = container.getNestingMatrix().getInverse();
20758
20758
  const corners = [
20759
20759
  new Point(left, top),
20760
20760
  new Point(right, top),
@@ -21049,7 +21049,7 @@ class SpatialIndex {
21049
21049
  const clearItems = items.filter((item) => {
21050
21050
  if ("index" in item && item.index) {
21051
21051
  const localPt = new Point(point3.x, point3.y);
21052
- item.getWorldMatrix().getInverse().apply(localPt);
21052
+ item.getNestingMatrix().getInverse().apply(localPt);
21053
21053
  children.push(...item.index.getUnderPoint(localPt, tolerance));
21054
21054
  if (!item.getMbr().isUnderPoint(point3)) {
21055
21055
  return false;
@@ -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();
@@ -22683,8 +22669,11 @@ class RichText extends BaseItem {
22683
22669
  const { ctx } = context;
22684
22670
  ctx.save();
22685
22671
  ctx.translate(this.left, this.top);
22686
- const { scaleX, scaleY } = this.transformation.getMatrixData();
22687
- ctx.scale(scaleX, scaleY);
22672
+ const shouldScale = !this.isInShape && !this.autoSize;
22673
+ if (shouldScale) {
22674
+ const { scaleX, scaleY } = this.transformation.getMatrixData();
22675
+ ctx.scale(scaleX, scaleY);
22676
+ }
22688
22677
  const shouldClip = this.insideOf === "Shape" || this.insideOf === "Sticker";
22689
22678
  if (shouldClip) {
22690
22679
  ctx.clip(this.clipPath.nativePath);
package/dist/esm/node.js CHANGED
@@ -23221,7 +23221,7 @@ class LayeredIndex {
23221
23221
 
23222
23222
  // src/SpatialIndex/SpacialIndex.ts
23223
23223
  function worldBoundsToLocal(container, left, top, right, bottom) {
23224
- const inv = container.getWorldMatrix().getInverse();
23224
+ const inv = container.getNestingMatrix().getInverse();
23225
23225
  const corners = [
23226
23226
  new Point(left, top),
23227
23227
  new Point(right, top),
@@ -23516,7 +23516,7 @@ class SpatialIndex {
23516
23516
  const clearItems = items.filter((item) => {
23517
23517
  if ("index" in item && item.index) {
23518
23518
  const localPt = new Point(point3.x, point3.y);
23519
- item.getWorldMatrix().getInverse().apply(localPt);
23519
+ item.getNestingMatrix().getInverse().apply(localPt);
23520
23520
  children.push(...item.index.getUnderPoint(localPt, tolerance));
23521
23521
  if (!item.getMbr().isUnderPoint(point3)) {
23522
23522
  return false;
@@ -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();
@@ -25150,8 +25136,11 @@ class RichText extends BaseItem {
25150
25136
  const { ctx } = context;
25151
25137
  ctx.save();
25152
25138
  ctx.translate(this.left, this.top);
25153
- const { scaleX, scaleY } = this.transformation.getMatrixData();
25154
- ctx.scale(scaleX, scaleY);
25139
+ const shouldScale = !this.isInShape && !this.autoSize;
25140
+ if (shouldScale) {
25141
+ const { scaleX, scaleY } = this.transformation.getMatrixData();
25142
+ ctx.scale(scaleX, scaleY);
25143
+ }
25155
25144
  const shouldClip = this.insideOf === "Shape" || this.insideOf === "Sticker";
25156
25145
  if (shouldClip) {
25157
25146
  ctx.clip(this.clipPath.nativePath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.11.4",
3
+ "version": "0.11.6",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",