microboard-temp 0.13.6 → 0.13.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.
@@ -22208,6 +22208,7 @@ class RichText extends BaseItem {
22208
22208
  autoSizeScale = 1;
22209
22209
  containerMaxWidth;
22210
22210
  linkTo;
22211
+ localArea;
22211
22212
  maxHeight;
22212
22213
  selection;
22213
22214
  transformationRenderBlock = undefined;
@@ -22229,6 +22230,7 @@ class RichText extends BaseItem {
22229
22230
  this.autoSize = autoSize;
22230
22231
  this.insideOf = insideOf;
22231
22232
  this.initialTextStyles = initialTextStyles;
22233
+ this.localArea = container.copy();
22232
22234
  counter = counter + 1;
22233
22235
  this.rtCounter = counter;
22234
22236
  this.linkTo = linkTo || new LinkTo(this.id, this.board.events);
@@ -22381,7 +22383,7 @@ class RichText extends BaseItem {
22381
22383
  this.layoutNodes.width = this.containerMaxWidth;
22382
22384
  }
22383
22385
  }
22384
- this.alignInRectangle(this.getTransformedContainer(), this.editor.verticalAlignment);
22386
+ this.alignInRectangle(this.localArea, this.editor.verticalAlignment);
22385
22387
  this.transformCanvas();
22386
22388
  this.subject.publish(this);
22387
22389
  this.updateRequired = false;
@@ -22461,7 +22463,7 @@ class RichText extends BaseItem {
22461
22463
  this.right = transformed.right;
22462
22464
  this.bottom = transformed.bottom;
22463
22465
  } else {
22464
- this.alignInRectangle(this.getTransformedContainer(), this.editor.verticalAlignment);
22466
+ this.alignInRectangle(this.localArea, this.editor.verticalAlignment);
22465
22467
  }
22466
22468
  this.setClipPath();
22467
22469
  if (!this.isInShape && !this.autoSize) {
@@ -22489,16 +22491,16 @@ class RichText extends BaseItem {
22489
22491
  }
22490
22492
  }
22491
22493
  setClipPath() {
22492
- const container = this.getTransformedContainer();
22493
- const width = container.getWidth();
22494
- const height = container.getHeight();
22494
+ const width = this.localArea.getWidth();
22495
+ const height = this.localArea.getHeight();
22495
22496
  this.clipPath = new conf.path2DFactory;
22496
22497
  this.clipPath.rect(0, 0, width, height);
22497
22498
  }
22498
22499
  setContainer(container) {
22499
22500
  this.isContainerSet = true;
22501
+ this.localArea = container.copy();
22500
22502
  this.container = container;
22501
- this.alignInRectangle(this.getTransformedContainer(), this.editor.verticalAlignment);
22503
+ this.updateElement();
22502
22504
  }
22503
22505
  applyMaxWidth(maxWidth) {
22504
22506
  const shouldNotShrink = this.insideOf !== "RichText" && this.insideOf !== "AINode" && this.containerMaxWidth && this.shrinkWidth;
@@ -22521,8 +22523,8 @@ class RichText extends BaseItem {
22521
22523
  matrix = this.transformation.toMatrix();
22522
22524
  }
22523
22525
  const { translateX, translateY, scaleX, scaleY } = matrix;
22524
- const scaledMatrix = new Matrix(translateX, translateY, scaleX, scaleY);
22525
- return this.container.getTransformed(scaledMatrix);
22526
+ const scaledMatrix = new Matrix(translateX, translateY, scaleX * extraScale, scaleY * extraScale);
22527
+ return this.localArea.getTransformed(scaledMatrix);
22526
22528
  }
22527
22529
  emitWithoutApplying = (op) => {
22528
22530
  if (this.board.events) {
@@ -22864,7 +22866,7 @@ class RichText extends BaseItem {
22864
22866
  if (typeof document !== "undefined") {
22865
22867
  document.fonts.ready.then(() => {
22866
22868
  this.layoutNodes = getBlockNodes(this.getBlockNodes(), this.shrinkWidth ? Infinity : this.getMaxWidth() || 0, this.shrinkWidth, this.insideOf === "Frame");
22867
- this.alignInRectangle(this.getTransformedContainer(), this.editor.verticalAlignment);
22869
+ this.alignInRectangle(this.localArea, this.editor.verticalAlignment);
22868
22870
  this.transformCanvas();
22869
22871
  });
22870
22872
  }
@@ -22894,7 +22896,7 @@ class RichText extends BaseItem {
22894
22896
  const scaledMatrix = new Matrix(translateX, translateY, scaleX * extraScale, scaleY * extraScale);
22895
22897
  context.matrix = scaledMatrix;
22896
22898
  context.applyChanges();
22897
- ctx.translate(this.container.left, this.container.top);
22899
+ ctx.translate(this.left, this.top);
22898
22900
  const shouldClip = this.insideOf === "Shape" || this.insideOf === "Sticker";
22899
22901
  if (shouldClip) {
22900
22902
  ctx.clip(this.clipPath.nativePath);
@@ -23035,7 +23037,7 @@ class RichText extends BaseItem {
23035
23037
  }
23036
23038
  const { translateX, translateY, scaleX, scaleY } = matrix;
23037
23039
  const scaledMatrix = new Matrix(translateX, translateY, scaleX * extraScale, scaleY * extraScale);
23038
- const transform = `translate(${scaledMatrix.translateX + this.container.left * scaledMatrix.scaleX}px, ${scaledMatrix.translateY + this.container.top * scaledMatrix.scaleY}px) scale(${scaledMatrix.scaleX}, ${scaledMatrix.scaleY})`;
23040
+ const transform = `translate(${scaledMatrix.translateX + this.left * scaledMatrix.scaleX}px, ${scaledMatrix.translateY + this.top * scaledMatrix.scaleY}px) scale(${scaledMatrix.scaleX}, ${scaledMatrix.scaleY})`;
23039
23041
  const transformedWidth = this.getMbr().getWidth();
23040
23042
  const transformedHeight = this.getMbr().getHeight();
23041
23043
  const div = documentFactory.createElement("rich-text");
@@ -23131,6 +23133,19 @@ class RichText extends BaseItem {
23131
23133
  getPrevMbr() {
23132
23134
  return this.prevMbr;
23133
23135
  }
23136
+ getMbr() {
23137
+ const cameraScale = this.board.camera.getScale();
23138
+ const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
23139
+ let matrix;
23140
+ if (this.customTransformationMatrix) {
23141
+ matrix = this.customTransformationMatrix();
23142
+ } else {
23143
+ matrix = this.transformation.toMatrix();
23144
+ }
23145
+ const { translateX, translateY, scaleX, scaleY } = matrix;
23146
+ const scaledMatrix = new Matrix(translateX, translateY, scaleX * extraScale, scaleY * extraScale);
23147
+ return new Mbr(this.left, this.top, this.right, this.bottom).getTransformed(scaledMatrix);
23148
+ }
23134
23149
  }
23135
23150
 
23136
23151
  // src/Items/Mbr/updateRects.ts
@@ -41030,6 +41045,8 @@ class DefaultFrameData {
41030
41045
 
41031
41046
  // src/Items/Frame/Frame.ts
41032
41047
  var defaultFrameData = new DefaultFrameData;
41048
+ var HEADING_TOP_OFFSET = -45;
41049
+ var HEADING_BOTTOM_OFFSET = -12;
41033
41050
 
41034
41051
  class Frame2 extends BaseItem {
41035
41052
  getItemById;
@@ -41067,14 +41084,14 @@ class Frame2 extends BaseItem {
41067
41084
  this.borderStyle = borderStyle;
41068
41085
  this.borderWidth = borderWidth;
41069
41086
  this.textContainer = Frames[this.shapeType].textBounds.copy();
41087
+ this.textContainer.top = HEADING_TOP_OFFSET;
41088
+ this.textContainer.bottom = HEADING_BOTTOM_OFFSET;
41070
41089
  this.path = Frames[this.shapeType].path.copy();
41071
41090
  this.transformation = new Transformation(this.id, board.events);
41072
41091
  this.linkTo = new LinkTo(this.id, board.events);
41073
41092
  this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, this.name, true, false, "Frame", { ...conf.DEFAULT_TEXT_STYLES, fontSize: 18, fontColor: FRAME_TITLE_COLOR });
41074
41093
  this.text.editor.verticalAlignment = "bottom";
41075
41094
  this.text.setSelectionHorisontalAlignment("left");
41076
- this.textContainer.top = -45;
41077
- this.textContainer.bottom = -12;
41078
41095
  this.text.customTransformationMatrix = () => {
41079
41096
  const matrix = this.transformation.toMatrix();
41080
41097
  return new Matrix(matrix.translateX, matrix.translateY, 1, 1);
@@ -41107,6 +41124,8 @@ class Frame2 extends BaseItem {
41107
41124
  initPath() {
41108
41125
  this.path = Frames[this.shapeType].path.copy();
41109
41126
  this.textContainer = Frames[this.shapeType].textBounds.copy();
41127
+ this.textContainer.top = HEADING_TOP_OFFSET;
41128
+ this.textContainer.bottom = HEADING_BOTTOM_OFFSET;
41110
41129
  this.text.setContainer(this.textContainer.copy());
41111
41130
  this.text.updateElement();
41112
41131
  }
@@ -41251,6 +41270,9 @@ class Frame2 extends BaseItem {
41251
41270
  }
41252
41271
  if (data.text) {
41253
41272
  this.text.deserialize(data.text);
41273
+ this.textContainer.top = HEADING_TOP_OFFSET;
41274
+ this.textContainer.bottom = HEADING_BOTTOM_OFFSET;
41275
+ this.text.setContainer(this.textContainer.copy());
41254
41276
  }
41255
41277
  this.canChangeRatio = data.canChangeRatio ?? this.canChangeRatio;
41256
41278
  this.subject.publish(this);
package/dist/cjs/index.js CHANGED
@@ -22208,6 +22208,7 @@ class RichText extends BaseItem {
22208
22208
  autoSizeScale = 1;
22209
22209
  containerMaxWidth;
22210
22210
  linkTo;
22211
+ localArea;
22211
22212
  maxHeight;
22212
22213
  selection;
22213
22214
  transformationRenderBlock = undefined;
@@ -22229,6 +22230,7 @@ class RichText extends BaseItem {
22229
22230
  this.autoSize = autoSize;
22230
22231
  this.insideOf = insideOf;
22231
22232
  this.initialTextStyles = initialTextStyles;
22233
+ this.localArea = container.copy();
22232
22234
  counter = counter + 1;
22233
22235
  this.rtCounter = counter;
22234
22236
  this.linkTo = linkTo || new LinkTo(this.id, this.board.events);
@@ -22381,7 +22383,7 @@ class RichText extends BaseItem {
22381
22383
  this.layoutNodes.width = this.containerMaxWidth;
22382
22384
  }
22383
22385
  }
22384
- this.alignInRectangle(this.getTransformedContainer(), this.editor.verticalAlignment);
22386
+ this.alignInRectangle(this.localArea, this.editor.verticalAlignment);
22385
22387
  this.transformCanvas();
22386
22388
  this.subject.publish(this);
22387
22389
  this.updateRequired = false;
@@ -22461,7 +22463,7 @@ class RichText extends BaseItem {
22461
22463
  this.right = transformed.right;
22462
22464
  this.bottom = transformed.bottom;
22463
22465
  } else {
22464
- this.alignInRectangle(this.getTransformedContainer(), this.editor.verticalAlignment);
22466
+ this.alignInRectangle(this.localArea, this.editor.verticalAlignment);
22465
22467
  }
22466
22468
  this.setClipPath();
22467
22469
  if (!this.isInShape && !this.autoSize) {
@@ -22489,16 +22491,16 @@ class RichText extends BaseItem {
22489
22491
  }
22490
22492
  }
22491
22493
  setClipPath() {
22492
- const container = this.getTransformedContainer();
22493
- const width = container.getWidth();
22494
- const height = container.getHeight();
22494
+ const width = this.localArea.getWidth();
22495
+ const height = this.localArea.getHeight();
22495
22496
  this.clipPath = new conf.path2DFactory;
22496
22497
  this.clipPath.rect(0, 0, width, height);
22497
22498
  }
22498
22499
  setContainer(container) {
22499
22500
  this.isContainerSet = true;
22501
+ this.localArea = container.copy();
22500
22502
  this.container = container;
22501
- this.alignInRectangle(this.getTransformedContainer(), this.editor.verticalAlignment);
22503
+ this.updateElement();
22502
22504
  }
22503
22505
  applyMaxWidth(maxWidth) {
22504
22506
  const shouldNotShrink = this.insideOf !== "RichText" && this.insideOf !== "AINode" && this.containerMaxWidth && this.shrinkWidth;
@@ -22521,8 +22523,8 @@ class RichText extends BaseItem {
22521
22523
  matrix = this.transformation.toMatrix();
22522
22524
  }
22523
22525
  const { translateX, translateY, scaleX, scaleY } = matrix;
22524
- const scaledMatrix = new Matrix(translateX, translateY, scaleX, scaleY);
22525
- return this.container.getTransformed(scaledMatrix);
22526
+ const scaledMatrix = new Matrix(translateX, translateY, scaleX * extraScale, scaleY * extraScale);
22527
+ return this.localArea.getTransformed(scaledMatrix);
22526
22528
  }
22527
22529
  emitWithoutApplying = (op) => {
22528
22530
  if (this.board.events) {
@@ -22864,7 +22866,7 @@ class RichText extends BaseItem {
22864
22866
  if (typeof document !== "undefined") {
22865
22867
  document.fonts.ready.then(() => {
22866
22868
  this.layoutNodes = getBlockNodes(this.getBlockNodes(), this.shrinkWidth ? Infinity : this.getMaxWidth() || 0, this.shrinkWidth, this.insideOf === "Frame");
22867
- this.alignInRectangle(this.getTransformedContainer(), this.editor.verticalAlignment);
22869
+ this.alignInRectangle(this.localArea, this.editor.verticalAlignment);
22868
22870
  this.transformCanvas();
22869
22871
  });
22870
22872
  }
@@ -22894,7 +22896,7 @@ class RichText extends BaseItem {
22894
22896
  const scaledMatrix = new Matrix(translateX, translateY, scaleX * extraScale, scaleY * extraScale);
22895
22897
  context.matrix = scaledMatrix;
22896
22898
  context.applyChanges();
22897
- ctx.translate(this.container.left, this.container.top);
22899
+ ctx.translate(this.left, this.top);
22898
22900
  const shouldClip = this.insideOf === "Shape" || this.insideOf === "Sticker";
22899
22901
  if (shouldClip) {
22900
22902
  ctx.clip(this.clipPath.nativePath);
@@ -23035,7 +23037,7 @@ class RichText extends BaseItem {
23035
23037
  }
23036
23038
  const { translateX, translateY, scaleX, scaleY } = matrix;
23037
23039
  const scaledMatrix = new Matrix(translateX, translateY, scaleX * extraScale, scaleY * extraScale);
23038
- const transform = `translate(${scaledMatrix.translateX + this.container.left * scaledMatrix.scaleX}px, ${scaledMatrix.translateY + this.container.top * scaledMatrix.scaleY}px) scale(${scaledMatrix.scaleX}, ${scaledMatrix.scaleY})`;
23040
+ const transform = `translate(${scaledMatrix.translateX + this.left * scaledMatrix.scaleX}px, ${scaledMatrix.translateY + this.top * scaledMatrix.scaleY}px) scale(${scaledMatrix.scaleX}, ${scaledMatrix.scaleY})`;
23039
23041
  const transformedWidth = this.getMbr().getWidth();
23040
23042
  const transformedHeight = this.getMbr().getHeight();
23041
23043
  const div = documentFactory.createElement("rich-text");
@@ -23131,6 +23133,19 @@ class RichText extends BaseItem {
23131
23133
  getPrevMbr() {
23132
23134
  return this.prevMbr;
23133
23135
  }
23136
+ getMbr() {
23137
+ const cameraScale = this.board.camera.getScale();
23138
+ const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
23139
+ let matrix;
23140
+ if (this.customTransformationMatrix) {
23141
+ matrix = this.customTransformationMatrix();
23142
+ } else {
23143
+ matrix = this.transformation.toMatrix();
23144
+ }
23145
+ const { translateX, translateY, scaleX, scaleY } = matrix;
23146
+ const scaledMatrix = new Matrix(translateX, translateY, scaleX * extraScale, scaleY * extraScale);
23147
+ return new Mbr(this.left, this.top, this.right, this.bottom).getTransformed(scaledMatrix);
23148
+ }
23134
23149
  }
23135
23150
 
23136
23151
  // src/Items/Mbr/updateRects.ts
@@ -41030,6 +41045,8 @@ class DefaultFrameData {
41030
41045
 
41031
41046
  // src/Items/Frame/Frame.ts
41032
41047
  var defaultFrameData = new DefaultFrameData;
41048
+ var HEADING_TOP_OFFSET = -45;
41049
+ var HEADING_BOTTOM_OFFSET = -12;
41033
41050
 
41034
41051
  class Frame2 extends BaseItem {
41035
41052
  getItemById;
@@ -41067,14 +41084,14 @@ class Frame2 extends BaseItem {
41067
41084
  this.borderStyle = borderStyle;
41068
41085
  this.borderWidth = borderWidth;
41069
41086
  this.textContainer = Frames[this.shapeType].textBounds.copy();
41087
+ this.textContainer.top = HEADING_TOP_OFFSET;
41088
+ this.textContainer.bottom = HEADING_BOTTOM_OFFSET;
41070
41089
  this.path = Frames[this.shapeType].path.copy();
41071
41090
  this.transformation = new Transformation(this.id, board.events);
41072
41091
  this.linkTo = new LinkTo(this.id, board.events);
41073
41092
  this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, this.name, true, false, "Frame", { ...conf.DEFAULT_TEXT_STYLES, fontSize: 18, fontColor: FRAME_TITLE_COLOR });
41074
41093
  this.text.editor.verticalAlignment = "bottom";
41075
41094
  this.text.setSelectionHorisontalAlignment("left");
41076
- this.textContainer.top = -45;
41077
- this.textContainer.bottom = -12;
41078
41095
  this.text.customTransformationMatrix = () => {
41079
41096
  const matrix = this.transformation.toMatrix();
41080
41097
  return new Matrix(matrix.translateX, matrix.translateY, 1, 1);
@@ -41107,6 +41124,8 @@ class Frame2 extends BaseItem {
41107
41124
  initPath() {
41108
41125
  this.path = Frames[this.shapeType].path.copy();
41109
41126
  this.textContainer = Frames[this.shapeType].textBounds.copy();
41127
+ this.textContainer.top = HEADING_TOP_OFFSET;
41128
+ this.textContainer.bottom = HEADING_BOTTOM_OFFSET;
41110
41129
  this.text.setContainer(this.textContainer.copy());
41111
41130
  this.text.updateElement();
41112
41131
  }
@@ -41251,6 +41270,9 @@ class Frame2 extends BaseItem {
41251
41270
  }
41252
41271
  if (data.text) {
41253
41272
  this.text.deserialize(data.text);
41273
+ this.textContainer.top = HEADING_TOP_OFFSET;
41274
+ this.textContainer.bottom = HEADING_BOTTOM_OFFSET;
41275
+ this.text.setContainer(this.textContainer.copy());
41254
41276
  }
41255
41277
  this.canChangeRatio = data.canChangeRatio ?? this.canChangeRatio;
41256
41278
  this.subject.publish(this);
package/dist/cjs/node.js CHANGED
@@ -24680,6 +24680,7 @@ class RichText extends BaseItem {
24680
24680
  autoSizeScale = 1;
24681
24681
  containerMaxWidth;
24682
24682
  linkTo;
24683
+ localArea;
24683
24684
  maxHeight;
24684
24685
  selection;
24685
24686
  transformationRenderBlock = undefined;
@@ -24701,6 +24702,7 @@ class RichText extends BaseItem {
24701
24702
  this.autoSize = autoSize;
24702
24703
  this.insideOf = insideOf;
24703
24704
  this.initialTextStyles = initialTextStyles;
24705
+ this.localArea = container.copy();
24704
24706
  counter = counter + 1;
24705
24707
  this.rtCounter = counter;
24706
24708
  this.linkTo = linkTo || new LinkTo(this.id, this.board.events);
@@ -24853,7 +24855,7 @@ class RichText extends BaseItem {
24853
24855
  this.layoutNodes.width = this.containerMaxWidth;
24854
24856
  }
24855
24857
  }
24856
- this.alignInRectangle(this.getTransformedContainer(), this.editor.verticalAlignment);
24858
+ this.alignInRectangle(this.localArea, this.editor.verticalAlignment);
24857
24859
  this.transformCanvas();
24858
24860
  this.subject.publish(this);
24859
24861
  this.updateRequired = false;
@@ -24933,7 +24935,7 @@ class RichText extends BaseItem {
24933
24935
  this.right = transformed.right;
24934
24936
  this.bottom = transformed.bottom;
24935
24937
  } else {
24936
- this.alignInRectangle(this.getTransformedContainer(), this.editor.verticalAlignment);
24938
+ this.alignInRectangle(this.localArea, this.editor.verticalAlignment);
24937
24939
  }
24938
24940
  this.setClipPath();
24939
24941
  if (!this.isInShape && !this.autoSize) {
@@ -24961,16 +24963,16 @@ class RichText extends BaseItem {
24961
24963
  }
24962
24964
  }
24963
24965
  setClipPath() {
24964
- const container = this.getTransformedContainer();
24965
- const width = container.getWidth();
24966
- const height = container.getHeight();
24966
+ const width = this.localArea.getWidth();
24967
+ const height = this.localArea.getHeight();
24967
24968
  this.clipPath = new conf.path2DFactory;
24968
24969
  this.clipPath.rect(0, 0, width, height);
24969
24970
  }
24970
24971
  setContainer(container) {
24971
24972
  this.isContainerSet = true;
24973
+ this.localArea = container.copy();
24972
24974
  this.container = container;
24973
- this.alignInRectangle(this.getTransformedContainer(), this.editor.verticalAlignment);
24975
+ this.updateElement();
24974
24976
  }
24975
24977
  applyMaxWidth(maxWidth) {
24976
24978
  const shouldNotShrink = this.insideOf !== "RichText" && this.insideOf !== "AINode" && this.containerMaxWidth && this.shrinkWidth;
@@ -24993,8 +24995,8 @@ class RichText extends BaseItem {
24993
24995
  matrix = this.transformation.toMatrix();
24994
24996
  }
24995
24997
  const { translateX, translateY, scaleX, scaleY } = matrix;
24996
- const scaledMatrix = new Matrix(translateX, translateY, scaleX, scaleY);
24997
- return this.container.getTransformed(scaledMatrix);
24998
+ const scaledMatrix = new Matrix(translateX, translateY, scaleX * extraScale, scaleY * extraScale);
24999
+ return this.localArea.getTransformed(scaledMatrix);
24998
25000
  }
24999
25001
  emitWithoutApplying = (op) => {
25000
25002
  if (this.board.events) {
@@ -25336,7 +25338,7 @@ class RichText extends BaseItem {
25336
25338
  if (typeof document !== "undefined") {
25337
25339
  document.fonts.ready.then(() => {
25338
25340
  this.layoutNodes = getBlockNodes(this.getBlockNodes(), this.shrinkWidth ? Infinity : this.getMaxWidth() || 0, this.shrinkWidth, this.insideOf === "Frame");
25339
- this.alignInRectangle(this.getTransformedContainer(), this.editor.verticalAlignment);
25341
+ this.alignInRectangle(this.localArea, this.editor.verticalAlignment);
25340
25342
  this.transformCanvas();
25341
25343
  });
25342
25344
  }
@@ -25366,7 +25368,7 @@ class RichText extends BaseItem {
25366
25368
  const scaledMatrix = new Matrix(translateX, translateY, scaleX * extraScale, scaleY * extraScale);
25367
25369
  context.matrix = scaledMatrix;
25368
25370
  context.applyChanges();
25369
- ctx.translate(this.container.left, this.container.top);
25371
+ ctx.translate(this.left, this.top);
25370
25372
  const shouldClip = this.insideOf === "Shape" || this.insideOf === "Sticker";
25371
25373
  if (shouldClip) {
25372
25374
  ctx.clip(this.clipPath.nativePath);
@@ -25507,7 +25509,7 @@ class RichText extends BaseItem {
25507
25509
  }
25508
25510
  const { translateX, translateY, scaleX, scaleY } = matrix;
25509
25511
  const scaledMatrix = new Matrix(translateX, translateY, scaleX * extraScale, scaleY * extraScale);
25510
- const transform = `translate(${scaledMatrix.translateX + this.container.left * scaledMatrix.scaleX}px, ${scaledMatrix.translateY + this.container.top * scaledMatrix.scaleY}px) scale(${scaledMatrix.scaleX}, ${scaledMatrix.scaleY})`;
25512
+ const transform = `translate(${scaledMatrix.translateX + this.left * scaledMatrix.scaleX}px, ${scaledMatrix.translateY + this.top * scaledMatrix.scaleY}px) scale(${scaledMatrix.scaleX}, ${scaledMatrix.scaleY})`;
25511
25513
  const transformedWidth = this.getMbr().getWidth();
25512
25514
  const transformedHeight = this.getMbr().getHeight();
25513
25515
  const div = documentFactory.createElement("rich-text");
@@ -25603,6 +25605,19 @@ class RichText extends BaseItem {
25603
25605
  getPrevMbr() {
25604
25606
  return this.prevMbr;
25605
25607
  }
25608
+ getMbr() {
25609
+ const cameraScale = this.board.camera.getScale();
25610
+ const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
25611
+ let matrix;
25612
+ if (this.customTransformationMatrix) {
25613
+ matrix = this.customTransformationMatrix();
25614
+ } else {
25615
+ matrix = this.transformation.toMatrix();
25616
+ }
25617
+ const { translateX, translateY, scaleX, scaleY } = matrix;
25618
+ const scaledMatrix = new Matrix(translateX, translateY, scaleX * extraScale, scaleY * extraScale);
25619
+ return new Mbr(this.left, this.top, this.right, this.bottom).getTransformed(scaledMatrix);
25620
+ }
25606
25621
  }
25607
25622
 
25608
25623
  // src/Items/Mbr/updateRects.ts
@@ -43503,6 +43518,8 @@ class DefaultFrameData {
43503
43518
 
43504
43519
  // src/Items/Frame/Frame.ts
43505
43520
  var defaultFrameData = new DefaultFrameData;
43521
+ var HEADING_TOP_OFFSET = -45;
43522
+ var HEADING_BOTTOM_OFFSET = -12;
43506
43523
 
43507
43524
  class Frame2 extends BaseItem {
43508
43525
  getItemById;
@@ -43540,14 +43557,14 @@ class Frame2 extends BaseItem {
43540
43557
  this.borderStyle = borderStyle;
43541
43558
  this.borderWidth = borderWidth;
43542
43559
  this.textContainer = Frames[this.shapeType].textBounds.copy();
43560
+ this.textContainer.top = HEADING_TOP_OFFSET;
43561
+ this.textContainer.bottom = HEADING_BOTTOM_OFFSET;
43543
43562
  this.path = Frames[this.shapeType].path.copy();
43544
43563
  this.transformation = new Transformation(this.id, board.events);
43545
43564
  this.linkTo = new LinkTo(this.id, board.events);
43546
43565
  this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, this.name, true, false, "Frame", { ...conf.DEFAULT_TEXT_STYLES, fontSize: 18, fontColor: FRAME_TITLE_COLOR });
43547
43566
  this.text.editor.verticalAlignment = "bottom";
43548
43567
  this.text.setSelectionHorisontalAlignment("left");
43549
- this.textContainer.top = -45;
43550
- this.textContainer.bottom = -12;
43551
43568
  this.text.customTransformationMatrix = () => {
43552
43569
  const matrix = this.transformation.toMatrix();
43553
43570
  return new Matrix(matrix.translateX, matrix.translateY, 1, 1);
@@ -43580,6 +43597,8 @@ class Frame2 extends BaseItem {
43580
43597
  initPath() {
43581
43598
  this.path = Frames[this.shapeType].path.copy();
43582
43599
  this.textContainer = Frames[this.shapeType].textBounds.copy();
43600
+ this.textContainer.top = HEADING_TOP_OFFSET;
43601
+ this.textContainer.bottom = HEADING_BOTTOM_OFFSET;
43583
43602
  this.text.setContainer(this.textContainer.copy());
43584
43603
  this.text.updateElement();
43585
43604
  }
@@ -43724,6 +43743,9 @@ class Frame2 extends BaseItem {
43724
43743
  }
43725
43744
  if (data.text) {
43726
43745
  this.text.deserialize(data.text);
43746
+ this.textContainer.top = HEADING_TOP_OFFSET;
43747
+ this.textContainer.bottom = HEADING_BOTTOM_OFFSET;
43748
+ this.text.setContainer(this.textContainer.copy());
43727
43749
  }
43728
43750
  this.canChangeRatio = data.canChangeRatio ?? this.canChangeRatio;
43729
43751
  this.subject.publish(this);
@@ -22037,6 +22037,7 @@ class RichText extends BaseItem {
22037
22037
  autoSizeScale = 1;
22038
22038
  containerMaxWidth;
22039
22039
  linkTo;
22040
+ localArea;
22040
22041
  maxHeight;
22041
22042
  selection;
22042
22043
  transformationRenderBlock = undefined;
@@ -22058,6 +22059,7 @@ class RichText extends BaseItem {
22058
22059
  this.autoSize = autoSize;
22059
22060
  this.insideOf = insideOf;
22060
22061
  this.initialTextStyles = initialTextStyles;
22062
+ this.localArea = container.copy();
22061
22063
  counter = counter + 1;
22062
22064
  this.rtCounter = counter;
22063
22065
  this.linkTo = linkTo || new LinkTo(this.id, this.board.events);
@@ -22210,7 +22212,7 @@ class RichText extends BaseItem {
22210
22212
  this.layoutNodes.width = this.containerMaxWidth;
22211
22213
  }
22212
22214
  }
22213
- this.alignInRectangle(this.getTransformedContainer(), this.editor.verticalAlignment);
22215
+ this.alignInRectangle(this.localArea, this.editor.verticalAlignment);
22214
22216
  this.transformCanvas();
22215
22217
  this.subject.publish(this);
22216
22218
  this.updateRequired = false;
@@ -22290,7 +22292,7 @@ class RichText extends BaseItem {
22290
22292
  this.right = transformed.right;
22291
22293
  this.bottom = transformed.bottom;
22292
22294
  } else {
22293
- this.alignInRectangle(this.getTransformedContainer(), this.editor.verticalAlignment);
22295
+ this.alignInRectangle(this.localArea, this.editor.verticalAlignment);
22294
22296
  }
22295
22297
  this.setClipPath();
22296
22298
  if (!this.isInShape && !this.autoSize) {
@@ -22318,16 +22320,16 @@ class RichText extends BaseItem {
22318
22320
  }
22319
22321
  }
22320
22322
  setClipPath() {
22321
- const container = this.getTransformedContainer();
22322
- const width = container.getWidth();
22323
- const height = container.getHeight();
22323
+ const width = this.localArea.getWidth();
22324
+ const height = this.localArea.getHeight();
22324
22325
  this.clipPath = new conf.path2DFactory;
22325
22326
  this.clipPath.rect(0, 0, width, height);
22326
22327
  }
22327
22328
  setContainer(container) {
22328
22329
  this.isContainerSet = true;
22330
+ this.localArea = container.copy();
22329
22331
  this.container = container;
22330
- this.alignInRectangle(this.getTransformedContainer(), this.editor.verticalAlignment);
22332
+ this.updateElement();
22331
22333
  }
22332
22334
  applyMaxWidth(maxWidth) {
22333
22335
  const shouldNotShrink = this.insideOf !== "RichText" && this.insideOf !== "AINode" && this.containerMaxWidth && this.shrinkWidth;
@@ -22350,8 +22352,8 @@ class RichText extends BaseItem {
22350
22352
  matrix = this.transformation.toMatrix();
22351
22353
  }
22352
22354
  const { translateX, translateY, scaleX, scaleY } = matrix;
22353
- const scaledMatrix = new Matrix(translateX, translateY, scaleX, scaleY);
22354
- return this.container.getTransformed(scaledMatrix);
22355
+ const scaledMatrix = new Matrix(translateX, translateY, scaleX * extraScale, scaleY * extraScale);
22356
+ return this.localArea.getTransformed(scaledMatrix);
22355
22357
  }
22356
22358
  emitWithoutApplying = (op) => {
22357
22359
  if (this.board.events) {
@@ -22693,7 +22695,7 @@ class RichText extends BaseItem {
22693
22695
  if (typeof document !== "undefined") {
22694
22696
  document.fonts.ready.then(() => {
22695
22697
  this.layoutNodes = getBlockNodes(this.getBlockNodes(), this.shrinkWidth ? Infinity : this.getMaxWidth() || 0, this.shrinkWidth, this.insideOf === "Frame");
22696
- this.alignInRectangle(this.getTransformedContainer(), this.editor.verticalAlignment);
22698
+ this.alignInRectangle(this.localArea, this.editor.verticalAlignment);
22697
22699
  this.transformCanvas();
22698
22700
  });
22699
22701
  }
@@ -22723,7 +22725,7 @@ class RichText extends BaseItem {
22723
22725
  const scaledMatrix = new Matrix(translateX, translateY, scaleX * extraScale, scaleY * extraScale);
22724
22726
  context.matrix = scaledMatrix;
22725
22727
  context.applyChanges();
22726
- ctx.translate(this.container.left, this.container.top);
22728
+ ctx.translate(this.left, this.top);
22727
22729
  const shouldClip = this.insideOf === "Shape" || this.insideOf === "Sticker";
22728
22730
  if (shouldClip) {
22729
22731
  ctx.clip(this.clipPath.nativePath);
@@ -22864,7 +22866,7 @@ class RichText extends BaseItem {
22864
22866
  }
22865
22867
  const { translateX, translateY, scaleX, scaleY } = matrix;
22866
22868
  const scaledMatrix = new Matrix(translateX, translateY, scaleX * extraScale, scaleY * extraScale);
22867
- const transform = `translate(${scaledMatrix.translateX + this.container.left * scaledMatrix.scaleX}px, ${scaledMatrix.translateY + this.container.top * scaledMatrix.scaleY}px) scale(${scaledMatrix.scaleX}, ${scaledMatrix.scaleY})`;
22869
+ const transform = `translate(${scaledMatrix.translateX + this.left * scaledMatrix.scaleX}px, ${scaledMatrix.translateY + this.top * scaledMatrix.scaleY}px) scale(${scaledMatrix.scaleX}, ${scaledMatrix.scaleY})`;
22868
22870
  const transformedWidth = this.getMbr().getWidth();
22869
22871
  const transformedHeight = this.getMbr().getHeight();
22870
22872
  const div = documentFactory.createElement("rich-text");
@@ -22960,6 +22962,19 @@ class RichText extends BaseItem {
22960
22962
  getPrevMbr() {
22961
22963
  return this.prevMbr;
22962
22964
  }
22965
+ getMbr() {
22966
+ const cameraScale = this.board.camera.getScale();
22967
+ const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
22968
+ let matrix;
22969
+ if (this.customTransformationMatrix) {
22970
+ matrix = this.customTransformationMatrix();
22971
+ } else {
22972
+ matrix = this.transformation.toMatrix();
22973
+ }
22974
+ const { translateX, translateY, scaleX, scaleY } = matrix;
22975
+ const scaledMatrix = new Matrix(translateX, translateY, scaleX * extraScale, scaleY * extraScale);
22976
+ return new Mbr(this.left, this.top, this.right, this.bottom).getTransformed(scaledMatrix);
22977
+ }
22963
22978
  }
22964
22979
 
22965
22980
  // src/Items/Mbr/updateRects.ts
@@ -40859,6 +40874,8 @@ class DefaultFrameData {
40859
40874
 
40860
40875
  // src/Items/Frame/Frame.ts
40861
40876
  var defaultFrameData = new DefaultFrameData;
40877
+ var HEADING_TOP_OFFSET = -45;
40878
+ var HEADING_BOTTOM_OFFSET = -12;
40862
40879
 
40863
40880
  class Frame2 extends BaseItem {
40864
40881
  getItemById;
@@ -40896,14 +40913,14 @@ class Frame2 extends BaseItem {
40896
40913
  this.borderStyle = borderStyle;
40897
40914
  this.borderWidth = borderWidth;
40898
40915
  this.textContainer = Frames[this.shapeType].textBounds.copy();
40916
+ this.textContainer.top = HEADING_TOP_OFFSET;
40917
+ this.textContainer.bottom = HEADING_BOTTOM_OFFSET;
40899
40918
  this.path = Frames[this.shapeType].path.copy();
40900
40919
  this.transformation = new Transformation(this.id, board.events);
40901
40920
  this.linkTo = new LinkTo(this.id, board.events);
40902
40921
  this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, this.name, true, false, "Frame", { ...conf.DEFAULT_TEXT_STYLES, fontSize: 18, fontColor: FRAME_TITLE_COLOR });
40903
40922
  this.text.editor.verticalAlignment = "bottom";
40904
40923
  this.text.setSelectionHorisontalAlignment("left");
40905
- this.textContainer.top = -45;
40906
- this.textContainer.bottom = -12;
40907
40924
  this.text.customTransformationMatrix = () => {
40908
40925
  const matrix = this.transformation.toMatrix();
40909
40926
  return new Matrix(matrix.translateX, matrix.translateY, 1, 1);
@@ -40936,6 +40953,8 @@ class Frame2 extends BaseItem {
40936
40953
  initPath() {
40937
40954
  this.path = Frames[this.shapeType].path.copy();
40938
40955
  this.textContainer = Frames[this.shapeType].textBounds.copy();
40956
+ this.textContainer.top = HEADING_TOP_OFFSET;
40957
+ this.textContainer.bottom = HEADING_BOTTOM_OFFSET;
40939
40958
  this.text.setContainer(this.textContainer.copy());
40940
40959
  this.text.updateElement();
40941
40960
  }
@@ -41080,6 +41099,9 @@ class Frame2 extends BaseItem {
41080
41099
  }
41081
41100
  if (data.text) {
41082
41101
  this.text.deserialize(data.text);
41102
+ this.textContainer.top = HEADING_TOP_OFFSET;
41103
+ this.textContainer.bottom = HEADING_BOTTOM_OFFSET;
41104
+ this.text.setContainer(this.textContainer.copy());
41083
41105
  }
41084
41106
  this.canChangeRatio = data.canChangeRatio ?? this.canChangeRatio;
41085
41107
  this.subject.publish(this);
package/dist/esm/index.js CHANGED
@@ -22030,6 +22030,7 @@ class RichText extends BaseItem {
22030
22030
  autoSizeScale = 1;
22031
22031
  containerMaxWidth;
22032
22032
  linkTo;
22033
+ localArea;
22033
22034
  maxHeight;
22034
22035
  selection;
22035
22036
  transformationRenderBlock = undefined;
@@ -22051,6 +22052,7 @@ class RichText extends BaseItem {
22051
22052
  this.autoSize = autoSize;
22052
22053
  this.insideOf = insideOf;
22053
22054
  this.initialTextStyles = initialTextStyles;
22055
+ this.localArea = container.copy();
22054
22056
  counter = counter + 1;
22055
22057
  this.rtCounter = counter;
22056
22058
  this.linkTo = linkTo || new LinkTo(this.id, this.board.events);
@@ -22203,7 +22205,7 @@ class RichText extends BaseItem {
22203
22205
  this.layoutNodes.width = this.containerMaxWidth;
22204
22206
  }
22205
22207
  }
22206
- this.alignInRectangle(this.getTransformedContainer(), this.editor.verticalAlignment);
22208
+ this.alignInRectangle(this.localArea, this.editor.verticalAlignment);
22207
22209
  this.transformCanvas();
22208
22210
  this.subject.publish(this);
22209
22211
  this.updateRequired = false;
@@ -22283,7 +22285,7 @@ class RichText extends BaseItem {
22283
22285
  this.right = transformed.right;
22284
22286
  this.bottom = transformed.bottom;
22285
22287
  } else {
22286
- this.alignInRectangle(this.getTransformedContainer(), this.editor.verticalAlignment);
22288
+ this.alignInRectangle(this.localArea, this.editor.verticalAlignment);
22287
22289
  }
22288
22290
  this.setClipPath();
22289
22291
  if (!this.isInShape && !this.autoSize) {
@@ -22311,16 +22313,16 @@ class RichText extends BaseItem {
22311
22313
  }
22312
22314
  }
22313
22315
  setClipPath() {
22314
- const container = this.getTransformedContainer();
22315
- const width = container.getWidth();
22316
- const height = container.getHeight();
22316
+ const width = this.localArea.getWidth();
22317
+ const height = this.localArea.getHeight();
22317
22318
  this.clipPath = new conf.path2DFactory;
22318
22319
  this.clipPath.rect(0, 0, width, height);
22319
22320
  }
22320
22321
  setContainer(container) {
22321
22322
  this.isContainerSet = true;
22323
+ this.localArea = container.copy();
22322
22324
  this.container = container;
22323
- this.alignInRectangle(this.getTransformedContainer(), this.editor.verticalAlignment);
22325
+ this.updateElement();
22324
22326
  }
22325
22327
  applyMaxWidth(maxWidth) {
22326
22328
  const shouldNotShrink = this.insideOf !== "RichText" && this.insideOf !== "AINode" && this.containerMaxWidth && this.shrinkWidth;
@@ -22343,8 +22345,8 @@ class RichText extends BaseItem {
22343
22345
  matrix = this.transformation.toMatrix();
22344
22346
  }
22345
22347
  const { translateX, translateY, scaleX, scaleY } = matrix;
22346
- const scaledMatrix = new Matrix(translateX, translateY, scaleX, scaleY);
22347
- return this.container.getTransformed(scaledMatrix);
22348
+ const scaledMatrix = new Matrix(translateX, translateY, scaleX * extraScale, scaleY * extraScale);
22349
+ return this.localArea.getTransformed(scaledMatrix);
22348
22350
  }
22349
22351
  emitWithoutApplying = (op) => {
22350
22352
  if (this.board.events) {
@@ -22686,7 +22688,7 @@ class RichText extends BaseItem {
22686
22688
  if (typeof document !== "undefined") {
22687
22689
  document.fonts.ready.then(() => {
22688
22690
  this.layoutNodes = getBlockNodes(this.getBlockNodes(), this.shrinkWidth ? Infinity : this.getMaxWidth() || 0, this.shrinkWidth, this.insideOf === "Frame");
22689
- this.alignInRectangle(this.getTransformedContainer(), this.editor.verticalAlignment);
22691
+ this.alignInRectangle(this.localArea, this.editor.verticalAlignment);
22690
22692
  this.transformCanvas();
22691
22693
  });
22692
22694
  }
@@ -22716,7 +22718,7 @@ class RichText extends BaseItem {
22716
22718
  const scaledMatrix = new Matrix(translateX, translateY, scaleX * extraScale, scaleY * extraScale);
22717
22719
  context.matrix = scaledMatrix;
22718
22720
  context.applyChanges();
22719
- ctx.translate(this.container.left, this.container.top);
22721
+ ctx.translate(this.left, this.top);
22720
22722
  const shouldClip = this.insideOf === "Shape" || this.insideOf === "Sticker";
22721
22723
  if (shouldClip) {
22722
22724
  ctx.clip(this.clipPath.nativePath);
@@ -22857,7 +22859,7 @@ class RichText extends BaseItem {
22857
22859
  }
22858
22860
  const { translateX, translateY, scaleX, scaleY } = matrix;
22859
22861
  const scaledMatrix = new Matrix(translateX, translateY, scaleX * extraScale, scaleY * extraScale);
22860
- const transform = `translate(${scaledMatrix.translateX + this.container.left * scaledMatrix.scaleX}px, ${scaledMatrix.translateY + this.container.top * scaledMatrix.scaleY}px) scale(${scaledMatrix.scaleX}, ${scaledMatrix.scaleY})`;
22862
+ const transform = `translate(${scaledMatrix.translateX + this.left * scaledMatrix.scaleX}px, ${scaledMatrix.translateY + this.top * scaledMatrix.scaleY}px) scale(${scaledMatrix.scaleX}, ${scaledMatrix.scaleY})`;
22861
22863
  const transformedWidth = this.getMbr().getWidth();
22862
22864
  const transformedHeight = this.getMbr().getHeight();
22863
22865
  const div = documentFactory.createElement("rich-text");
@@ -22953,6 +22955,19 @@ class RichText extends BaseItem {
22953
22955
  getPrevMbr() {
22954
22956
  return this.prevMbr;
22955
22957
  }
22958
+ getMbr() {
22959
+ const cameraScale = this.board.camera.getScale();
22960
+ const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
22961
+ let matrix;
22962
+ if (this.customTransformationMatrix) {
22963
+ matrix = this.customTransformationMatrix();
22964
+ } else {
22965
+ matrix = this.transformation.toMatrix();
22966
+ }
22967
+ const { translateX, translateY, scaleX, scaleY } = matrix;
22968
+ const scaledMatrix = new Matrix(translateX, translateY, scaleX * extraScale, scaleY * extraScale);
22969
+ return new Mbr(this.left, this.top, this.right, this.bottom).getTransformed(scaledMatrix);
22970
+ }
22956
22971
  }
22957
22972
 
22958
22973
  // src/Items/Mbr/updateRects.ts
@@ -40852,6 +40867,8 @@ class DefaultFrameData {
40852
40867
 
40853
40868
  // src/Items/Frame/Frame.ts
40854
40869
  var defaultFrameData = new DefaultFrameData;
40870
+ var HEADING_TOP_OFFSET = -45;
40871
+ var HEADING_BOTTOM_OFFSET = -12;
40855
40872
 
40856
40873
  class Frame2 extends BaseItem {
40857
40874
  getItemById;
@@ -40889,14 +40906,14 @@ class Frame2 extends BaseItem {
40889
40906
  this.borderStyle = borderStyle;
40890
40907
  this.borderWidth = borderWidth;
40891
40908
  this.textContainer = Frames[this.shapeType].textBounds.copy();
40909
+ this.textContainer.top = HEADING_TOP_OFFSET;
40910
+ this.textContainer.bottom = HEADING_BOTTOM_OFFSET;
40892
40911
  this.path = Frames[this.shapeType].path.copy();
40893
40912
  this.transformation = new Transformation(this.id, board.events);
40894
40913
  this.linkTo = new LinkTo(this.id, board.events);
40895
40914
  this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, this.name, true, false, "Frame", { ...conf.DEFAULT_TEXT_STYLES, fontSize: 18, fontColor: FRAME_TITLE_COLOR });
40896
40915
  this.text.editor.verticalAlignment = "bottom";
40897
40916
  this.text.setSelectionHorisontalAlignment("left");
40898
- this.textContainer.top = -45;
40899
- this.textContainer.bottom = -12;
40900
40917
  this.text.customTransformationMatrix = () => {
40901
40918
  const matrix = this.transformation.toMatrix();
40902
40919
  return new Matrix(matrix.translateX, matrix.translateY, 1, 1);
@@ -40929,6 +40946,8 @@ class Frame2 extends BaseItem {
40929
40946
  initPath() {
40930
40947
  this.path = Frames[this.shapeType].path.copy();
40931
40948
  this.textContainer = Frames[this.shapeType].textBounds.copy();
40949
+ this.textContainer.top = HEADING_TOP_OFFSET;
40950
+ this.textContainer.bottom = HEADING_BOTTOM_OFFSET;
40932
40951
  this.text.setContainer(this.textContainer.copy());
40933
40952
  this.text.updateElement();
40934
40953
  }
@@ -41073,6 +41092,9 @@ class Frame2 extends BaseItem {
41073
41092
  }
41074
41093
  if (data.text) {
41075
41094
  this.text.deserialize(data.text);
41095
+ this.textContainer.top = HEADING_TOP_OFFSET;
41096
+ this.textContainer.bottom = HEADING_BOTTOM_OFFSET;
41097
+ this.text.setContainer(this.textContainer.copy());
41076
41098
  }
41077
41099
  this.canChangeRatio = data.canChangeRatio ?? this.canChangeRatio;
41078
41100
  this.subject.publish(this);
package/dist/esm/node.js CHANGED
@@ -24497,6 +24497,7 @@ class RichText extends BaseItem {
24497
24497
  autoSizeScale = 1;
24498
24498
  containerMaxWidth;
24499
24499
  linkTo;
24500
+ localArea;
24500
24501
  maxHeight;
24501
24502
  selection;
24502
24503
  transformationRenderBlock = undefined;
@@ -24518,6 +24519,7 @@ class RichText extends BaseItem {
24518
24519
  this.autoSize = autoSize;
24519
24520
  this.insideOf = insideOf;
24520
24521
  this.initialTextStyles = initialTextStyles;
24522
+ this.localArea = container.copy();
24521
24523
  counter = counter + 1;
24522
24524
  this.rtCounter = counter;
24523
24525
  this.linkTo = linkTo || new LinkTo(this.id, this.board.events);
@@ -24670,7 +24672,7 @@ class RichText extends BaseItem {
24670
24672
  this.layoutNodes.width = this.containerMaxWidth;
24671
24673
  }
24672
24674
  }
24673
- this.alignInRectangle(this.getTransformedContainer(), this.editor.verticalAlignment);
24675
+ this.alignInRectangle(this.localArea, this.editor.verticalAlignment);
24674
24676
  this.transformCanvas();
24675
24677
  this.subject.publish(this);
24676
24678
  this.updateRequired = false;
@@ -24750,7 +24752,7 @@ class RichText extends BaseItem {
24750
24752
  this.right = transformed.right;
24751
24753
  this.bottom = transformed.bottom;
24752
24754
  } else {
24753
- this.alignInRectangle(this.getTransformedContainer(), this.editor.verticalAlignment);
24755
+ this.alignInRectangle(this.localArea, this.editor.verticalAlignment);
24754
24756
  }
24755
24757
  this.setClipPath();
24756
24758
  if (!this.isInShape && !this.autoSize) {
@@ -24778,16 +24780,16 @@ class RichText extends BaseItem {
24778
24780
  }
24779
24781
  }
24780
24782
  setClipPath() {
24781
- const container = this.getTransformedContainer();
24782
- const width = container.getWidth();
24783
- const height = container.getHeight();
24783
+ const width = this.localArea.getWidth();
24784
+ const height = this.localArea.getHeight();
24784
24785
  this.clipPath = new conf.path2DFactory;
24785
24786
  this.clipPath.rect(0, 0, width, height);
24786
24787
  }
24787
24788
  setContainer(container) {
24788
24789
  this.isContainerSet = true;
24790
+ this.localArea = container.copy();
24789
24791
  this.container = container;
24790
- this.alignInRectangle(this.getTransformedContainer(), this.editor.verticalAlignment);
24792
+ this.updateElement();
24791
24793
  }
24792
24794
  applyMaxWidth(maxWidth) {
24793
24795
  const shouldNotShrink = this.insideOf !== "RichText" && this.insideOf !== "AINode" && this.containerMaxWidth && this.shrinkWidth;
@@ -24810,8 +24812,8 @@ class RichText extends BaseItem {
24810
24812
  matrix = this.transformation.toMatrix();
24811
24813
  }
24812
24814
  const { translateX, translateY, scaleX, scaleY } = matrix;
24813
- const scaledMatrix = new Matrix(translateX, translateY, scaleX, scaleY);
24814
- return this.container.getTransformed(scaledMatrix);
24815
+ const scaledMatrix = new Matrix(translateX, translateY, scaleX * extraScale, scaleY * extraScale);
24816
+ return this.localArea.getTransformed(scaledMatrix);
24815
24817
  }
24816
24818
  emitWithoutApplying = (op) => {
24817
24819
  if (this.board.events) {
@@ -25153,7 +25155,7 @@ class RichText extends BaseItem {
25153
25155
  if (typeof document !== "undefined") {
25154
25156
  document.fonts.ready.then(() => {
25155
25157
  this.layoutNodes = getBlockNodes(this.getBlockNodes(), this.shrinkWidth ? Infinity : this.getMaxWidth() || 0, this.shrinkWidth, this.insideOf === "Frame");
25156
- this.alignInRectangle(this.getTransformedContainer(), this.editor.verticalAlignment);
25158
+ this.alignInRectangle(this.localArea, this.editor.verticalAlignment);
25157
25159
  this.transformCanvas();
25158
25160
  });
25159
25161
  }
@@ -25183,7 +25185,7 @@ class RichText extends BaseItem {
25183
25185
  const scaledMatrix = new Matrix(translateX, translateY, scaleX * extraScale, scaleY * extraScale);
25184
25186
  context.matrix = scaledMatrix;
25185
25187
  context.applyChanges();
25186
- ctx.translate(this.container.left, this.container.top);
25188
+ ctx.translate(this.left, this.top);
25187
25189
  const shouldClip = this.insideOf === "Shape" || this.insideOf === "Sticker";
25188
25190
  if (shouldClip) {
25189
25191
  ctx.clip(this.clipPath.nativePath);
@@ -25324,7 +25326,7 @@ class RichText extends BaseItem {
25324
25326
  }
25325
25327
  const { translateX, translateY, scaleX, scaleY } = matrix;
25326
25328
  const scaledMatrix = new Matrix(translateX, translateY, scaleX * extraScale, scaleY * extraScale);
25327
- const transform = `translate(${scaledMatrix.translateX + this.container.left * scaledMatrix.scaleX}px, ${scaledMatrix.translateY + this.container.top * scaledMatrix.scaleY}px) scale(${scaledMatrix.scaleX}, ${scaledMatrix.scaleY})`;
25329
+ const transform = `translate(${scaledMatrix.translateX + this.left * scaledMatrix.scaleX}px, ${scaledMatrix.translateY + this.top * scaledMatrix.scaleY}px) scale(${scaledMatrix.scaleX}, ${scaledMatrix.scaleY})`;
25328
25330
  const transformedWidth = this.getMbr().getWidth();
25329
25331
  const transformedHeight = this.getMbr().getHeight();
25330
25332
  const div = documentFactory.createElement("rich-text");
@@ -25420,6 +25422,19 @@ class RichText extends BaseItem {
25420
25422
  getPrevMbr() {
25421
25423
  return this.prevMbr;
25422
25424
  }
25425
+ getMbr() {
25426
+ const cameraScale = this.board.camera.getScale();
25427
+ const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
25428
+ let matrix;
25429
+ if (this.customTransformationMatrix) {
25430
+ matrix = this.customTransformationMatrix();
25431
+ } else {
25432
+ matrix = this.transformation.toMatrix();
25433
+ }
25434
+ const { translateX, translateY, scaleX, scaleY } = matrix;
25435
+ const scaledMatrix = new Matrix(translateX, translateY, scaleX * extraScale, scaleY * extraScale);
25436
+ return new Mbr(this.left, this.top, this.right, this.bottom).getTransformed(scaledMatrix);
25437
+ }
25423
25438
  }
25424
25439
 
25425
25440
  // src/Items/Mbr/updateRects.ts
@@ -43320,6 +43335,8 @@ class DefaultFrameData {
43320
43335
 
43321
43336
  // src/Items/Frame/Frame.ts
43322
43337
  var defaultFrameData = new DefaultFrameData;
43338
+ var HEADING_TOP_OFFSET = -45;
43339
+ var HEADING_BOTTOM_OFFSET = -12;
43323
43340
 
43324
43341
  class Frame2 extends BaseItem {
43325
43342
  getItemById;
@@ -43357,14 +43374,14 @@ class Frame2 extends BaseItem {
43357
43374
  this.borderStyle = borderStyle;
43358
43375
  this.borderWidth = borderWidth;
43359
43376
  this.textContainer = Frames[this.shapeType].textBounds.copy();
43377
+ this.textContainer.top = HEADING_TOP_OFFSET;
43378
+ this.textContainer.bottom = HEADING_BOTTOM_OFFSET;
43360
43379
  this.path = Frames[this.shapeType].path.copy();
43361
43380
  this.transformation = new Transformation(this.id, board.events);
43362
43381
  this.linkTo = new LinkTo(this.id, board.events);
43363
43382
  this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, this.name, true, false, "Frame", { ...conf.DEFAULT_TEXT_STYLES, fontSize: 18, fontColor: FRAME_TITLE_COLOR });
43364
43383
  this.text.editor.verticalAlignment = "bottom";
43365
43384
  this.text.setSelectionHorisontalAlignment("left");
43366
- this.textContainer.top = -45;
43367
- this.textContainer.bottom = -12;
43368
43385
  this.text.customTransformationMatrix = () => {
43369
43386
  const matrix = this.transformation.toMatrix();
43370
43387
  return new Matrix(matrix.translateX, matrix.translateY, 1, 1);
@@ -43397,6 +43414,8 @@ class Frame2 extends BaseItem {
43397
43414
  initPath() {
43398
43415
  this.path = Frames[this.shapeType].path.copy();
43399
43416
  this.textContainer = Frames[this.shapeType].textBounds.copy();
43417
+ this.textContainer.top = HEADING_TOP_OFFSET;
43418
+ this.textContainer.bottom = HEADING_BOTTOM_OFFSET;
43400
43419
  this.text.setContainer(this.textContainer.copy());
43401
43420
  this.text.updateElement();
43402
43421
  }
@@ -43541,6 +43560,9 @@ class Frame2 extends BaseItem {
43541
43560
  }
43542
43561
  if (data.text) {
43543
43562
  this.text.deserialize(data.text);
43563
+ this.textContainer.top = HEADING_TOP_OFFSET;
43564
+ this.textContainer.bottom = HEADING_BOTTOM_OFFSET;
43565
+ this.text.setContainer(this.textContainer.copy());
43544
43566
  }
43545
43567
  this.canChangeRatio = data.canChangeRatio ?? this.canChangeRatio;
43546
43568
  this.subject.publish(this);
@@ -44,6 +44,7 @@ export declare class RichText extends BaseItem {
44
44
  private autoSizeScale;
45
45
  private containerMaxWidth?;
46
46
  readonly linkTo: LinkTo;
47
+ private localArea;
47
48
  maxHeight: number;
48
49
  private selection?;
49
50
  transformationRenderBlock?: boolean;
@@ -153,4 +154,5 @@ export declare class RichText extends BaseItem {
153
154
  getRichText(): RichText;
154
155
  getLinkTo(): string | undefined;
155
156
  getPrevMbr(): Mbr | null;
157
+ getMbr(): Mbr;
156
158
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.13.6",
3
+ "version": "0.13.7",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",