microboard-temp 0.12.9 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/browser.js +36 -19
- package/dist/cjs/index.js +36 -19
- package/dist/cjs/node.js +36 -19
- package/dist/esm/browser.js +36 -19
- package/dist/esm/index.js +36 -19
- package/dist/esm/node.js +36 -19
- package/dist/types/Items/Frame/FrameData.d.ts +2 -2
- package/dist/types/Items/RichText/RichText.d.ts +5 -2
- package/dist/types/Items/RichText/editorHelpers/common/getParagraph.d.ts +2 -1
- package/package.json +1 -1
package/dist/cjs/browser.js
CHANGED
|
@@ -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,13 +22506,17 @@ class RichText extends BaseItem {
|
|
|
22504
22506
|
return this.shrinkWidth;
|
|
22505
22507
|
}
|
|
22506
22508
|
getTransformedContainer() {
|
|
22507
|
-
|
|
22508
|
-
|
|
22509
|
-
|
|
22510
|
-
|
|
22511
|
-
|
|
22509
|
+
const cameraScale = this.board.camera.getScale();
|
|
22510
|
+
const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
|
|
22511
|
+
let matrix;
|
|
22512
|
+
if (this.customTransformationMatrix) {
|
|
22513
|
+
matrix = this.customTransformationMatrix();
|
|
22514
|
+
} else {
|
|
22515
|
+
matrix = this.transformation.toMatrix();
|
|
22512
22516
|
}
|
|
22513
|
-
|
|
22517
|
+
const { translateX, translateY, scaleX, scaleY } = matrix;
|
|
22518
|
+
const scaledMatrix = new Matrix(translateX, translateY, scaleX * extraScale, scaleY * extraScale);
|
|
22519
|
+
return this.container.getTransformed(scaledMatrix);
|
|
22514
22520
|
}
|
|
22515
22521
|
emitWithoutApplying = (op) => {
|
|
22516
22522
|
if (this.board.events) {
|
|
@@ -22851,7 +22857,9 @@ class RichText extends BaseItem {
|
|
|
22851
22857
|
this.insideOf = data.insideOf;
|
|
22852
22858
|
if (typeof document !== "undefined") {
|
|
22853
22859
|
document.fonts.ready.then(() => {
|
|
22854
|
-
this.
|
|
22860
|
+
this.layoutNodes = getBlockNodes(this.getBlockNodes(), this.shrinkWidth ? Infinity : this.getMaxWidth() || 0, this.shrinkWidth, this.insideOf === "Frame");
|
|
22861
|
+
this.alignInRectangle(this.getTransformedContainer(), this.editor.verticalAlignment);
|
|
22862
|
+
this.transformCanvas();
|
|
22855
22863
|
});
|
|
22856
22864
|
}
|
|
22857
22865
|
this.subject.publish(this);
|
|
@@ -22868,12 +22876,11 @@ class RichText extends BaseItem {
|
|
|
22868
22876
|
}
|
|
22869
22877
|
const { ctx } = context;
|
|
22870
22878
|
ctx.save();
|
|
22879
|
+
const cameraScale = context.getCameraScale();
|
|
22880
|
+
const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
|
|
22871
22881
|
ctx.translate(this.left, this.top);
|
|
22872
|
-
const
|
|
22873
|
-
|
|
22874
|
-
const { scaleX, scaleY } = this.transformation.getMatrixData();
|
|
22875
|
-
ctx.scale(scaleX, scaleY);
|
|
22876
|
-
}
|
|
22882
|
+
const { scaleX, scaleY } = this.transformation.getMatrixData();
|
|
22883
|
+
ctx.scale(scaleX * extraScale, scaleY * extraScale);
|
|
22877
22884
|
const shouldClip = this.insideOf === "Shape" || this.insideOf === "Sticker";
|
|
22878
22885
|
if (shouldClip) {
|
|
22879
22886
|
ctx.clip(this.clipPath.nativePath);
|
|
@@ -23004,10 +23011,12 @@ class RichText extends BaseItem {
|
|
|
23004
23011
|
return unsafe.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
23005
23012
|
};
|
|
23006
23013
|
const elements = this.editor.editor.children.map(renderNode);
|
|
23007
|
-
const
|
|
23008
|
-
const
|
|
23009
|
-
const
|
|
23010
|
-
const
|
|
23014
|
+
const cameraScale = this.board.camera.getScale();
|
|
23015
|
+
const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
|
|
23016
|
+
const { scaleX, scaleY } = this.transformation.getMatrixData();
|
|
23017
|
+
const transform = `translate(${this.left}px, ${this.top}px) scale(${scaleX * extraScale}, ${scaleY * extraScale})`;
|
|
23018
|
+
const transformedWidth = this.getMbr().getWidth();
|
|
23019
|
+
const transformedHeight = this.getMbr().getHeight();
|
|
23011
23020
|
const div = documentFactory.createElement("rich-text");
|
|
23012
23021
|
div.id = this.getId();
|
|
23013
23022
|
div.style.width = `${transformedWidth + 5}px`;
|
|
@@ -40933,11 +40942,11 @@ function convertBlobToDataUrl(blob) {
|
|
|
40933
40942
|
}
|
|
40934
40943
|
|
|
40935
40944
|
// src/Items/Frame/FrameData.ts
|
|
40936
|
-
var FRAME_BORDER_COLOR = "
|
|
40945
|
+
var FRAME_BORDER_COLOR = semanticColor("contrastGray");
|
|
40937
40946
|
var FRAME_HIGHLIGHTER_BORDER_COLOR = "#93AFF6";
|
|
40938
40947
|
var FRAME_CHILDREN_HIGHLIGHTER_COLOR = "rgb(10, 15, 41, .08)";
|
|
40939
40948
|
var FRAME_CHILDREN_HIGHLIGHTER_BORDER_COLOR = "#4778F5";
|
|
40940
|
-
var FRAME_TITLE_COLOR = "
|
|
40949
|
+
var FRAME_TITLE_COLOR = semanticColor("contrastNeutral");
|
|
40941
40950
|
var FRAME_TYPES = [
|
|
40942
40951
|
{ id: "Custom", label: "Custom" },
|
|
40943
40952
|
{ id: "Frame16x9", label: "16:9" },
|
|
@@ -40982,7 +40991,7 @@ class DefaultFrameData {
|
|
|
40982
40991
|
canChangeRatio;
|
|
40983
40992
|
linkTo;
|
|
40984
40993
|
itemType = "Frame";
|
|
40985
|
-
constructor(shapeType = "Custom", backgroundColor =
|
|
40994
|
+
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
40995
|
this.shapeType = shapeType;
|
|
40987
40996
|
this.backgroundColor = backgroundColor;
|
|
40988
40997
|
this.backgroundOpacity = backgroundOpacity;
|
|
@@ -41042,6 +41051,14 @@ class Frame2 extends BaseItem {
|
|
|
41042
41051
|
this.linkTo = new LinkTo(this.id, board.events);
|
|
41043
41052
|
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
41053
|
this.text.setSelectionHorisontalAlignment("left");
|
|
41054
|
+
this.text.customTransformationMatrix = () => {
|
|
41055
|
+
const { translateX, translateY, scaleX } = this.transformation.getMatrixData();
|
|
41056
|
+
const scaleY = this.text.layoutNodes.height * scaleX / 10;
|
|
41057
|
+
return new Matrix(translateX, translateY, scaleX, scaleY);
|
|
41058
|
+
};
|
|
41059
|
+
this.text.renderingScale = (cameraScale) => {
|
|
41060
|
+
return Math.max(1, Math.min(5, 1 / cameraScale));
|
|
41061
|
+
};
|
|
41045
41062
|
this.transformation.subject.subscribe(() => {
|
|
41046
41063
|
this.transformPath();
|
|
41047
41064
|
this.updateMbr();
|
package/dist/cjs/index.js
CHANGED
|
@@ -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,13 +22506,17 @@ class RichText extends BaseItem {
|
|
|
22504
22506
|
return this.shrinkWidth;
|
|
22505
22507
|
}
|
|
22506
22508
|
getTransformedContainer() {
|
|
22507
|
-
|
|
22508
|
-
|
|
22509
|
-
|
|
22510
|
-
|
|
22511
|
-
|
|
22509
|
+
const cameraScale = this.board.camera.getScale();
|
|
22510
|
+
const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
|
|
22511
|
+
let matrix;
|
|
22512
|
+
if (this.customTransformationMatrix) {
|
|
22513
|
+
matrix = this.customTransformationMatrix();
|
|
22514
|
+
} else {
|
|
22515
|
+
matrix = this.transformation.toMatrix();
|
|
22512
22516
|
}
|
|
22513
|
-
|
|
22517
|
+
const { translateX, translateY, scaleX, scaleY } = matrix;
|
|
22518
|
+
const scaledMatrix = new Matrix(translateX, translateY, scaleX * extraScale, scaleY * extraScale);
|
|
22519
|
+
return this.container.getTransformed(scaledMatrix);
|
|
22514
22520
|
}
|
|
22515
22521
|
emitWithoutApplying = (op) => {
|
|
22516
22522
|
if (this.board.events) {
|
|
@@ -22851,7 +22857,9 @@ class RichText extends BaseItem {
|
|
|
22851
22857
|
this.insideOf = data.insideOf;
|
|
22852
22858
|
if (typeof document !== "undefined") {
|
|
22853
22859
|
document.fonts.ready.then(() => {
|
|
22854
|
-
this.
|
|
22860
|
+
this.layoutNodes = getBlockNodes(this.getBlockNodes(), this.shrinkWidth ? Infinity : this.getMaxWidth() || 0, this.shrinkWidth, this.insideOf === "Frame");
|
|
22861
|
+
this.alignInRectangle(this.getTransformedContainer(), this.editor.verticalAlignment);
|
|
22862
|
+
this.transformCanvas();
|
|
22855
22863
|
});
|
|
22856
22864
|
}
|
|
22857
22865
|
this.subject.publish(this);
|
|
@@ -22868,12 +22876,11 @@ class RichText extends BaseItem {
|
|
|
22868
22876
|
}
|
|
22869
22877
|
const { ctx } = context;
|
|
22870
22878
|
ctx.save();
|
|
22879
|
+
const cameraScale = context.getCameraScale();
|
|
22880
|
+
const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
|
|
22871
22881
|
ctx.translate(this.left, this.top);
|
|
22872
|
-
const
|
|
22873
|
-
|
|
22874
|
-
const { scaleX, scaleY } = this.transformation.getMatrixData();
|
|
22875
|
-
ctx.scale(scaleX, scaleY);
|
|
22876
|
-
}
|
|
22882
|
+
const { scaleX, scaleY } = this.transformation.getMatrixData();
|
|
22883
|
+
ctx.scale(scaleX * extraScale, scaleY * extraScale);
|
|
22877
22884
|
const shouldClip = this.insideOf === "Shape" || this.insideOf === "Sticker";
|
|
22878
22885
|
if (shouldClip) {
|
|
22879
22886
|
ctx.clip(this.clipPath.nativePath);
|
|
@@ -23004,10 +23011,12 @@ class RichText extends BaseItem {
|
|
|
23004
23011
|
return unsafe.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
23005
23012
|
};
|
|
23006
23013
|
const elements = this.editor.editor.children.map(renderNode);
|
|
23007
|
-
const
|
|
23008
|
-
const
|
|
23009
|
-
const
|
|
23010
|
-
const
|
|
23014
|
+
const cameraScale = this.board.camera.getScale();
|
|
23015
|
+
const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
|
|
23016
|
+
const { scaleX, scaleY } = this.transformation.getMatrixData();
|
|
23017
|
+
const transform = `translate(${this.left}px, ${this.top}px) scale(${scaleX * extraScale}, ${scaleY * extraScale})`;
|
|
23018
|
+
const transformedWidth = this.getMbr().getWidth();
|
|
23019
|
+
const transformedHeight = this.getMbr().getHeight();
|
|
23011
23020
|
const div = documentFactory.createElement("rich-text");
|
|
23012
23021
|
div.id = this.getId();
|
|
23013
23022
|
div.style.width = `${transformedWidth + 5}px`;
|
|
@@ -40933,11 +40942,11 @@ function convertBlobToDataUrl(blob) {
|
|
|
40933
40942
|
}
|
|
40934
40943
|
|
|
40935
40944
|
// src/Items/Frame/FrameData.ts
|
|
40936
|
-
var FRAME_BORDER_COLOR = "
|
|
40945
|
+
var FRAME_BORDER_COLOR = semanticColor("contrastGray");
|
|
40937
40946
|
var FRAME_HIGHLIGHTER_BORDER_COLOR = "#93AFF6";
|
|
40938
40947
|
var FRAME_CHILDREN_HIGHLIGHTER_COLOR = "rgb(10, 15, 41, .08)";
|
|
40939
40948
|
var FRAME_CHILDREN_HIGHLIGHTER_BORDER_COLOR = "#4778F5";
|
|
40940
|
-
var FRAME_TITLE_COLOR = "
|
|
40949
|
+
var FRAME_TITLE_COLOR = semanticColor("contrastNeutral");
|
|
40941
40950
|
var FRAME_TYPES = [
|
|
40942
40951
|
{ id: "Custom", label: "Custom" },
|
|
40943
40952
|
{ id: "Frame16x9", label: "16:9" },
|
|
@@ -40982,7 +40991,7 @@ class DefaultFrameData {
|
|
|
40982
40991
|
canChangeRatio;
|
|
40983
40992
|
linkTo;
|
|
40984
40993
|
itemType = "Frame";
|
|
40985
|
-
constructor(shapeType = "Custom", backgroundColor =
|
|
40994
|
+
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
40995
|
this.shapeType = shapeType;
|
|
40987
40996
|
this.backgroundColor = backgroundColor;
|
|
40988
40997
|
this.backgroundOpacity = backgroundOpacity;
|
|
@@ -41042,6 +41051,14 @@ class Frame2 extends BaseItem {
|
|
|
41042
41051
|
this.linkTo = new LinkTo(this.id, board.events);
|
|
41043
41052
|
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
41053
|
this.text.setSelectionHorisontalAlignment("left");
|
|
41054
|
+
this.text.customTransformationMatrix = () => {
|
|
41055
|
+
const { translateX, translateY, scaleX } = this.transformation.getMatrixData();
|
|
41056
|
+
const scaleY = this.text.layoutNodes.height * scaleX / 10;
|
|
41057
|
+
return new Matrix(translateX, translateY, scaleX, scaleY);
|
|
41058
|
+
};
|
|
41059
|
+
this.text.renderingScale = (cameraScale) => {
|
|
41060
|
+
return Math.max(1, Math.min(5, 1 / cameraScale));
|
|
41061
|
+
};
|
|
41045
41062
|
this.transformation.subject.subscribe(() => {
|
|
41046
41063
|
this.transformPath();
|
|
41047
41064
|
this.updateMbr();
|
package/dist/cjs/node.js
CHANGED
|
@@ -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,13 +24978,17 @@ class RichText extends BaseItem {
|
|
|
24976
24978
|
return this.shrinkWidth;
|
|
24977
24979
|
}
|
|
24978
24980
|
getTransformedContainer() {
|
|
24979
|
-
|
|
24980
|
-
|
|
24981
|
-
|
|
24982
|
-
|
|
24983
|
-
|
|
24981
|
+
const cameraScale = this.board.camera.getScale();
|
|
24982
|
+
const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
|
|
24983
|
+
let matrix;
|
|
24984
|
+
if (this.customTransformationMatrix) {
|
|
24985
|
+
matrix = this.customTransformationMatrix();
|
|
24986
|
+
} else {
|
|
24987
|
+
matrix = this.transformation.toMatrix();
|
|
24984
24988
|
}
|
|
24985
|
-
|
|
24989
|
+
const { translateX, translateY, scaleX, scaleY } = matrix;
|
|
24990
|
+
const scaledMatrix = new Matrix(translateX, translateY, scaleX * extraScale, scaleY * extraScale);
|
|
24991
|
+
return this.container.getTransformed(scaledMatrix);
|
|
24986
24992
|
}
|
|
24987
24993
|
emitWithoutApplying = (op) => {
|
|
24988
24994
|
if (this.board.events) {
|
|
@@ -25323,7 +25329,9 @@ class RichText extends BaseItem {
|
|
|
25323
25329
|
this.insideOf = data.insideOf;
|
|
25324
25330
|
if (typeof document !== "undefined") {
|
|
25325
25331
|
document.fonts.ready.then(() => {
|
|
25326
|
-
this.
|
|
25332
|
+
this.layoutNodes = getBlockNodes(this.getBlockNodes(), this.shrinkWidth ? Infinity : this.getMaxWidth() || 0, this.shrinkWidth, this.insideOf === "Frame");
|
|
25333
|
+
this.alignInRectangle(this.getTransformedContainer(), this.editor.verticalAlignment);
|
|
25334
|
+
this.transformCanvas();
|
|
25327
25335
|
});
|
|
25328
25336
|
}
|
|
25329
25337
|
this.subject.publish(this);
|
|
@@ -25340,12 +25348,11 @@ class RichText extends BaseItem {
|
|
|
25340
25348
|
}
|
|
25341
25349
|
const { ctx } = context;
|
|
25342
25350
|
ctx.save();
|
|
25351
|
+
const cameraScale = context.getCameraScale();
|
|
25352
|
+
const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
|
|
25343
25353
|
ctx.translate(this.left, this.top);
|
|
25344
|
-
const
|
|
25345
|
-
|
|
25346
|
-
const { scaleX, scaleY } = this.transformation.getMatrixData();
|
|
25347
|
-
ctx.scale(scaleX, scaleY);
|
|
25348
|
-
}
|
|
25354
|
+
const { scaleX, scaleY } = this.transformation.getMatrixData();
|
|
25355
|
+
ctx.scale(scaleX * extraScale, scaleY * extraScale);
|
|
25349
25356
|
const shouldClip = this.insideOf === "Shape" || this.insideOf === "Sticker";
|
|
25350
25357
|
if (shouldClip) {
|
|
25351
25358
|
ctx.clip(this.clipPath.nativePath);
|
|
@@ -25476,10 +25483,12 @@ class RichText extends BaseItem {
|
|
|
25476
25483
|
return unsafe.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
25477
25484
|
};
|
|
25478
25485
|
const elements = this.editor.editor.children.map(renderNode);
|
|
25479
|
-
const
|
|
25480
|
-
const
|
|
25481
|
-
const
|
|
25482
|
-
const
|
|
25486
|
+
const cameraScale = this.board.camera.getScale();
|
|
25487
|
+
const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
|
|
25488
|
+
const { scaleX, scaleY } = this.transformation.getMatrixData();
|
|
25489
|
+
const transform = `translate(${this.left}px, ${this.top}px) scale(${scaleX * extraScale}, ${scaleY * extraScale})`;
|
|
25490
|
+
const transformedWidth = this.getMbr().getWidth();
|
|
25491
|
+
const transformedHeight = this.getMbr().getHeight();
|
|
25483
25492
|
const div = documentFactory.createElement("rich-text");
|
|
25484
25493
|
div.id = this.getId();
|
|
25485
25494
|
div.style.width = `${transformedWidth + 5}px`;
|
|
@@ -43406,11 +43415,11 @@ function convertBlobToDataUrl(blob) {
|
|
|
43406
43415
|
}
|
|
43407
43416
|
|
|
43408
43417
|
// src/Items/Frame/FrameData.ts
|
|
43409
|
-
var FRAME_BORDER_COLOR = "
|
|
43418
|
+
var FRAME_BORDER_COLOR = semanticColor("contrastGray");
|
|
43410
43419
|
var FRAME_HIGHLIGHTER_BORDER_COLOR = "#93AFF6";
|
|
43411
43420
|
var FRAME_CHILDREN_HIGHLIGHTER_COLOR = "rgb(10, 15, 41, .08)";
|
|
43412
43421
|
var FRAME_CHILDREN_HIGHLIGHTER_BORDER_COLOR = "#4778F5";
|
|
43413
|
-
var FRAME_TITLE_COLOR = "
|
|
43422
|
+
var FRAME_TITLE_COLOR = semanticColor("contrastNeutral");
|
|
43414
43423
|
var FRAME_TYPES = [
|
|
43415
43424
|
{ id: "Custom", label: "Custom" },
|
|
43416
43425
|
{ id: "Frame16x9", label: "16:9" },
|
|
@@ -43455,7 +43464,7 @@ class DefaultFrameData {
|
|
|
43455
43464
|
canChangeRatio;
|
|
43456
43465
|
linkTo;
|
|
43457
43466
|
itemType = "Frame";
|
|
43458
|
-
constructor(shapeType = "Custom", backgroundColor =
|
|
43467
|
+
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
43468
|
this.shapeType = shapeType;
|
|
43460
43469
|
this.backgroundColor = backgroundColor;
|
|
43461
43470
|
this.backgroundOpacity = backgroundOpacity;
|
|
@@ -43515,6 +43524,14 @@ class Frame2 extends BaseItem {
|
|
|
43515
43524
|
this.linkTo = new LinkTo(this.id, board.events);
|
|
43516
43525
|
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
43526
|
this.text.setSelectionHorisontalAlignment("left");
|
|
43527
|
+
this.text.customTransformationMatrix = () => {
|
|
43528
|
+
const { translateX, translateY, scaleX } = this.transformation.getMatrixData();
|
|
43529
|
+
const scaleY = this.text.layoutNodes.height * scaleX / 10;
|
|
43530
|
+
return new Matrix(translateX, translateY, scaleX, scaleY);
|
|
43531
|
+
};
|
|
43532
|
+
this.text.renderingScale = (cameraScale) => {
|
|
43533
|
+
return Math.max(1, Math.min(5, 1 / cameraScale));
|
|
43534
|
+
};
|
|
43518
43535
|
this.transformation.subject.subscribe(() => {
|
|
43519
43536
|
this.transformPath();
|
|
43520
43537
|
this.updateMbr();
|
package/dist/esm/browser.js
CHANGED
|
@@ -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,13 +22335,17 @@ class RichText extends BaseItem {
|
|
|
22333
22335
|
return this.shrinkWidth;
|
|
22334
22336
|
}
|
|
22335
22337
|
getTransformedContainer() {
|
|
22336
|
-
|
|
22337
|
-
|
|
22338
|
-
|
|
22339
|
-
|
|
22340
|
-
|
|
22338
|
+
const cameraScale = this.board.camera.getScale();
|
|
22339
|
+
const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
|
|
22340
|
+
let matrix;
|
|
22341
|
+
if (this.customTransformationMatrix) {
|
|
22342
|
+
matrix = this.customTransformationMatrix();
|
|
22343
|
+
} else {
|
|
22344
|
+
matrix = this.transformation.toMatrix();
|
|
22341
22345
|
}
|
|
22342
|
-
|
|
22346
|
+
const { translateX, translateY, scaleX, scaleY } = matrix;
|
|
22347
|
+
const scaledMatrix = new Matrix(translateX, translateY, scaleX * extraScale, scaleY * extraScale);
|
|
22348
|
+
return this.container.getTransformed(scaledMatrix);
|
|
22343
22349
|
}
|
|
22344
22350
|
emitWithoutApplying = (op) => {
|
|
22345
22351
|
if (this.board.events) {
|
|
@@ -22680,7 +22686,9 @@ class RichText extends BaseItem {
|
|
|
22680
22686
|
this.insideOf = data.insideOf;
|
|
22681
22687
|
if (typeof document !== "undefined") {
|
|
22682
22688
|
document.fonts.ready.then(() => {
|
|
22683
|
-
this.
|
|
22689
|
+
this.layoutNodes = getBlockNodes(this.getBlockNodes(), this.shrinkWidth ? Infinity : this.getMaxWidth() || 0, this.shrinkWidth, this.insideOf === "Frame");
|
|
22690
|
+
this.alignInRectangle(this.getTransformedContainer(), this.editor.verticalAlignment);
|
|
22691
|
+
this.transformCanvas();
|
|
22684
22692
|
});
|
|
22685
22693
|
}
|
|
22686
22694
|
this.subject.publish(this);
|
|
@@ -22697,12 +22705,11 @@ class RichText extends BaseItem {
|
|
|
22697
22705
|
}
|
|
22698
22706
|
const { ctx } = context;
|
|
22699
22707
|
ctx.save();
|
|
22708
|
+
const cameraScale = context.getCameraScale();
|
|
22709
|
+
const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
|
|
22700
22710
|
ctx.translate(this.left, this.top);
|
|
22701
|
-
const
|
|
22702
|
-
|
|
22703
|
-
const { scaleX, scaleY } = this.transformation.getMatrixData();
|
|
22704
|
-
ctx.scale(scaleX, scaleY);
|
|
22705
|
-
}
|
|
22711
|
+
const { scaleX, scaleY } = this.transformation.getMatrixData();
|
|
22712
|
+
ctx.scale(scaleX * extraScale, scaleY * extraScale);
|
|
22706
22713
|
const shouldClip = this.insideOf === "Shape" || this.insideOf === "Sticker";
|
|
22707
22714
|
if (shouldClip) {
|
|
22708
22715
|
ctx.clip(this.clipPath.nativePath);
|
|
@@ -22833,10 +22840,12 @@ class RichText extends BaseItem {
|
|
|
22833
22840
|
return unsafe.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
22834
22841
|
};
|
|
22835
22842
|
const elements = this.editor.editor.children.map(renderNode);
|
|
22836
|
-
const
|
|
22837
|
-
const
|
|
22838
|
-
const
|
|
22839
|
-
const
|
|
22843
|
+
const cameraScale = this.board.camera.getScale();
|
|
22844
|
+
const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
|
|
22845
|
+
const { scaleX, scaleY } = this.transformation.getMatrixData();
|
|
22846
|
+
const transform = `translate(${this.left}px, ${this.top}px) scale(${scaleX * extraScale}, ${scaleY * extraScale})`;
|
|
22847
|
+
const transformedWidth = this.getMbr().getWidth();
|
|
22848
|
+
const transformedHeight = this.getMbr().getHeight();
|
|
22840
22849
|
const div = documentFactory.createElement("rich-text");
|
|
22841
22850
|
div.id = this.getId();
|
|
22842
22851
|
div.style.width = `${transformedWidth + 5}px`;
|
|
@@ -40762,11 +40771,11 @@ function convertBlobToDataUrl(blob) {
|
|
|
40762
40771
|
}
|
|
40763
40772
|
|
|
40764
40773
|
// src/Items/Frame/FrameData.ts
|
|
40765
|
-
var FRAME_BORDER_COLOR = "
|
|
40774
|
+
var FRAME_BORDER_COLOR = semanticColor("contrastGray");
|
|
40766
40775
|
var FRAME_HIGHLIGHTER_BORDER_COLOR = "#93AFF6";
|
|
40767
40776
|
var FRAME_CHILDREN_HIGHLIGHTER_COLOR = "rgb(10, 15, 41, .08)";
|
|
40768
40777
|
var FRAME_CHILDREN_HIGHLIGHTER_BORDER_COLOR = "#4778F5";
|
|
40769
|
-
var FRAME_TITLE_COLOR = "
|
|
40778
|
+
var FRAME_TITLE_COLOR = semanticColor("contrastNeutral");
|
|
40770
40779
|
var FRAME_TYPES = [
|
|
40771
40780
|
{ id: "Custom", label: "Custom" },
|
|
40772
40781
|
{ id: "Frame16x9", label: "16:9" },
|
|
@@ -40811,7 +40820,7 @@ class DefaultFrameData {
|
|
|
40811
40820
|
canChangeRatio;
|
|
40812
40821
|
linkTo;
|
|
40813
40822
|
itemType = "Frame";
|
|
40814
|
-
constructor(shapeType = "Custom", backgroundColor =
|
|
40823
|
+
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
40824
|
this.shapeType = shapeType;
|
|
40816
40825
|
this.backgroundColor = backgroundColor;
|
|
40817
40826
|
this.backgroundOpacity = backgroundOpacity;
|
|
@@ -40871,6 +40880,14 @@ class Frame2 extends BaseItem {
|
|
|
40871
40880
|
this.linkTo = new LinkTo(this.id, board.events);
|
|
40872
40881
|
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
40882
|
this.text.setSelectionHorisontalAlignment("left");
|
|
40883
|
+
this.text.customTransformationMatrix = () => {
|
|
40884
|
+
const { translateX, translateY, scaleX } = this.transformation.getMatrixData();
|
|
40885
|
+
const scaleY = this.text.layoutNodes.height * scaleX / 10;
|
|
40886
|
+
return new Matrix(translateX, translateY, scaleX, scaleY);
|
|
40887
|
+
};
|
|
40888
|
+
this.text.renderingScale = (cameraScale) => {
|
|
40889
|
+
return Math.max(1, Math.min(5, 1 / cameraScale));
|
|
40890
|
+
};
|
|
40874
40891
|
this.transformation.subject.subscribe(() => {
|
|
40875
40892
|
this.transformPath();
|
|
40876
40893
|
this.updateMbr();
|
package/dist/esm/index.js
CHANGED
|
@@ -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,13 +22328,17 @@ class RichText extends BaseItem {
|
|
|
22326
22328
|
return this.shrinkWidth;
|
|
22327
22329
|
}
|
|
22328
22330
|
getTransformedContainer() {
|
|
22329
|
-
|
|
22330
|
-
|
|
22331
|
-
|
|
22332
|
-
|
|
22333
|
-
|
|
22331
|
+
const cameraScale = this.board.camera.getScale();
|
|
22332
|
+
const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
|
|
22333
|
+
let matrix;
|
|
22334
|
+
if (this.customTransformationMatrix) {
|
|
22335
|
+
matrix = this.customTransformationMatrix();
|
|
22336
|
+
} else {
|
|
22337
|
+
matrix = this.transformation.toMatrix();
|
|
22334
22338
|
}
|
|
22335
|
-
|
|
22339
|
+
const { translateX, translateY, scaleX, scaleY } = matrix;
|
|
22340
|
+
const scaledMatrix = new Matrix(translateX, translateY, scaleX * extraScale, scaleY * extraScale);
|
|
22341
|
+
return this.container.getTransformed(scaledMatrix);
|
|
22336
22342
|
}
|
|
22337
22343
|
emitWithoutApplying = (op) => {
|
|
22338
22344
|
if (this.board.events) {
|
|
@@ -22673,7 +22679,9 @@ class RichText extends BaseItem {
|
|
|
22673
22679
|
this.insideOf = data.insideOf;
|
|
22674
22680
|
if (typeof document !== "undefined") {
|
|
22675
22681
|
document.fonts.ready.then(() => {
|
|
22676
|
-
this.
|
|
22682
|
+
this.layoutNodes = getBlockNodes(this.getBlockNodes(), this.shrinkWidth ? Infinity : this.getMaxWidth() || 0, this.shrinkWidth, this.insideOf === "Frame");
|
|
22683
|
+
this.alignInRectangle(this.getTransformedContainer(), this.editor.verticalAlignment);
|
|
22684
|
+
this.transformCanvas();
|
|
22677
22685
|
});
|
|
22678
22686
|
}
|
|
22679
22687
|
this.subject.publish(this);
|
|
@@ -22690,12 +22698,11 @@ class RichText extends BaseItem {
|
|
|
22690
22698
|
}
|
|
22691
22699
|
const { ctx } = context;
|
|
22692
22700
|
ctx.save();
|
|
22701
|
+
const cameraScale = context.getCameraScale();
|
|
22702
|
+
const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
|
|
22693
22703
|
ctx.translate(this.left, this.top);
|
|
22694
|
-
const
|
|
22695
|
-
|
|
22696
|
-
const { scaleX, scaleY } = this.transformation.getMatrixData();
|
|
22697
|
-
ctx.scale(scaleX, scaleY);
|
|
22698
|
-
}
|
|
22704
|
+
const { scaleX, scaleY } = this.transformation.getMatrixData();
|
|
22705
|
+
ctx.scale(scaleX * extraScale, scaleY * extraScale);
|
|
22699
22706
|
const shouldClip = this.insideOf === "Shape" || this.insideOf === "Sticker";
|
|
22700
22707
|
if (shouldClip) {
|
|
22701
22708
|
ctx.clip(this.clipPath.nativePath);
|
|
@@ -22826,10 +22833,12 @@ class RichText extends BaseItem {
|
|
|
22826
22833
|
return unsafe.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
22827
22834
|
};
|
|
22828
22835
|
const elements = this.editor.editor.children.map(renderNode);
|
|
22829
|
-
const
|
|
22830
|
-
const
|
|
22831
|
-
const
|
|
22832
|
-
const
|
|
22836
|
+
const cameraScale = this.board.camera.getScale();
|
|
22837
|
+
const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
|
|
22838
|
+
const { scaleX, scaleY } = this.transformation.getMatrixData();
|
|
22839
|
+
const transform = `translate(${this.left}px, ${this.top}px) scale(${scaleX * extraScale}, ${scaleY * extraScale})`;
|
|
22840
|
+
const transformedWidth = this.getMbr().getWidth();
|
|
22841
|
+
const transformedHeight = this.getMbr().getHeight();
|
|
22833
22842
|
const div = documentFactory.createElement("rich-text");
|
|
22834
22843
|
div.id = this.getId();
|
|
22835
22844
|
div.style.width = `${transformedWidth + 5}px`;
|
|
@@ -40755,11 +40764,11 @@ function convertBlobToDataUrl(blob) {
|
|
|
40755
40764
|
}
|
|
40756
40765
|
|
|
40757
40766
|
// src/Items/Frame/FrameData.ts
|
|
40758
|
-
var FRAME_BORDER_COLOR = "
|
|
40767
|
+
var FRAME_BORDER_COLOR = semanticColor("contrastGray");
|
|
40759
40768
|
var FRAME_HIGHLIGHTER_BORDER_COLOR = "#93AFF6";
|
|
40760
40769
|
var FRAME_CHILDREN_HIGHLIGHTER_COLOR = "rgb(10, 15, 41, .08)";
|
|
40761
40770
|
var FRAME_CHILDREN_HIGHLIGHTER_BORDER_COLOR = "#4778F5";
|
|
40762
|
-
var FRAME_TITLE_COLOR = "
|
|
40771
|
+
var FRAME_TITLE_COLOR = semanticColor("contrastNeutral");
|
|
40763
40772
|
var FRAME_TYPES = [
|
|
40764
40773
|
{ id: "Custom", label: "Custom" },
|
|
40765
40774
|
{ id: "Frame16x9", label: "16:9" },
|
|
@@ -40804,7 +40813,7 @@ class DefaultFrameData {
|
|
|
40804
40813
|
canChangeRatio;
|
|
40805
40814
|
linkTo;
|
|
40806
40815
|
itemType = "Frame";
|
|
40807
|
-
constructor(shapeType = "Custom", backgroundColor =
|
|
40816
|
+
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
40817
|
this.shapeType = shapeType;
|
|
40809
40818
|
this.backgroundColor = backgroundColor;
|
|
40810
40819
|
this.backgroundOpacity = backgroundOpacity;
|
|
@@ -40864,6 +40873,14 @@ class Frame2 extends BaseItem {
|
|
|
40864
40873
|
this.linkTo = new LinkTo(this.id, board.events);
|
|
40865
40874
|
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
40875
|
this.text.setSelectionHorisontalAlignment("left");
|
|
40876
|
+
this.text.customTransformationMatrix = () => {
|
|
40877
|
+
const { translateX, translateY, scaleX } = this.transformation.getMatrixData();
|
|
40878
|
+
const scaleY = this.text.layoutNodes.height * scaleX / 10;
|
|
40879
|
+
return new Matrix(translateX, translateY, scaleX, scaleY);
|
|
40880
|
+
};
|
|
40881
|
+
this.text.renderingScale = (cameraScale) => {
|
|
40882
|
+
return Math.max(1, Math.min(5, 1 / cameraScale));
|
|
40883
|
+
};
|
|
40867
40884
|
this.transformation.subject.subscribe(() => {
|
|
40868
40885
|
this.transformPath();
|
|
40869
40886
|
this.updateMbr();
|
package/dist/esm/node.js
CHANGED
|
@@ -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,13 +24795,17 @@ class RichText extends BaseItem {
|
|
|
24793
24795
|
return this.shrinkWidth;
|
|
24794
24796
|
}
|
|
24795
24797
|
getTransformedContainer() {
|
|
24796
|
-
|
|
24797
|
-
|
|
24798
|
-
|
|
24799
|
-
|
|
24800
|
-
|
|
24798
|
+
const cameraScale = this.board.camera.getScale();
|
|
24799
|
+
const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
|
|
24800
|
+
let matrix;
|
|
24801
|
+
if (this.customTransformationMatrix) {
|
|
24802
|
+
matrix = this.customTransformationMatrix();
|
|
24803
|
+
} else {
|
|
24804
|
+
matrix = this.transformation.toMatrix();
|
|
24801
24805
|
}
|
|
24802
|
-
|
|
24806
|
+
const { translateX, translateY, scaleX, scaleY } = matrix;
|
|
24807
|
+
const scaledMatrix = new Matrix(translateX, translateY, scaleX * extraScale, scaleY * extraScale);
|
|
24808
|
+
return this.container.getTransformed(scaledMatrix);
|
|
24803
24809
|
}
|
|
24804
24810
|
emitWithoutApplying = (op) => {
|
|
24805
24811
|
if (this.board.events) {
|
|
@@ -25140,7 +25146,9 @@ class RichText extends BaseItem {
|
|
|
25140
25146
|
this.insideOf = data.insideOf;
|
|
25141
25147
|
if (typeof document !== "undefined") {
|
|
25142
25148
|
document.fonts.ready.then(() => {
|
|
25143
|
-
this.
|
|
25149
|
+
this.layoutNodes = getBlockNodes(this.getBlockNodes(), this.shrinkWidth ? Infinity : this.getMaxWidth() || 0, this.shrinkWidth, this.insideOf === "Frame");
|
|
25150
|
+
this.alignInRectangle(this.getTransformedContainer(), this.editor.verticalAlignment);
|
|
25151
|
+
this.transformCanvas();
|
|
25144
25152
|
});
|
|
25145
25153
|
}
|
|
25146
25154
|
this.subject.publish(this);
|
|
@@ -25157,12 +25165,11 @@ class RichText extends BaseItem {
|
|
|
25157
25165
|
}
|
|
25158
25166
|
const { ctx } = context;
|
|
25159
25167
|
ctx.save();
|
|
25168
|
+
const cameraScale = context.getCameraScale();
|
|
25169
|
+
const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
|
|
25160
25170
|
ctx.translate(this.left, this.top);
|
|
25161
|
-
const
|
|
25162
|
-
|
|
25163
|
-
const { scaleX, scaleY } = this.transformation.getMatrixData();
|
|
25164
|
-
ctx.scale(scaleX, scaleY);
|
|
25165
|
-
}
|
|
25171
|
+
const { scaleX, scaleY } = this.transformation.getMatrixData();
|
|
25172
|
+
ctx.scale(scaleX * extraScale, scaleY * extraScale);
|
|
25166
25173
|
const shouldClip = this.insideOf === "Shape" || this.insideOf === "Sticker";
|
|
25167
25174
|
if (shouldClip) {
|
|
25168
25175
|
ctx.clip(this.clipPath.nativePath);
|
|
@@ -25293,10 +25300,12 @@ class RichText extends BaseItem {
|
|
|
25293
25300
|
return unsafe.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
25294
25301
|
};
|
|
25295
25302
|
const elements = this.editor.editor.children.map(renderNode);
|
|
25296
|
-
const
|
|
25297
|
-
const
|
|
25298
|
-
const
|
|
25299
|
-
const
|
|
25303
|
+
const cameraScale = this.board.camera.getScale();
|
|
25304
|
+
const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
|
|
25305
|
+
const { scaleX, scaleY } = this.transformation.getMatrixData();
|
|
25306
|
+
const transform = `translate(${this.left}px, ${this.top}px) scale(${scaleX * extraScale}, ${scaleY * extraScale})`;
|
|
25307
|
+
const transformedWidth = this.getMbr().getWidth();
|
|
25308
|
+
const transformedHeight = this.getMbr().getHeight();
|
|
25300
25309
|
const div = documentFactory.createElement("rich-text");
|
|
25301
25310
|
div.id = this.getId();
|
|
25302
25311
|
div.style.width = `${transformedWidth + 5}px`;
|
|
@@ -43223,11 +43232,11 @@ function convertBlobToDataUrl(blob) {
|
|
|
43223
43232
|
}
|
|
43224
43233
|
|
|
43225
43234
|
// src/Items/Frame/FrameData.ts
|
|
43226
|
-
var FRAME_BORDER_COLOR = "
|
|
43235
|
+
var FRAME_BORDER_COLOR = semanticColor("contrastGray");
|
|
43227
43236
|
var FRAME_HIGHLIGHTER_BORDER_COLOR = "#93AFF6";
|
|
43228
43237
|
var FRAME_CHILDREN_HIGHLIGHTER_COLOR = "rgb(10, 15, 41, .08)";
|
|
43229
43238
|
var FRAME_CHILDREN_HIGHLIGHTER_BORDER_COLOR = "#4778F5";
|
|
43230
|
-
var FRAME_TITLE_COLOR = "
|
|
43239
|
+
var FRAME_TITLE_COLOR = semanticColor("contrastNeutral");
|
|
43231
43240
|
var FRAME_TYPES = [
|
|
43232
43241
|
{ id: "Custom", label: "Custom" },
|
|
43233
43242
|
{ id: "Frame16x9", label: "16:9" },
|
|
@@ -43272,7 +43281,7 @@ class DefaultFrameData {
|
|
|
43272
43281
|
canChangeRatio;
|
|
43273
43282
|
linkTo;
|
|
43274
43283
|
itemType = "Frame";
|
|
43275
|
-
constructor(shapeType = "Custom", backgroundColor =
|
|
43284
|
+
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
43285
|
this.shapeType = shapeType;
|
|
43277
43286
|
this.backgroundColor = backgroundColor;
|
|
43278
43287
|
this.backgroundOpacity = backgroundOpacity;
|
|
@@ -43332,6 +43341,14 @@ class Frame2 extends BaseItem {
|
|
|
43332
43341
|
this.linkTo = new LinkTo(this.id, board.events);
|
|
43333
43342
|
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
43343
|
this.text.setSelectionHorisontalAlignment("left");
|
|
43344
|
+
this.text.customTransformationMatrix = () => {
|
|
43345
|
+
const { translateX, translateY, scaleX } = this.transformation.getMatrixData();
|
|
43346
|
+
const scaleY = this.text.layoutNodes.height * scaleX / 10;
|
|
43347
|
+
return new Matrix(translateX, translateY, scaleX, scaleY);
|
|
43348
|
+
};
|
|
43349
|
+
this.text.renderingScale = (cameraScale) => {
|
|
43350
|
+
return Math.max(1, Math.min(5, 1 / cameraScale));
|
|
43351
|
+
};
|
|
43335
43352
|
this.transformation.subject.subscribe(() => {
|
|
43336
43353
|
this.transformPath();
|
|
43337
43354
|
this.updateMbr();
|
|
@@ -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
|
|
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
|
|
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,10 +6,11 @@ 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";
|
|
13
|
+
import { LayoutBlockNodes } from "./CanvasText/LayoutBlockNodes";
|
|
13
14
|
import { BlockNode, BlockType } from "./Editor/BlockNode";
|
|
14
15
|
import { TextStyle } from "./Editor/TextNode";
|
|
15
16
|
import { EditorContainer } from "./EditorContainer";
|
|
@@ -37,7 +38,7 @@ export declare class RichText extends BaseItem {
|
|
|
37
38
|
readonly editorEditor: import("slate").EditorInterface;
|
|
38
39
|
private isContainerSet;
|
|
39
40
|
isRenderEnabled: boolean;
|
|
40
|
-
|
|
41
|
+
layoutNodes: LayoutBlockNodes;
|
|
41
42
|
private clipPath;
|
|
42
43
|
private updateRequired;
|
|
43
44
|
private autoSizeScale;
|
|
@@ -52,6 +53,8 @@ export declare class RichText extends BaseItem {
|
|
|
52
53
|
private _onLimitReached;
|
|
53
54
|
private shrinkWidth;
|
|
54
55
|
prevMbr: Mbr | null;
|
|
56
|
+
customTransformationMatrix?: () => Matrix;
|
|
57
|
+
renderingScale?: (cameraScale: number) => number;
|
|
55
58
|
rtCounter: number;
|
|
56
59
|
constructor(board: Board, container: Mbr, id?: string, transformation?: Transformation, linkTo?: LinkTo, placeholderText?: string, isInShape?: boolean, autoSize?: boolean, insideOf?: ItemType | undefined, initialTextStyles?: DefaultTextStyles);
|
|
57
60
|
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[];
|