microboard-temp 0.12.8 → 0.13.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.
@@ -22151,7 +22151,7 @@ class BaseItem extends Mbr {
22151
22151
  if (!this.isHoverHighlighted) {
22152
22152
  return;
22153
22153
  }
22154
- const mbr = this.getMbr();
22154
+ const mbr = this.getWorldMbr();
22155
22155
  mbr.strokeWidth = 2 / context.matrix.scaleX;
22156
22156
  mbr.borderColor = BaseItem.HOVER_HIGHLIGHT_COLOR;
22157
22157
  mbr.render(context);
@@ -22211,6 +22211,8 @@ class RichText extends BaseItem {
22211
22211
  _onLimitReached = () => {};
22212
22212
  shrinkWidth = false;
22213
22213
  prevMbr = null;
22214
+ customTransformationMatrix;
22215
+ renderingScale;
22214
22216
  rtCounter = 0;
22215
22217
  constructor(board, container, id = "", transformation = new Transformation(id, board.events), linkTo, placeholderText = conf.i18n?.t("board.textPlaceholder"), isInShape = false, autoSize = false, insideOf, initialTextStyles = conf.DEFAULT_TEXT_STYLES) {
22216
22218
  super(board, id);
@@ -22504,11 +22506,8 @@ class RichText extends BaseItem {
22504
22506
  return this.shrinkWidth;
22505
22507
  }
22506
22508
  getTransformedContainer() {
22507
- if (this.insideOf === "Frame") {
22508
- const { translateX, translateY, scaleX } = this.transformation.getMatrixData();
22509
- const scaleY = this.getMbr().getHeight() * 2 / 10;
22510
- const matrix = new Matrix(translateX, translateY, scaleX, scaleY);
22511
- return this.container.getTransformed(matrix);
22509
+ if (this.customTransformationMatrix) {
22510
+ return this.container.getTransformed(this.customTransformationMatrix());
22512
22511
  }
22513
22512
  return this.container.getTransformed(this.transformation.toMatrix());
22514
22513
  }
@@ -22879,7 +22878,9 @@ class RichText extends BaseItem {
22879
22878
  ctx.clip(this.clipPath.nativePath);
22880
22879
  }
22881
22880
  const autoSizeScale = this.autoSize ? this.autoSizeScale : undefined;
22882
- this.layoutNodes.render(ctx, autoSizeScale);
22881
+ const cameraScale = context.getCameraScale();
22882
+ const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
22883
+ this.layoutNodes.render(ctx, autoSizeScale ? autoSizeScale * extraScale : extraScale);
22883
22884
  ctx.restore();
22884
22885
  if (this.getLinkTo() && (this.insideOf === "RichText" || !this.insideOf)) {
22885
22886
  const { top, right } = this.getMbr();
@@ -23005,7 +23006,9 @@ class RichText extends BaseItem {
23005
23006
  };
23006
23007
  const elements = this.editor.editor.children.map(renderNode);
23007
23008
  const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
23008
- const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
23009
+ const cameraScale = this.board.camera.getScale();
23010
+ const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
23011
+ const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX * extraScale}, ${scaleY * extraScale})`;
23009
23012
  const transformedWidth = this.getTransformedContainer().getWidth();
23010
23013
  const transformedHeight = this.getTransformedContainer().getHeight();
23011
23014
  const div = documentFactory.createElement("rich-text");
@@ -40933,11 +40936,11 @@ function convertBlobToDataUrl(blob) {
40933
40936
  }
40934
40937
 
40935
40938
  // src/Items/Frame/FrameData.ts
40936
- var FRAME_BORDER_COLOR = "rgba(10, 15, 41, 0.08)";
40939
+ var FRAME_BORDER_COLOR = semanticColor("contrastGray");
40937
40940
  var FRAME_HIGHLIGHTER_BORDER_COLOR = "#93AFF6";
40938
40941
  var FRAME_CHILDREN_HIGHLIGHTER_COLOR = "rgb(10, 15, 41, .08)";
40939
40942
  var FRAME_CHILDREN_HIGHLIGHTER_BORDER_COLOR = "#4778F5";
40940
- var FRAME_TITLE_COLOR = "rgb(107, 110, 120)";
40943
+ var FRAME_TITLE_COLOR = semanticColor("contrastNeutral");
40941
40944
  var FRAME_TYPES = [
40942
40945
  { id: "Custom", label: "Custom" },
40943
40946
  { id: "Frame16x9", label: "16:9" },
@@ -40982,7 +40985,7 @@ class DefaultFrameData {
40982
40985
  canChangeRatio;
40983
40986
  linkTo;
40984
40987
  itemType = "Frame";
40985
- constructor(shapeType = "Custom", backgroundColor = fixedColor(FRAME_FILL_COLOR), backgroundOpacity = 1, borderColor = fixedColor(FRAME_BORDER_COLOR), borderOpacity = 0.08, borderStyle = "solid", borderWidth = 0.2, transformation = new DefaultTransformationData, children = [], text5 = new DefaultRichTextData([], "top", 600), canChangeRatio = true, linkTo) {
40988
+ constructor(shapeType = "Custom", backgroundColor = semanticColor("contrastNeutral"), backgroundOpacity = 1, borderColor = FRAME_BORDER_COLOR, borderOpacity = 1, borderStyle = "solid", borderWidth = 0.2, transformation = new DefaultTransformationData, children = [], text5 = new DefaultRichTextData([], "top", 600), canChangeRatio = true, linkTo) {
40986
40989
  this.shapeType = shapeType;
40987
40990
  this.backgroundColor = backgroundColor;
40988
40991
  this.backgroundOpacity = backgroundOpacity;
@@ -41042,6 +41045,14 @@ class Frame2 extends BaseItem {
41042
41045
  this.linkTo = new LinkTo(this.id, board.events);
41043
41046
  this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, this.name, true, false, "Frame", { ...conf.DEFAULT_TEXT_STYLES, fontColor: FRAME_TITLE_COLOR });
41044
41047
  this.text.setSelectionHorisontalAlignment("left");
41048
+ this.text.customTransformationMatrix = () => {
41049
+ const { translateX, translateY, scaleX } = this.transformation.getMatrixData();
41050
+ const scaleY = this.getMbr().getHeight() * 2 / 10;
41051
+ return new Matrix(translateX, translateY, scaleX, scaleY);
41052
+ };
41053
+ this.text.renderingScale = (cameraScale) => {
41054
+ return Math.max(1, Math.min(5, 1 / cameraScale));
41055
+ };
41045
41056
  this.transformation.subject.subscribe(() => {
41046
41057
  this.transformPath();
41047
41058
  this.updateMbr();
@@ -53725,9 +53736,9 @@ class BoardSelection {
53725
53736
  }
53726
53737
  const selectedMbr = selected.reduce((acc, item) => {
53727
53738
  if (!acc) {
53728
- return item.getMbr();
53739
+ return item instanceof BaseItem ? item.getWorldMbr() : item.getMbr();
53729
53740
  }
53730
- return acc.combine(item.getMbr());
53741
+ return acc.combine(item instanceof BaseItem ? item.getWorldMbr() : item.getMbr());
53731
53742
  }, undefined);
53732
53743
  if (selectedMbr) {
53733
53744
  const selectedMap = Object.fromEntries(selected.map((item) => [item.getId(), { item, nested: false }]));
@@ -53759,7 +53770,7 @@ class BoardSelection {
53759
53770
  const childrenIds = val.item.getChildrenIds();
53760
53771
  if (childrenIds) {
53761
53772
  const currGroup = val.item;
53762
- const currMbr = currGroup.getMbr();
53773
+ const currMbr = currGroup.getWorldMbr();
53763
53774
  const children = childrenIds.map((childId) => this.board.items.getById(childId)).filter((item) => !!item);
53764
53775
  const underGroup = this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).filter((item) => item.parent === "Board" || item.parent === currGroup.getId());
53765
53776
  const uniqueItems = new Set;
@@ -54240,7 +54251,7 @@ class BoardSelection {
54240
54251
  };
54241
54252
  }
54242
54253
  renderItemMbr(context, item, customScale) {
54243
- const mbr = item.getMbr();
54254
+ const mbr = item instanceof BaseItem ? item.getWorldMbr() : item.getMbr();
54244
54255
  mbr.strokeWidth = !customScale ? 1 / context.matrix.scaleX : 1 / customScale;
54245
54256
  const selectionColor = item.transformation.isLocked ? conf.SELECTION_LOCKED_COLOR : conf.SELECTION_COLOR;
54246
54257
  mbr.borderColor = selectionColor;
@@ -54297,7 +54308,7 @@ class BoardSelection {
54297
54308
  path2.setBackgroundColor("none");
54298
54309
  path2.render(context);
54299
54310
  } else {
54300
- const itemRect = item.getMbr();
54311
+ const itemRect = item instanceof BaseItem ? item.getWorldMbr() : item.getMbr();
54301
54312
  itemRect.borderColor = CONTEXT_NODE_HIGHLIGHT_COLOR;
54302
54313
  itemRect.strokeWidth = 2;
54303
54314
  itemRect.render(context);
package/dist/cjs/index.js CHANGED
@@ -22151,7 +22151,7 @@ class BaseItem extends Mbr {
22151
22151
  if (!this.isHoverHighlighted) {
22152
22152
  return;
22153
22153
  }
22154
- const mbr = this.getMbr();
22154
+ const mbr = this.getWorldMbr();
22155
22155
  mbr.strokeWidth = 2 / context.matrix.scaleX;
22156
22156
  mbr.borderColor = BaseItem.HOVER_HIGHLIGHT_COLOR;
22157
22157
  mbr.render(context);
@@ -22211,6 +22211,8 @@ class RichText extends BaseItem {
22211
22211
  _onLimitReached = () => {};
22212
22212
  shrinkWidth = false;
22213
22213
  prevMbr = null;
22214
+ customTransformationMatrix;
22215
+ renderingScale;
22214
22216
  rtCounter = 0;
22215
22217
  constructor(board, container, id = "", transformation = new Transformation(id, board.events), linkTo, placeholderText = conf.i18n?.t("board.textPlaceholder"), isInShape = false, autoSize = false, insideOf, initialTextStyles = conf.DEFAULT_TEXT_STYLES) {
22216
22218
  super(board, id);
@@ -22504,11 +22506,8 @@ class RichText extends BaseItem {
22504
22506
  return this.shrinkWidth;
22505
22507
  }
22506
22508
  getTransformedContainer() {
22507
- if (this.insideOf === "Frame") {
22508
- const { translateX, translateY, scaleX } = this.transformation.getMatrixData();
22509
- const scaleY = this.getMbr().getHeight() * 2 / 10;
22510
- const matrix = new Matrix(translateX, translateY, scaleX, scaleY);
22511
- return this.container.getTransformed(matrix);
22509
+ if (this.customTransformationMatrix) {
22510
+ return this.container.getTransformed(this.customTransformationMatrix());
22512
22511
  }
22513
22512
  return this.container.getTransformed(this.transformation.toMatrix());
22514
22513
  }
@@ -22879,7 +22878,9 @@ class RichText extends BaseItem {
22879
22878
  ctx.clip(this.clipPath.nativePath);
22880
22879
  }
22881
22880
  const autoSizeScale = this.autoSize ? this.autoSizeScale : undefined;
22882
- this.layoutNodes.render(ctx, autoSizeScale);
22881
+ const cameraScale = context.getCameraScale();
22882
+ const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
22883
+ this.layoutNodes.render(ctx, autoSizeScale ? autoSizeScale * extraScale : extraScale);
22883
22884
  ctx.restore();
22884
22885
  if (this.getLinkTo() && (this.insideOf === "RichText" || !this.insideOf)) {
22885
22886
  const { top, right } = this.getMbr();
@@ -23005,7 +23006,9 @@ class RichText extends BaseItem {
23005
23006
  };
23006
23007
  const elements = this.editor.editor.children.map(renderNode);
23007
23008
  const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
23008
- const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
23009
+ const cameraScale = this.board.camera.getScale();
23010
+ const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
23011
+ const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX * extraScale}, ${scaleY * extraScale})`;
23009
23012
  const transformedWidth = this.getTransformedContainer().getWidth();
23010
23013
  const transformedHeight = this.getTransformedContainer().getHeight();
23011
23014
  const div = documentFactory.createElement("rich-text");
@@ -40933,11 +40936,11 @@ function convertBlobToDataUrl(blob) {
40933
40936
  }
40934
40937
 
40935
40938
  // src/Items/Frame/FrameData.ts
40936
- var FRAME_BORDER_COLOR = "rgba(10, 15, 41, 0.08)";
40939
+ var FRAME_BORDER_COLOR = semanticColor("contrastGray");
40937
40940
  var FRAME_HIGHLIGHTER_BORDER_COLOR = "#93AFF6";
40938
40941
  var FRAME_CHILDREN_HIGHLIGHTER_COLOR = "rgb(10, 15, 41, .08)";
40939
40942
  var FRAME_CHILDREN_HIGHLIGHTER_BORDER_COLOR = "#4778F5";
40940
- var FRAME_TITLE_COLOR = "rgb(107, 110, 120)";
40943
+ var FRAME_TITLE_COLOR = semanticColor("contrastNeutral");
40941
40944
  var FRAME_TYPES = [
40942
40945
  { id: "Custom", label: "Custom" },
40943
40946
  { id: "Frame16x9", label: "16:9" },
@@ -40982,7 +40985,7 @@ class DefaultFrameData {
40982
40985
  canChangeRatio;
40983
40986
  linkTo;
40984
40987
  itemType = "Frame";
40985
- constructor(shapeType = "Custom", backgroundColor = fixedColor(FRAME_FILL_COLOR), backgroundOpacity = 1, borderColor = fixedColor(FRAME_BORDER_COLOR), borderOpacity = 0.08, borderStyle = "solid", borderWidth = 0.2, transformation = new DefaultTransformationData, children = [], text5 = new DefaultRichTextData([], "top", 600), canChangeRatio = true, linkTo) {
40988
+ constructor(shapeType = "Custom", backgroundColor = semanticColor("contrastNeutral"), backgroundOpacity = 1, borderColor = FRAME_BORDER_COLOR, borderOpacity = 1, borderStyle = "solid", borderWidth = 0.2, transformation = new DefaultTransformationData, children = [], text5 = new DefaultRichTextData([], "top", 600), canChangeRatio = true, linkTo) {
40986
40989
  this.shapeType = shapeType;
40987
40990
  this.backgroundColor = backgroundColor;
40988
40991
  this.backgroundOpacity = backgroundOpacity;
@@ -41042,6 +41045,14 @@ class Frame2 extends BaseItem {
41042
41045
  this.linkTo = new LinkTo(this.id, board.events);
41043
41046
  this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, this.name, true, false, "Frame", { ...conf.DEFAULT_TEXT_STYLES, fontColor: FRAME_TITLE_COLOR });
41044
41047
  this.text.setSelectionHorisontalAlignment("left");
41048
+ this.text.customTransformationMatrix = () => {
41049
+ const { translateX, translateY, scaleX } = this.transformation.getMatrixData();
41050
+ const scaleY = this.getMbr().getHeight() * 2 / 10;
41051
+ return new Matrix(translateX, translateY, scaleX, scaleY);
41052
+ };
41053
+ this.text.renderingScale = (cameraScale) => {
41054
+ return Math.max(1, Math.min(5, 1 / cameraScale));
41055
+ };
41045
41056
  this.transformation.subject.subscribe(() => {
41046
41057
  this.transformPath();
41047
41058
  this.updateMbr();
@@ -53725,9 +53736,9 @@ class BoardSelection {
53725
53736
  }
53726
53737
  const selectedMbr = selected.reduce((acc, item) => {
53727
53738
  if (!acc) {
53728
- return item.getMbr();
53739
+ return item instanceof BaseItem ? item.getWorldMbr() : item.getMbr();
53729
53740
  }
53730
- return acc.combine(item.getMbr());
53741
+ return acc.combine(item instanceof BaseItem ? item.getWorldMbr() : item.getMbr());
53731
53742
  }, undefined);
53732
53743
  if (selectedMbr) {
53733
53744
  const selectedMap = Object.fromEntries(selected.map((item) => [item.getId(), { item, nested: false }]));
@@ -53759,7 +53770,7 @@ class BoardSelection {
53759
53770
  const childrenIds = val.item.getChildrenIds();
53760
53771
  if (childrenIds) {
53761
53772
  const currGroup = val.item;
53762
- const currMbr = currGroup.getMbr();
53773
+ const currMbr = currGroup.getWorldMbr();
53763
53774
  const children = childrenIds.map((childId) => this.board.items.getById(childId)).filter((item) => !!item);
53764
53775
  const underGroup = this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).filter((item) => item.parent === "Board" || item.parent === currGroup.getId());
53765
53776
  const uniqueItems = new Set;
@@ -54240,7 +54251,7 @@ class BoardSelection {
54240
54251
  };
54241
54252
  }
54242
54253
  renderItemMbr(context, item, customScale) {
54243
- const mbr = item.getMbr();
54254
+ const mbr = item instanceof BaseItem ? item.getWorldMbr() : item.getMbr();
54244
54255
  mbr.strokeWidth = !customScale ? 1 / context.matrix.scaleX : 1 / customScale;
54245
54256
  const selectionColor = item.transformation.isLocked ? conf.SELECTION_LOCKED_COLOR : conf.SELECTION_COLOR;
54246
54257
  mbr.borderColor = selectionColor;
@@ -54297,7 +54308,7 @@ class BoardSelection {
54297
54308
  path2.setBackgroundColor("none");
54298
54309
  path2.render(context);
54299
54310
  } else {
54300
- const itemRect = item.getMbr();
54311
+ const itemRect = item instanceof BaseItem ? item.getWorldMbr() : item.getMbr();
54301
54312
  itemRect.borderColor = CONTEXT_NODE_HIGHLIGHT_COLOR;
54302
54313
  itemRect.strokeWidth = 2;
54303
54314
  itemRect.render(context);
package/dist/cjs/node.js CHANGED
@@ -24623,7 +24623,7 @@ class BaseItem extends Mbr {
24623
24623
  if (!this.isHoverHighlighted) {
24624
24624
  return;
24625
24625
  }
24626
- const mbr = this.getMbr();
24626
+ const mbr = this.getWorldMbr();
24627
24627
  mbr.strokeWidth = 2 / context.matrix.scaleX;
24628
24628
  mbr.borderColor = BaseItem.HOVER_HIGHLIGHT_COLOR;
24629
24629
  mbr.render(context);
@@ -24683,6 +24683,8 @@ class RichText extends BaseItem {
24683
24683
  _onLimitReached = () => {};
24684
24684
  shrinkWidth = false;
24685
24685
  prevMbr = null;
24686
+ customTransformationMatrix;
24687
+ renderingScale;
24686
24688
  rtCounter = 0;
24687
24689
  constructor(board, container, id = "", transformation = new Transformation(id, board.events), linkTo, placeholderText = conf.i18n?.t("board.textPlaceholder"), isInShape = false, autoSize = false, insideOf, initialTextStyles = conf.DEFAULT_TEXT_STYLES) {
24688
24690
  super(board, id);
@@ -24976,11 +24978,8 @@ class RichText extends BaseItem {
24976
24978
  return this.shrinkWidth;
24977
24979
  }
24978
24980
  getTransformedContainer() {
24979
- if (this.insideOf === "Frame") {
24980
- const { translateX, translateY, scaleX } = this.transformation.getMatrixData();
24981
- const scaleY = this.getMbr().getHeight() * 2 / 10;
24982
- const matrix = new Matrix(translateX, translateY, scaleX, scaleY);
24983
- return this.container.getTransformed(matrix);
24981
+ if (this.customTransformationMatrix) {
24982
+ return this.container.getTransformed(this.customTransformationMatrix());
24984
24983
  }
24985
24984
  return this.container.getTransformed(this.transformation.toMatrix());
24986
24985
  }
@@ -25351,7 +25350,9 @@ class RichText extends BaseItem {
25351
25350
  ctx.clip(this.clipPath.nativePath);
25352
25351
  }
25353
25352
  const autoSizeScale = this.autoSize ? this.autoSizeScale : undefined;
25354
- this.layoutNodes.render(ctx, autoSizeScale);
25353
+ const cameraScale = context.getCameraScale();
25354
+ const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
25355
+ this.layoutNodes.render(ctx, autoSizeScale ? autoSizeScale * extraScale : extraScale);
25355
25356
  ctx.restore();
25356
25357
  if (this.getLinkTo() && (this.insideOf === "RichText" || !this.insideOf)) {
25357
25358
  const { top, right } = this.getMbr();
@@ -25477,7 +25478,9 @@ class RichText extends BaseItem {
25477
25478
  };
25478
25479
  const elements = this.editor.editor.children.map(renderNode);
25479
25480
  const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
25480
- const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
25481
+ const cameraScale = this.board.camera.getScale();
25482
+ const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
25483
+ const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX * extraScale}, ${scaleY * extraScale})`;
25481
25484
  const transformedWidth = this.getTransformedContainer().getWidth();
25482
25485
  const transformedHeight = this.getTransformedContainer().getHeight();
25483
25486
  const div = documentFactory.createElement("rich-text");
@@ -43406,11 +43409,11 @@ function convertBlobToDataUrl(blob) {
43406
43409
  }
43407
43410
 
43408
43411
  // src/Items/Frame/FrameData.ts
43409
- var FRAME_BORDER_COLOR = "rgba(10, 15, 41, 0.08)";
43412
+ var FRAME_BORDER_COLOR = semanticColor("contrastGray");
43410
43413
  var FRAME_HIGHLIGHTER_BORDER_COLOR = "#93AFF6";
43411
43414
  var FRAME_CHILDREN_HIGHLIGHTER_COLOR = "rgb(10, 15, 41, .08)";
43412
43415
  var FRAME_CHILDREN_HIGHLIGHTER_BORDER_COLOR = "#4778F5";
43413
- var FRAME_TITLE_COLOR = "rgb(107, 110, 120)";
43416
+ var FRAME_TITLE_COLOR = semanticColor("contrastNeutral");
43414
43417
  var FRAME_TYPES = [
43415
43418
  { id: "Custom", label: "Custom" },
43416
43419
  { id: "Frame16x9", label: "16:9" },
@@ -43455,7 +43458,7 @@ class DefaultFrameData {
43455
43458
  canChangeRatio;
43456
43459
  linkTo;
43457
43460
  itemType = "Frame";
43458
- constructor(shapeType = "Custom", backgroundColor = fixedColor(FRAME_FILL_COLOR), backgroundOpacity = 1, borderColor = fixedColor(FRAME_BORDER_COLOR), borderOpacity = 0.08, borderStyle = "solid", borderWidth = 0.2, transformation = new DefaultTransformationData, children = [], text5 = new DefaultRichTextData([], "top", 600), canChangeRatio = true, linkTo) {
43461
+ constructor(shapeType = "Custom", backgroundColor = semanticColor("contrastNeutral"), backgroundOpacity = 1, borderColor = FRAME_BORDER_COLOR, borderOpacity = 1, borderStyle = "solid", borderWidth = 0.2, transformation = new DefaultTransformationData, children = [], text5 = new DefaultRichTextData([], "top", 600), canChangeRatio = true, linkTo) {
43459
43462
  this.shapeType = shapeType;
43460
43463
  this.backgroundColor = backgroundColor;
43461
43464
  this.backgroundOpacity = backgroundOpacity;
@@ -43515,6 +43518,14 @@ class Frame2 extends BaseItem {
43515
43518
  this.linkTo = new LinkTo(this.id, board.events);
43516
43519
  this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, this.name, true, false, "Frame", { ...conf.DEFAULT_TEXT_STYLES, fontColor: FRAME_TITLE_COLOR });
43517
43520
  this.text.setSelectionHorisontalAlignment("left");
43521
+ this.text.customTransformationMatrix = () => {
43522
+ const { translateX, translateY, scaleX } = this.transformation.getMatrixData();
43523
+ const scaleY = this.getMbr().getHeight() * 2 / 10;
43524
+ return new Matrix(translateX, translateY, scaleX, scaleY);
43525
+ };
43526
+ this.text.renderingScale = (cameraScale) => {
43527
+ return Math.max(1, Math.min(5, 1 / cameraScale));
43528
+ };
43518
43529
  this.transformation.subject.subscribe(() => {
43519
43530
  this.transformPath();
43520
43531
  this.updateMbr();
@@ -56198,9 +56209,9 @@ class BoardSelection {
56198
56209
  }
56199
56210
  const selectedMbr = selected.reduce((acc, item) => {
56200
56211
  if (!acc) {
56201
- return item.getMbr();
56212
+ return item instanceof BaseItem ? item.getWorldMbr() : item.getMbr();
56202
56213
  }
56203
- return acc.combine(item.getMbr());
56214
+ return acc.combine(item instanceof BaseItem ? item.getWorldMbr() : item.getMbr());
56204
56215
  }, undefined);
56205
56216
  if (selectedMbr) {
56206
56217
  const selectedMap = Object.fromEntries(selected.map((item) => [item.getId(), { item, nested: false }]));
@@ -56232,7 +56243,7 @@ class BoardSelection {
56232
56243
  const childrenIds = val.item.getChildrenIds();
56233
56244
  if (childrenIds) {
56234
56245
  const currGroup = val.item;
56235
- const currMbr = currGroup.getMbr();
56246
+ const currMbr = currGroup.getWorldMbr();
56236
56247
  const children = childrenIds.map((childId) => this.board.items.getById(childId)).filter((item) => !!item);
56237
56248
  const underGroup = this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).filter((item) => item.parent === "Board" || item.parent === currGroup.getId());
56238
56249
  const uniqueItems = new Set;
@@ -56713,7 +56724,7 @@ class BoardSelection {
56713
56724
  };
56714
56725
  }
56715
56726
  renderItemMbr(context, item, customScale) {
56716
- const mbr = item.getMbr();
56727
+ const mbr = item instanceof BaseItem ? item.getWorldMbr() : item.getMbr();
56717
56728
  mbr.strokeWidth = !customScale ? 1 / context.matrix.scaleX : 1 / customScale;
56718
56729
  const selectionColor = item.transformation.isLocked ? conf.SELECTION_LOCKED_COLOR : conf.SELECTION_COLOR;
56719
56730
  mbr.borderColor = selectionColor;
@@ -56770,7 +56781,7 @@ class BoardSelection {
56770
56781
  path2.setBackgroundColor("none");
56771
56782
  path2.render(context);
56772
56783
  } else {
56773
- const itemRect = item.getMbr();
56784
+ const itemRect = item instanceof BaseItem ? item.getWorldMbr() : item.getMbr();
56774
56785
  itemRect.borderColor = CONTEXT_NODE_HIGHLIGHT_COLOR;
56775
56786
  itemRect.strokeWidth = 2;
56776
56787
  itemRect.render(context);
@@ -21980,7 +21980,7 @@ class BaseItem extends Mbr {
21980
21980
  if (!this.isHoverHighlighted) {
21981
21981
  return;
21982
21982
  }
21983
- const mbr = this.getMbr();
21983
+ const mbr = this.getWorldMbr();
21984
21984
  mbr.strokeWidth = 2 / context.matrix.scaleX;
21985
21985
  mbr.borderColor = BaseItem.HOVER_HIGHLIGHT_COLOR;
21986
21986
  mbr.render(context);
@@ -22040,6 +22040,8 @@ class RichText extends BaseItem {
22040
22040
  _onLimitReached = () => {};
22041
22041
  shrinkWidth = false;
22042
22042
  prevMbr = null;
22043
+ customTransformationMatrix;
22044
+ renderingScale;
22043
22045
  rtCounter = 0;
22044
22046
  constructor(board, container, id = "", transformation = new Transformation(id, board.events), linkTo, placeholderText = conf.i18n?.t("board.textPlaceholder"), isInShape = false, autoSize = false, insideOf, initialTextStyles = conf.DEFAULT_TEXT_STYLES) {
22045
22047
  super(board, id);
@@ -22333,11 +22335,8 @@ class RichText extends BaseItem {
22333
22335
  return this.shrinkWidth;
22334
22336
  }
22335
22337
  getTransformedContainer() {
22336
- if (this.insideOf === "Frame") {
22337
- const { translateX, translateY, scaleX } = this.transformation.getMatrixData();
22338
- const scaleY = this.getMbr().getHeight() * 2 / 10;
22339
- const matrix = new Matrix(translateX, translateY, scaleX, scaleY);
22340
- return this.container.getTransformed(matrix);
22338
+ if (this.customTransformationMatrix) {
22339
+ return this.container.getTransformed(this.customTransformationMatrix());
22341
22340
  }
22342
22341
  return this.container.getTransformed(this.transformation.toMatrix());
22343
22342
  }
@@ -22708,7 +22707,9 @@ class RichText extends BaseItem {
22708
22707
  ctx.clip(this.clipPath.nativePath);
22709
22708
  }
22710
22709
  const autoSizeScale = this.autoSize ? this.autoSizeScale : undefined;
22711
- this.layoutNodes.render(ctx, autoSizeScale);
22710
+ const cameraScale = context.getCameraScale();
22711
+ const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
22712
+ this.layoutNodes.render(ctx, autoSizeScale ? autoSizeScale * extraScale : extraScale);
22712
22713
  ctx.restore();
22713
22714
  if (this.getLinkTo() && (this.insideOf === "RichText" || !this.insideOf)) {
22714
22715
  const { top, right } = this.getMbr();
@@ -22834,7 +22835,9 @@ class RichText extends BaseItem {
22834
22835
  };
22835
22836
  const elements = this.editor.editor.children.map(renderNode);
22836
22837
  const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
22837
- const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
22838
+ const cameraScale = this.board.camera.getScale();
22839
+ const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
22840
+ const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX * extraScale}, ${scaleY * extraScale})`;
22838
22841
  const transformedWidth = this.getTransformedContainer().getWidth();
22839
22842
  const transformedHeight = this.getTransformedContainer().getHeight();
22840
22843
  const div = documentFactory.createElement("rich-text");
@@ -40762,11 +40765,11 @@ function convertBlobToDataUrl(blob) {
40762
40765
  }
40763
40766
 
40764
40767
  // src/Items/Frame/FrameData.ts
40765
- var FRAME_BORDER_COLOR = "rgba(10, 15, 41, 0.08)";
40768
+ var FRAME_BORDER_COLOR = semanticColor("contrastGray");
40766
40769
  var FRAME_HIGHLIGHTER_BORDER_COLOR = "#93AFF6";
40767
40770
  var FRAME_CHILDREN_HIGHLIGHTER_COLOR = "rgb(10, 15, 41, .08)";
40768
40771
  var FRAME_CHILDREN_HIGHLIGHTER_BORDER_COLOR = "#4778F5";
40769
- var FRAME_TITLE_COLOR = "rgb(107, 110, 120)";
40772
+ var FRAME_TITLE_COLOR = semanticColor("contrastNeutral");
40770
40773
  var FRAME_TYPES = [
40771
40774
  { id: "Custom", label: "Custom" },
40772
40775
  { id: "Frame16x9", label: "16:9" },
@@ -40811,7 +40814,7 @@ class DefaultFrameData {
40811
40814
  canChangeRatio;
40812
40815
  linkTo;
40813
40816
  itemType = "Frame";
40814
- constructor(shapeType = "Custom", backgroundColor = fixedColor(FRAME_FILL_COLOR), backgroundOpacity = 1, borderColor = fixedColor(FRAME_BORDER_COLOR), borderOpacity = 0.08, borderStyle = "solid", borderWidth = 0.2, transformation = new DefaultTransformationData, children = [], text5 = new DefaultRichTextData([], "top", 600), canChangeRatio = true, linkTo) {
40817
+ constructor(shapeType = "Custom", backgroundColor = semanticColor("contrastNeutral"), backgroundOpacity = 1, borderColor = FRAME_BORDER_COLOR, borderOpacity = 1, borderStyle = "solid", borderWidth = 0.2, transformation = new DefaultTransformationData, children = [], text5 = new DefaultRichTextData([], "top", 600), canChangeRatio = true, linkTo) {
40815
40818
  this.shapeType = shapeType;
40816
40819
  this.backgroundColor = backgroundColor;
40817
40820
  this.backgroundOpacity = backgroundOpacity;
@@ -40871,6 +40874,14 @@ class Frame2 extends BaseItem {
40871
40874
  this.linkTo = new LinkTo(this.id, board.events);
40872
40875
  this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, this.name, true, false, "Frame", { ...conf.DEFAULT_TEXT_STYLES, fontColor: FRAME_TITLE_COLOR });
40873
40876
  this.text.setSelectionHorisontalAlignment("left");
40877
+ this.text.customTransformationMatrix = () => {
40878
+ const { translateX, translateY, scaleX } = this.transformation.getMatrixData();
40879
+ const scaleY = this.getMbr().getHeight() * 2 / 10;
40880
+ return new Matrix(translateX, translateY, scaleX, scaleY);
40881
+ };
40882
+ this.text.renderingScale = (cameraScale) => {
40883
+ return Math.max(1, Math.min(5, 1 / cameraScale));
40884
+ };
40874
40885
  this.transformation.subject.subscribe(() => {
40875
40886
  this.transformPath();
40876
40887
  this.updateMbr();
@@ -53554,9 +53565,9 @@ class BoardSelection {
53554
53565
  }
53555
53566
  const selectedMbr = selected.reduce((acc, item) => {
53556
53567
  if (!acc) {
53557
- return item.getMbr();
53568
+ return item instanceof BaseItem ? item.getWorldMbr() : item.getMbr();
53558
53569
  }
53559
- return acc.combine(item.getMbr());
53570
+ return acc.combine(item instanceof BaseItem ? item.getWorldMbr() : item.getMbr());
53560
53571
  }, undefined);
53561
53572
  if (selectedMbr) {
53562
53573
  const selectedMap = Object.fromEntries(selected.map((item) => [item.getId(), { item, nested: false }]));
@@ -53588,7 +53599,7 @@ class BoardSelection {
53588
53599
  const childrenIds = val.item.getChildrenIds();
53589
53600
  if (childrenIds) {
53590
53601
  const currGroup = val.item;
53591
- const currMbr = currGroup.getMbr();
53602
+ const currMbr = currGroup.getWorldMbr();
53592
53603
  const children = childrenIds.map((childId) => this.board.items.getById(childId)).filter((item) => !!item);
53593
53604
  const underGroup = this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).filter((item) => item.parent === "Board" || item.parent === currGroup.getId());
53594
53605
  const uniqueItems = new Set;
@@ -54069,7 +54080,7 @@ class BoardSelection {
54069
54080
  };
54070
54081
  }
54071
54082
  renderItemMbr(context, item, customScale) {
54072
- const mbr = item.getMbr();
54083
+ const mbr = item instanceof BaseItem ? item.getWorldMbr() : item.getMbr();
54073
54084
  mbr.strokeWidth = !customScale ? 1 / context.matrix.scaleX : 1 / customScale;
54074
54085
  const selectionColor = item.transformation.isLocked ? conf.SELECTION_LOCKED_COLOR : conf.SELECTION_COLOR;
54075
54086
  mbr.borderColor = selectionColor;
@@ -54126,7 +54137,7 @@ class BoardSelection {
54126
54137
  path2.setBackgroundColor("none");
54127
54138
  path2.render(context);
54128
54139
  } else {
54129
- const itemRect = item.getMbr();
54140
+ const itemRect = item instanceof BaseItem ? item.getWorldMbr() : item.getMbr();
54130
54141
  itemRect.borderColor = CONTEXT_NODE_HIGHLIGHT_COLOR;
54131
54142
  itemRect.strokeWidth = 2;
54132
54143
  itemRect.render(context);
package/dist/esm/index.js CHANGED
@@ -21973,7 +21973,7 @@ class BaseItem extends Mbr {
21973
21973
  if (!this.isHoverHighlighted) {
21974
21974
  return;
21975
21975
  }
21976
- const mbr = this.getMbr();
21976
+ const mbr = this.getWorldMbr();
21977
21977
  mbr.strokeWidth = 2 / context.matrix.scaleX;
21978
21978
  mbr.borderColor = BaseItem.HOVER_HIGHLIGHT_COLOR;
21979
21979
  mbr.render(context);
@@ -22033,6 +22033,8 @@ class RichText extends BaseItem {
22033
22033
  _onLimitReached = () => {};
22034
22034
  shrinkWidth = false;
22035
22035
  prevMbr = null;
22036
+ customTransformationMatrix;
22037
+ renderingScale;
22036
22038
  rtCounter = 0;
22037
22039
  constructor(board, container, id = "", transformation = new Transformation(id, board.events), linkTo, placeholderText = conf.i18n?.t("board.textPlaceholder"), isInShape = false, autoSize = false, insideOf, initialTextStyles = conf.DEFAULT_TEXT_STYLES) {
22038
22040
  super(board, id);
@@ -22326,11 +22328,8 @@ class RichText extends BaseItem {
22326
22328
  return this.shrinkWidth;
22327
22329
  }
22328
22330
  getTransformedContainer() {
22329
- if (this.insideOf === "Frame") {
22330
- const { translateX, translateY, scaleX } = this.transformation.getMatrixData();
22331
- const scaleY = this.getMbr().getHeight() * 2 / 10;
22332
- const matrix = new Matrix(translateX, translateY, scaleX, scaleY);
22333
- return this.container.getTransformed(matrix);
22331
+ if (this.customTransformationMatrix) {
22332
+ return this.container.getTransformed(this.customTransformationMatrix());
22334
22333
  }
22335
22334
  return this.container.getTransformed(this.transformation.toMatrix());
22336
22335
  }
@@ -22701,7 +22700,9 @@ class RichText extends BaseItem {
22701
22700
  ctx.clip(this.clipPath.nativePath);
22702
22701
  }
22703
22702
  const autoSizeScale = this.autoSize ? this.autoSizeScale : undefined;
22704
- this.layoutNodes.render(ctx, autoSizeScale);
22703
+ const cameraScale = context.getCameraScale();
22704
+ const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
22705
+ this.layoutNodes.render(ctx, autoSizeScale ? autoSizeScale * extraScale : extraScale);
22705
22706
  ctx.restore();
22706
22707
  if (this.getLinkTo() && (this.insideOf === "RichText" || !this.insideOf)) {
22707
22708
  const { top, right } = this.getMbr();
@@ -22827,7 +22828,9 @@ class RichText extends BaseItem {
22827
22828
  };
22828
22829
  const elements = this.editor.editor.children.map(renderNode);
22829
22830
  const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
22830
- const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
22831
+ const cameraScale = this.board.camera.getScale();
22832
+ const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
22833
+ const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX * extraScale}, ${scaleY * extraScale})`;
22831
22834
  const transformedWidth = this.getTransformedContainer().getWidth();
22832
22835
  const transformedHeight = this.getTransformedContainer().getHeight();
22833
22836
  const div = documentFactory.createElement("rich-text");
@@ -40755,11 +40758,11 @@ function convertBlobToDataUrl(blob) {
40755
40758
  }
40756
40759
 
40757
40760
  // src/Items/Frame/FrameData.ts
40758
- var FRAME_BORDER_COLOR = "rgba(10, 15, 41, 0.08)";
40761
+ var FRAME_BORDER_COLOR = semanticColor("contrastGray");
40759
40762
  var FRAME_HIGHLIGHTER_BORDER_COLOR = "#93AFF6";
40760
40763
  var FRAME_CHILDREN_HIGHLIGHTER_COLOR = "rgb(10, 15, 41, .08)";
40761
40764
  var FRAME_CHILDREN_HIGHLIGHTER_BORDER_COLOR = "#4778F5";
40762
- var FRAME_TITLE_COLOR = "rgb(107, 110, 120)";
40765
+ var FRAME_TITLE_COLOR = semanticColor("contrastNeutral");
40763
40766
  var FRAME_TYPES = [
40764
40767
  { id: "Custom", label: "Custom" },
40765
40768
  { id: "Frame16x9", label: "16:9" },
@@ -40804,7 +40807,7 @@ class DefaultFrameData {
40804
40807
  canChangeRatio;
40805
40808
  linkTo;
40806
40809
  itemType = "Frame";
40807
- constructor(shapeType = "Custom", backgroundColor = fixedColor(FRAME_FILL_COLOR), backgroundOpacity = 1, borderColor = fixedColor(FRAME_BORDER_COLOR), borderOpacity = 0.08, borderStyle = "solid", borderWidth = 0.2, transformation = new DefaultTransformationData, children = [], text5 = new DefaultRichTextData([], "top", 600), canChangeRatio = true, linkTo) {
40810
+ constructor(shapeType = "Custom", backgroundColor = semanticColor("contrastNeutral"), backgroundOpacity = 1, borderColor = FRAME_BORDER_COLOR, borderOpacity = 1, borderStyle = "solid", borderWidth = 0.2, transformation = new DefaultTransformationData, children = [], text5 = new DefaultRichTextData([], "top", 600), canChangeRatio = true, linkTo) {
40808
40811
  this.shapeType = shapeType;
40809
40812
  this.backgroundColor = backgroundColor;
40810
40813
  this.backgroundOpacity = backgroundOpacity;
@@ -40864,6 +40867,14 @@ class Frame2 extends BaseItem {
40864
40867
  this.linkTo = new LinkTo(this.id, board.events);
40865
40868
  this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, this.name, true, false, "Frame", { ...conf.DEFAULT_TEXT_STYLES, fontColor: FRAME_TITLE_COLOR });
40866
40869
  this.text.setSelectionHorisontalAlignment("left");
40870
+ this.text.customTransformationMatrix = () => {
40871
+ const { translateX, translateY, scaleX } = this.transformation.getMatrixData();
40872
+ const scaleY = this.getMbr().getHeight() * 2 / 10;
40873
+ return new Matrix(translateX, translateY, scaleX, scaleY);
40874
+ };
40875
+ this.text.renderingScale = (cameraScale) => {
40876
+ return Math.max(1, Math.min(5, 1 / cameraScale));
40877
+ };
40867
40878
  this.transformation.subject.subscribe(() => {
40868
40879
  this.transformPath();
40869
40880
  this.updateMbr();
@@ -53547,9 +53558,9 @@ class BoardSelection {
53547
53558
  }
53548
53559
  const selectedMbr = selected.reduce((acc, item) => {
53549
53560
  if (!acc) {
53550
- return item.getMbr();
53561
+ return item instanceof BaseItem ? item.getWorldMbr() : item.getMbr();
53551
53562
  }
53552
- return acc.combine(item.getMbr());
53563
+ return acc.combine(item instanceof BaseItem ? item.getWorldMbr() : item.getMbr());
53553
53564
  }, undefined);
53554
53565
  if (selectedMbr) {
53555
53566
  const selectedMap = Object.fromEntries(selected.map((item) => [item.getId(), { item, nested: false }]));
@@ -53581,7 +53592,7 @@ class BoardSelection {
53581
53592
  const childrenIds = val.item.getChildrenIds();
53582
53593
  if (childrenIds) {
53583
53594
  const currGroup = val.item;
53584
- const currMbr = currGroup.getMbr();
53595
+ const currMbr = currGroup.getWorldMbr();
53585
53596
  const children = childrenIds.map((childId) => this.board.items.getById(childId)).filter((item) => !!item);
53586
53597
  const underGroup = this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).filter((item) => item.parent === "Board" || item.parent === currGroup.getId());
53587
53598
  const uniqueItems = new Set;
@@ -54062,7 +54073,7 @@ class BoardSelection {
54062
54073
  };
54063
54074
  }
54064
54075
  renderItemMbr(context, item, customScale) {
54065
- const mbr = item.getMbr();
54076
+ const mbr = item instanceof BaseItem ? item.getWorldMbr() : item.getMbr();
54066
54077
  mbr.strokeWidth = !customScale ? 1 / context.matrix.scaleX : 1 / customScale;
54067
54078
  const selectionColor = item.transformation.isLocked ? conf.SELECTION_LOCKED_COLOR : conf.SELECTION_COLOR;
54068
54079
  mbr.borderColor = selectionColor;
@@ -54119,7 +54130,7 @@ class BoardSelection {
54119
54130
  path2.setBackgroundColor("none");
54120
54131
  path2.render(context);
54121
54132
  } else {
54122
- const itemRect = item.getMbr();
54133
+ const itemRect = item instanceof BaseItem ? item.getWorldMbr() : item.getMbr();
54123
54134
  itemRect.borderColor = CONTEXT_NODE_HIGHLIGHT_COLOR;
54124
54135
  itemRect.strokeWidth = 2;
54125
54136
  itemRect.render(context);
package/dist/esm/node.js CHANGED
@@ -24440,7 +24440,7 @@ class BaseItem extends Mbr {
24440
24440
  if (!this.isHoverHighlighted) {
24441
24441
  return;
24442
24442
  }
24443
- const mbr = this.getMbr();
24443
+ const mbr = this.getWorldMbr();
24444
24444
  mbr.strokeWidth = 2 / context.matrix.scaleX;
24445
24445
  mbr.borderColor = BaseItem.HOVER_HIGHLIGHT_COLOR;
24446
24446
  mbr.render(context);
@@ -24500,6 +24500,8 @@ class RichText extends BaseItem {
24500
24500
  _onLimitReached = () => {};
24501
24501
  shrinkWidth = false;
24502
24502
  prevMbr = null;
24503
+ customTransformationMatrix;
24504
+ renderingScale;
24503
24505
  rtCounter = 0;
24504
24506
  constructor(board, container, id = "", transformation = new Transformation(id, board.events), linkTo, placeholderText = conf.i18n?.t("board.textPlaceholder"), isInShape = false, autoSize = false, insideOf, initialTextStyles = conf.DEFAULT_TEXT_STYLES) {
24505
24507
  super(board, id);
@@ -24793,11 +24795,8 @@ class RichText extends BaseItem {
24793
24795
  return this.shrinkWidth;
24794
24796
  }
24795
24797
  getTransformedContainer() {
24796
- if (this.insideOf === "Frame") {
24797
- const { translateX, translateY, scaleX } = this.transformation.getMatrixData();
24798
- const scaleY = this.getMbr().getHeight() * 2 / 10;
24799
- const matrix = new Matrix(translateX, translateY, scaleX, scaleY);
24800
- return this.container.getTransformed(matrix);
24798
+ if (this.customTransformationMatrix) {
24799
+ return this.container.getTransformed(this.customTransformationMatrix());
24801
24800
  }
24802
24801
  return this.container.getTransformed(this.transformation.toMatrix());
24803
24802
  }
@@ -25168,7 +25167,9 @@ class RichText extends BaseItem {
25168
25167
  ctx.clip(this.clipPath.nativePath);
25169
25168
  }
25170
25169
  const autoSizeScale = this.autoSize ? this.autoSizeScale : undefined;
25171
- this.layoutNodes.render(ctx, autoSizeScale);
25170
+ const cameraScale = context.getCameraScale();
25171
+ const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
25172
+ this.layoutNodes.render(ctx, autoSizeScale ? autoSizeScale * extraScale : extraScale);
25172
25173
  ctx.restore();
25173
25174
  if (this.getLinkTo() && (this.insideOf === "RichText" || !this.insideOf)) {
25174
25175
  const { top, right } = this.getMbr();
@@ -25294,7 +25295,9 @@ class RichText extends BaseItem {
25294
25295
  };
25295
25296
  const elements = this.editor.editor.children.map(renderNode);
25296
25297
  const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
25297
- const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
25298
+ const cameraScale = this.board.camera.getScale();
25299
+ const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
25300
+ const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX * extraScale}, ${scaleY * extraScale})`;
25298
25301
  const transformedWidth = this.getTransformedContainer().getWidth();
25299
25302
  const transformedHeight = this.getTransformedContainer().getHeight();
25300
25303
  const div = documentFactory.createElement("rich-text");
@@ -43223,11 +43226,11 @@ function convertBlobToDataUrl(blob) {
43223
43226
  }
43224
43227
 
43225
43228
  // src/Items/Frame/FrameData.ts
43226
- var FRAME_BORDER_COLOR = "rgba(10, 15, 41, 0.08)";
43229
+ var FRAME_BORDER_COLOR = semanticColor("contrastGray");
43227
43230
  var FRAME_HIGHLIGHTER_BORDER_COLOR = "#93AFF6";
43228
43231
  var FRAME_CHILDREN_HIGHLIGHTER_COLOR = "rgb(10, 15, 41, .08)";
43229
43232
  var FRAME_CHILDREN_HIGHLIGHTER_BORDER_COLOR = "#4778F5";
43230
- var FRAME_TITLE_COLOR = "rgb(107, 110, 120)";
43233
+ var FRAME_TITLE_COLOR = semanticColor("contrastNeutral");
43231
43234
  var FRAME_TYPES = [
43232
43235
  { id: "Custom", label: "Custom" },
43233
43236
  { id: "Frame16x9", label: "16:9" },
@@ -43272,7 +43275,7 @@ class DefaultFrameData {
43272
43275
  canChangeRatio;
43273
43276
  linkTo;
43274
43277
  itemType = "Frame";
43275
- constructor(shapeType = "Custom", backgroundColor = fixedColor(FRAME_FILL_COLOR), backgroundOpacity = 1, borderColor = fixedColor(FRAME_BORDER_COLOR), borderOpacity = 0.08, borderStyle = "solid", borderWidth = 0.2, transformation = new DefaultTransformationData, children = [], text5 = new DefaultRichTextData([], "top", 600), canChangeRatio = true, linkTo) {
43278
+ constructor(shapeType = "Custom", backgroundColor = semanticColor("contrastNeutral"), backgroundOpacity = 1, borderColor = FRAME_BORDER_COLOR, borderOpacity = 1, borderStyle = "solid", borderWidth = 0.2, transformation = new DefaultTransformationData, children = [], text5 = new DefaultRichTextData([], "top", 600), canChangeRatio = true, linkTo) {
43276
43279
  this.shapeType = shapeType;
43277
43280
  this.backgroundColor = backgroundColor;
43278
43281
  this.backgroundOpacity = backgroundOpacity;
@@ -43332,6 +43335,14 @@ class Frame2 extends BaseItem {
43332
43335
  this.linkTo = new LinkTo(this.id, board.events);
43333
43336
  this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, this.name, true, false, "Frame", { ...conf.DEFAULT_TEXT_STYLES, fontColor: FRAME_TITLE_COLOR });
43334
43337
  this.text.setSelectionHorisontalAlignment("left");
43338
+ this.text.customTransformationMatrix = () => {
43339
+ const { translateX, translateY, scaleX } = this.transformation.getMatrixData();
43340
+ const scaleY = this.getMbr().getHeight() * 2 / 10;
43341
+ return new Matrix(translateX, translateY, scaleX, scaleY);
43342
+ };
43343
+ this.text.renderingScale = (cameraScale) => {
43344
+ return Math.max(1, Math.min(5, 1 / cameraScale));
43345
+ };
43335
43346
  this.transformation.subject.subscribe(() => {
43336
43347
  this.transformPath();
43337
43348
  this.updateMbr();
@@ -56015,9 +56026,9 @@ class BoardSelection {
56015
56026
  }
56016
56027
  const selectedMbr = selected.reduce((acc, item) => {
56017
56028
  if (!acc) {
56018
- return item.getMbr();
56029
+ return item instanceof BaseItem ? item.getWorldMbr() : item.getMbr();
56019
56030
  }
56020
- return acc.combine(item.getMbr());
56031
+ return acc.combine(item instanceof BaseItem ? item.getWorldMbr() : item.getMbr());
56021
56032
  }, undefined);
56022
56033
  if (selectedMbr) {
56023
56034
  const selectedMap = Object.fromEntries(selected.map((item) => [item.getId(), { item, nested: false }]));
@@ -56049,7 +56060,7 @@ class BoardSelection {
56049
56060
  const childrenIds = val.item.getChildrenIds();
56050
56061
  if (childrenIds) {
56051
56062
  const currGroup = val.item;
56052
- const currMbr = currGroup.getMbr();
56063
+ const currMbr = currGroup.getWorldMbr();
56053
56064
  const children = childrenIds.map((childId) => this.board.items.getById(childId)).filter((item) => !!item);
56054
56065
  const underGroup = this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).filter((item) => item.parent === "Board" || item.parent === currGroup.getId());
56055
56066
  const uniqueItems = new Set;
@@ -56530,7 +56541,7 @@ class BoardSelection {
56530
56541
  };
56531
56542
  }
56532
56543
  renderItemMbr(context, item, customScale) {
56533
- const mbr = item.getMbr();
56544
+ const mbr = item instanceof BaseItem ? item.getWorldMbr() : item.getMbr();
56534
56545
  mbr.strokeWidth = !customScale ? 1 / context.matrix.scaleX : 1 / customScale;
56535
56546
  const selectionColor = item.transformation.isLocked ? conf.SELECTION_LOCKED_COLOR : conf.SELECTION_COLOR;
56536
56547
  mbr.borderColor = selectionColor;
@@ -56587,7 +56598,7 @@ class BoardSelection {
56587
56598
  path2.setBackgroundColor("none");
56588
56599
  path2.render(context);
56589
56600
  } else {
56590
- const itemRect = item.getMbr();
56601
+ const itemRect = item instanceof BaseItem ? item.getWorldMbr() : item.getMbr();
56591
56602
  itemRect.borderColor = CONTEXT_NODE_HIGHLIGHT_COLOR;
56592
56603
  itemRect.strokeWidth = 2;
56593
56604
  itemRect.render(context);
@@ -3,11 +3,11 @@ import { RichTextData } from '../RichText';
3
3
  import { BorderStyle, BorderWidth } from '../Path';
4
4
  import { FrameType } from './Basic';
5
5
  import { ColorValue } from '../../..';
6
- export declare const FRAME_BORDER_COLOR = "rgba(10, 15, 41, 0.08)";
6
+ export declare const FRAME_BORDER_COLOR: import("../../..").SemanticColor;
7
7
  export declare const FRAME_HIGHLIGHTER_BORDER_COLOR = "#93AFF6";
8
8
  export declare const FRAME_CHILDREN_HIGHLIGHTER_COLOR = "rgb(10, 15, 41, .08)";
9
9
  export declare const FRAME_CHILDREN_HIGHLIGHTER_BORDER_COLOR = "#4778F5";
10
- export declare const FRAME_TITLE_COLOR = "rgb(107, 110, 120)";
10
+ export declare const FRAME_TITLE_COLOR: import("../../..").SemanticColor;
11
11
  export declare const FRAME_TYPES: readonly [{
12
12
  readonly id: "Custom";
13
13
  readonly label: "Custom";
@@ -6,7 +6,7 @@ import { SelectionContext } from "../../Selection";
6
6
  import { DefaultTextStyles } from "../../Settings";
7
7
  import { Subject } from "../../Subject";
8
8
  import { BaseRange, BaseSelection, Descendant, Operation as SlateOp } from "slate";
9
- import { ItemType, Mbr, Point, RichTextData, Transformation } from "..";
9
+ import { ItemType, Matrix, Mbr, Point, RichTextData, Transformation } from "..";
10
10
  import { HorisontalAlignment, VerticalAlignment } from "../Alignment";
11
11
  import { DrawingContext } from "../DrawingContext";
12
12
  import { LinkTo } from "../LinkTo/LinkTo";
@@ -52,6 +52,8 @@ export declare class RichText extends BaseItem {
52
52
  private _onLimitReached;
53
53
  private shrinkWidth;
54
54
  prevMbr: Mbr | null;
55
+ customTransformationMatrix?: () => Matrix;
56
+ renderingScale?: (cameraScale: number) => number;
55
57
  rtCounter: number;
56
58
  constructor(board: Board, container: Mbr, id?: string, transformation?: Transformation, linkTo?: LinkTo, placeholderText?: string, isInShape?: boolean, autoSize?: boolean, insideOf?: ItemType | undefined, initialTextStyles?: DefaultTextStyles);
57
59
  isClosed(): boolean;
@@ -1,5 +1,6 @@
1
+ import type { ColorValue } from '../../../../Color/index.js';
1
2
  import { HorisontalAlignment } from '../../../Alignment.js';
2
3
  import { BlockNode } from '../../Editor/BlockNode.js';
3
4
  import { TextNode, TextStyle } from '../../Editor/TextNode.js';
4
- export declare function getParagraph(fontStyles: TextStyle[], fontColor: string, fontSize: number, fontFamily: string, defaultHorizontalAlignment: HorisontalAlignment, text: string): BlockNode[];
5
+ export declare function getParagraph(fontStyles: TextStyle[], fontColor: string | ColorValue, fontSize: number, fontFamily: string, defaultHorizontalAlignment: HorisontalAlignment, text: string): BlockNode[];
5
6
  export declare function getParagraphWithPassedTextNode(textNode: TextNode): BlockNode[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.12.8",
3
+ "version": "0.13.0",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",