microboard-temp 0.12.6 → 0.12.8
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 +12 -8
- package/dist/cjs/index.js +12 -8
- package/dist/cjs/node.js +12 -8
- package/dist/esm/browser.js +12 -8
- package/dist/esm/index.js +12 -8
- package/dist/esm/node.js +12 -8
- package/package.json +1 -1
package/dist/cjs/browser.js
CHANGED
|
@@ -40473,7 +40473,7 @@ var stickerColors = {
|
|
|
40473
40473
|
var width = 200;
|
|
40474
40474
|
var height = 200;
|
|
40475
40475
|
var StickerShape = {
|
|
40476
|
-
textBounds: new Mbr(
|
|
40476
|
+
textBounds: new Mbr(8, 8, width - 8, height - 8),
|
|
40477
40477
|
stickerPath: new Path([
|
|
40478
40478
|
new Line(new Point(0, 0), new Point(width, 0)),
|
|
40479
40479
|
new Line(new Point(width, 0), new Point(width, height)),
|
|
@@ -40714,16 +40714,19 @@ class Sticker extends BaseItem {
|
|
|
40714
40714
|
div.style.boxShadow = "0px 18px 24px rgba(20, 21, 26, 0.25), 0px 8px 8px rgba(20, 21, 26, 0.125)";
|
|
40715
40715
|
const autoScale = this.text.isAutosize() && this.text.getAutoSizeScale() || 1;
|
|
40716
40716
|
const textElement = this.text.renderHTML(documentFactory);
|
|
40717
|
-
const padding =
|
|
40717
|
+
const padding = 8;
|
|
40718
40718
|
textElement.id = `${this.getId()}_text`;
|
|
40719
40719
|
textElement.style.overflow = "auto";
|
|
40720
40720
|
positionRelatively(textElement, div, padding);
|
|
40721
40721
|
resetElementScale(textElement);
|
|
40722
40722
|
scaleElementBy(textElement, 1 / scaleX, 1 / scaleY);
|
|
40723
40723
|
scaleElementBy(textElement, autoScale, autoScale);
|
|
40724
|
-
|
|
40724
|
+
const maxAvailableWidth = unscaledWidth - 2 * padding;
|
|
40725
|
+
textElement.style.maxWidth = `${maxAvailableWidth * scaleX}px`;
|
|
40725
40726
|
if (autoScale < 1) {
|
|
40726
|
-
textElement.style.width = `${
|
|
40727
|
+
textElement.style.width = `${maxAvailableWidth * scaleX}px`;
|
|
40728
|
+
} else {
|
|
40729
|
+
textElement.style.width = "100%";
|
|
40727
40730
|
}
|
|
40728
40731
|
const textHeight = this.text.layoutNodes.height * autoScale;
|
|
40729
40732
|
if (textHeight < height2) {
|
|
@@ -46061,8 +46064,9 @@ function getQuickAddButtons(selection, board) {
|
|
|
46061
46064
|
let quickAddItems = undefined;
|
|
46062
46065
|
function calculateQuickAddPosition(index2, selectedItem, connectorStartPoint) {
|
|
46063
46066
|
const connectorStorage = new SessionStorage;
|
|
46064
|
-
const currMbr = selectedItem.getPathMbr();
|
|
46067
|
+
const currMbr = selectedItem instanceof BaseItem ? selectedItem.getWorldMbr() : selectedItem.getPathMbr();
|
|
46065
46068
|
const selectedItemData = selectedItem.serialize();
|
|
46069
|
+
const selectedMatrix = selectedItem instanceof BaseItem ? selectedItem.getWorldMatrix() : new Matrix(selectedItemData.transformation?.translateX || 0, selectedItemData.transformation?.translateY || 0);
|
|
46066
46070
|
const width2 = currMbr.getWidth();
|
|
46067
46071
|
const height3 = currMbr.getHeight();
|
|
46068
46072
|
let offsetX = width2;
|
|
@@ -46102,8 +46106,8 @@ function getQuickAddButtons(selection, board) {
|
|
|
46102
46106
|
const adjustment = baseAdjustments[index2];
|
|
46103
46107
|
const newItemData = { ...itemData };
|
|
46104
46108
|
if (newItemData.transformation) {
|
|
46105
|
-
newItemData.transformation.translateX = adjustment.translateX +
|
|
46106
|
-
newItemData.transformation.translateY = adjustment.translateY +
|
|
46109
|
+
newItemData.transformation.translateX = adjustment.translateX + selectedMatrix.translateX;
|
|
46110
|
+
newItemData.transformation.translateY = adjustment.translateY + selectedMatrix.translateY + height3 / 2 - newHeight / 2;
|
|
46107
46111
|
}
|
|
46108
46112
|
const newMbr = new Mbr(newItemData.transformation?.translateX, newItemData.transformation?.translateY, (newItemData.transformation?.translateX || 0) + newWidth, (newItemData.transformation?.translateY || 0) + newHeight);
|
|
46109
46113
|
let step = 1;
|
|
@@ -46194,7 +46198,7 @@ function getQuickAddButtons(selection, board) {
|
|
|
46194
46198
|
}
|
|
46195
46199
|
function getQuickButtonsPositions(customMbr) {
|
|
46196
46200
|
const single = selection.items.getSingle();
|
|
46197
|
-
const itemMbr = customMbr ? customMbr : single?.getMbr();
|
|
46201
|
+
const itemMbr = customMbr ? customMbr : single instanceof BaseItem ? single.getWorldMbr() : single?.getMbr();
|
|
46198
46202
|
if (!itemMbr || single?.itemType !== "Sticker" && single?.itemType !== "Shape" && single?.itemType !== "AINode" && single?.itemType !== "RichText") {
|
|
46199
46203
|
return;
|
|
46200
46204
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -40473,7 +40473,7 @@ var stickerColors = {
|
|
|
40473
40473
|
var width = 200;
|
|
40474
40474
|
var height = 200;
|
|
40475
40475
|
var StickerShape = {
|
|
40476
|
-
textBounds: new Mbr(
|
|
40476
|
+
textBounds: new Mbr(8, 8, width - 8, height - 8),
|
|
40477
40477
|
stickerPath: new Path([
|
|
40478
40478
|
new Line(new Point(0, 0), new Point(width, 0)),
|
|
40479
40479
|
new Line(new Point(width, 0), new Point(width, height)),
|
|
@@ -40714,16 +40714,19 @@ class Sticker extends BaseItem {
|
|
|
40714
40714
|
div.style.boxShadow = "0px 18px 24px rgba(20, 21, 26, 0.25), 0px 8px 8px rgba(20, 21, 26, 0.125)";
|
|
40715
40715
|
const autoScale = this.text.isAutosize() && this.text.getAutoSizeScale() || 1;
|
|
40716
40716
|
const textElement = this.text.renderHTML(documentFactory);
|
|
40717
|
-
const padding =
|
|
40717
|
+
const padding = 8;
|
|
40718
40718
|
textElement.id = `${this.getId()}_text`;
|
|
40719
40719
|
textElement.style.overflow = "auto";
|
|
40720
40720
|
positionRelatively(textElement, div, padding);
|
|
40721
40721
|
resetElementScale(textElement);
|
|
40722
40722
|
scaleElementBy(textElement, 1 / scaleX, 1 / scaleY);
|
|
40723
40723
|
scaleElementBy(textElement, autoScale, autoScale);
|
|
40724
|
-
|
|
40724
|
+
const maxAvailableWidth = unscaledWidth - 2 * padding;
|
|
40725
|
+
textElement.style.maxWidth = `${maxAvailableWidth * scaleX}px`;
|
|
40725
40726
|
if (autoScale < 1) {
|
|
40726
|
-
textElement.style.width = `${
|
|
40727
|
+
textElement.style.width = `${maxAvailableWidth * scaleX}px`;
|
|
40728
|
+
} else {
|
|
40729
|
+
textElement.style.width = "100%";
|
|
40727
40730
|
}
|
|
40728
40731
|
const textHeight = this.text.layoutNodes.height * autoScale;
|
|
40729
40732
|
if (textHeight < height2) {
|
|
@@ -46061,8 +46064,9 @@ function getQuickAddButtons(selection, board) {
|
|
|
46061
46064
|
let quickAddItems = undefined;
|
|
46062
46065
|
function calculateQuickAddPosition(index2, selectedItem, connectorStartPoint) {
|
|
46063
46066
|
const connectorStorage = new SessionStorage;
|
|
46064
|
-
const currMbr = selectedItem.getPathMbr();
|
|
46067
|
+
const currMbr = selectedItem instanceof BaseItem ? selectedItem.getWorldMbr() : selectedItem.getPathMbr();
|
|
46065
46068
|
const selectedItemData = selectedItem.serialize();
|
|
46069
|
+
const selectedMatrix = selectedItem instanceof BaseItem ? selectedItem.getWorldMatrix() : new Matrix(selectedItemData.transformation?.translateX || 0, selectedItemData.transformation?.translateY || 0);
|
|
46066
46070
|
const width2 = currMbr.getWidth();
|
|
46067
46071
|
const height3 = currMbr.getHeight();
|
|
46068
46072
|
let offsetX = width2;
|
|
@@ -46102,8 +46106,8 @@ function getQuickAddButtons(selection, board) {
|
|
|
46102
46106
|
const adjustment = baseAdjustments[index2];
|
|
46103
46107
|
const newItemData = { ...itemData };
|
|
46104
46108
|
if (newItemData.transformation) {
|
|
46105
|
-
newItemData.transformation.translateX = adjustment.translateX +
|
|
46106
|
-
newItemData.transformation.translateY = adjustment.translateY +
|
|
46109
|
+
newItemData.transformation.translateX = adjustment.translateX + selectedMatrix.translateX;
|
|
46110
|
+
newItemData.transformation.translateY = adjustment.translateY + selectedMatrix.translateY + height3 / 2 - newHeight / 2;
|
|
46107
46111
|
}
|
|
46108
46112
|
const newMbr = new Mbr(newItemData.transformation?.translateX, newItemData.transformation?.translateY, (newItemData.transformation?.translateX || 0) + newWidth, (newItemData.transformation?.translateY || 0) + newHeight);
|
|
46109
46113
|
let step = 1;
|
|
@@ -46194,7 +46198,7 @@ function getQuickAddButtons(selection, board) {
|
|
|
46194
46198
|
}
|
|
46195
46199
|
function getQuickButtonsPositions(customMbr) {
|
|
46196
46200
|
const single = selection.items.getSingle();
|
|
46197
|
-
const itemMbr = customMbr ? customMbr : single?.getMbr();
|
|
46201
|
+
const itemMbr = customMbr ? customMbr : single instanceof BaseItem ? single.getWorldMbr() : single?.getMbr();
|
|
46198
46202
|
if (!itemMbr || single?.itemType !== "Sticker" && single?.itemType !== "Shape" && single?.itemType !== "AINode" && single?.itemType !== "RichText") {
|
|
46199
46203
|
return;
|
|
46200
46204
|
}
|
package/dist/cjs/node.js
CHANGED
|
@@ -42946,7 +42946,7 @@ var stickerColors = {
|
|
|
42946
42946
|
var width = 200;
|
|
42947
42947
|
var height = 200;
|
|
42948
42948
|
var StickerShape = {
|
|
42949
|
-
textBounds: new Mbr(
|
|
42949
|
+
textBounds: new Mbr(8, 8, width - 8, height - 8),
|
|
42950
42950
|
stickerPath: new Path([
|
|
42951
42951
|
new Line(new Point(0, 0), new Point(width, 0)),
|
|
42952
42952
|
new Line(new Point(width, 0), new Point(width, height)),
|
|
@@ -43187,16 +43187,19 @@ class Sticker extends BaseItem {
|
|
|
43187
43187
|
div.style.boxShadow = "0px 18px 24px rgba(20, 21, 26, 0.25), 0px 8px 8px rgba(20, 21, 26, 0.125)";
|
|
43188
43188
|
const autoScale = this.text.isAutosize() && this.text.getAutoSizeScale() || 1;
|
|
43189
43189
|
const textElement = this.text.renderHTML(documentFactory);
|
|
43190
|
-
const padding =
|
|
43190
|
+
const padding = 8;
|
|
43191
43191
|
textElement.id = `${this.getId()}_text`;
|
|
43192
43192
|
textElement.style.overflow = "auto";
|
|
43193
43193
|
positionRelatively(textElement, div, padding);
|
|
43194
43194
|
resetElementScale(textElement);
|
|
43195
43195
|
scaleElementBy(textElement, 1 / scaleX, 1 / scaleY);
|
|
43196
43196
|
scaleElementBy(textElement, autoScale, autoScale);
|
|
43197
|
-
|
|
43197
|
+
const maxAvailableWidth = unscaledWidth - 2 * padding;
|
|
43198
|
+
textElement.style.maxWidth = `${maxAvailableWidth * scaleX}px`;
|
|
43198
43199
|
if (autoScale < 1) {
|
|
43199
|
-
textElement.style.width = `${
|
|
43200
|
+
textElement.style.width = `${maxAvailableWidth * scaleX}px`;
|
|
43201
|
+
} else {
|
|
43202
|
+
textElement.style.width = "100%";
|
|
43200
43203
|
}
|
|
43201
43204
|
const textHeight = this.text.layoutNodes.height * autoScale;
|
|
43202
43205
|
if (textHeight < height2) {
|
|
@@ -48534,8 +48537,9 @@ function getQuickAddButtons(selection, board) {
|
|
|
48534
48537
|
let quickAddItems = undefined;
|
|
48535
48538
|
function calculateQuickAddPosition(index2, selectedItem, connectorStartPoint) {
|
|
48536
48539
|
const connectorStorage = new SessionStorage;
|
|
48537
|
-
const currMbr = selectedItem.getPathMbr();
|
|
48540
|
+
const currMbr = selectedItem instanceof BaseItem ? selectedItem.getWorldMbr() : selectedItem.getPathMbr();
|
|
48538
48541
|
const selectedItemData = selectedItem.serialize();
|
|
48542
|
+
const selectedMatrix = selectedItem instanceof BaseItem ? selectedItem.getWorldMatrix() : new Matrix(selectedItemData.transformation?.translateX || 0, selectedItemData.transformation?.translateY || 0);
|
|
48539
48543
|
const width2 = currMbr.getWidth();
|
|
48540
48544
|
const height3 = currMbr.getHeight();
|
|
48541
48545
|
let offsetX = width2;
|
|
@@ -48575,8 +48579,8 @@ function getQuickAddButtons(selection, board) {
|
|
|
48575
48579
|
const adjustment = baseAdjustments[index2];
|
|
48576
48580
|
const newItemData = { ...itemData };
|
|
48577
48581
|
if (newItemData.transformation) {
|
|
48578
|
-
newItemData.transformation.translateX = adjustment.translateX +
|
|
48579
|
-
newItemData.transformation.translateY = adjustment.translateY +
|
|
48582
|
+
newItemData.transformation.translateX = adjustment.translateX + selectedMatrix.translateX;
|
|
48583
|
+
newItemData.transformation.translateY = adjustment.translateY + selectedMatrix.translateY + height3 / 2 - newHeight / 2;
|
|
48580
48584
|
}
|
|
48581
48585
|
const newMbr = new Mbr(newItemData.transformation?.translateX, newItemData.transformation?.translateY, (newItemData.transformation?.translateX || 0) + newWidth, (newItemData.transformation?.translateY || 0) + newHeight);
|
|
48582
48586
|
let step = 1;
|
|
@@ -48667,7 +48671,7 @@ function getQuickAddButtons(selection, board) {
|
|
|
48667
48671
|
}
|
|
48668
48672
|
function getQuickButtonsPositions(customMbr) {
|
|
48669
48673
|
const single = selection.items.getSingle();
|
|
48670
|
-
const itemMbr = customMbr ? customMbr : single?.getMbr();
|
|
48674
|
+
const itemMbr = customMbr ? customMbr : single instanceof BaseItem ? single.getWorldMbr() : single?.getMbr();
|
|
48671
48675
|
if (!itemMbr || single?.itemType !== "Sticker" && single?.itemType !== "Shape" && single?.itemType !== "AINode" && single?.itemType !== "RichText") {
|
|
48672
48676
|
return;
|
|
48673
48677
|
}
|
package/dist/esm/browser.js
CHANGED
|
@@ -40302,7 +40302,7 @@ var stickerColors = {
|
|
|
40302
40302
|
var width = 200;
|
|
40303
40303
|
var height = 200;
|
|
40304
40304
|
var StickerShape = {
|
|
40305
|
-
textBounds: new Mbr(
|
|
40305
|
+
textBounds: new Mbr(8, 8, width - 8, height - 8),
|
|
40306
40306
|
stickerPath: new Path([
|
|
40307
40307
|
new Line(new Point(0, 0), new Point(width, 0)),
|
|
40308
40308
|
new Line(new Point(width, 0), new Point(width, height)),
|
|
@@ -40543,16 +40543,19 @@ class Sticker extends BaseItem {
|
|
|
40543
40543
|
div.style.boxShadow = "0px 18px 24px rgba(20, 21, 26, 0.25), 0px 8px 8px rgba(20, 21, 26, 0.125)";
|
|
40544
40544
|
const autoScale = this.text.isAutosize() && this.text.getAutoSizeScale() || 1;
|
|
40545
40545
|
const textElement = this.text.renderHTML(documentFactory);
|
|
40546
|
-
const padding =
|
|
40546
|
+
const padding = 8;
|
|
40547
40547
|
textElement.id = `${this.getId()}_text`;
|
|
40548
40548
|
textElement.style.overflow = "auto";
|
|
40549
40549
|
positionRelatively(textElement, div, padding);
|
|
40550
40550
|
resetElementScale(textElement);
|
|
40551
40551
|
scaleElementBy(textElement, 1 / scaleX, 1 / scaleY);
|
|
40552
40552
|
scaleElementBy(textElement, autoScale, autoScale);
|
|
40553
|
-
|
|
40553
|
+
const maxAvailableWidth = unscaledWidth - 2 * padding;
|
|
40554
|
+
textElement.style.maxWidth = `${maxAvailableWidth * scaleX}px`;
|
|
40554
40555
|
if (autoScale < 1) {
|
|
40555
|
-
textElement.style.width = `${
|
|
40556
|
+
textElement.style.width = `${maxAvailableWidth * scaleX}px`;
|
|
40557
|
+
} else {
|
|
40558
|
+
textElement.style.width = "100%";
|
|
40556
40559
|
}
|
|
40557
40560
|
const textHeight = this.text.layoutNodes.height * autoScale;
|
|
40558
40561
|
if (textHeight < height2) {
|
|
@@ -45890,8 +45893,9 @@ function getQuickAddButtons(selection, board) {
|
|
|
45890
45893
|
let quickAddItems = undefined;
|
|
45891
45894
|
function calculateQuickAddPosition(index2, selectedItem, connectorStartPoint) {
|
|
45892
45895
|
const connectorStorage = new SessionStorage;
|
|
45893
|
-
const currMbr = selectedItem.getPathMbr();
|
|
45896
|
+
const currMbr = selectedItem instanceof BaseItem ? selectedItem.getWorldMbr() : selectedItem.getPathMbr();
|
|
45894
45897
|
const selectedItemData = selectedItem.serialize();
|
|
45898
|
+
const selectedMatrix = selectedItem instanceof BaseItem ? selectedItem.getWorldMatrix() : new Matrix(selectedItemData.transformation?.translateX || 0, selectedItemData.transformation?.translateY || 0);
|
|
45895
45899
|
const width2 = currMbr.getWidth();
|
|
45896
45900
|
const height3 = currMbr.getHeight();
|
|
45897
45901
|
let offsetX = width2;
|
|
@@ -45931,8 +45935,8 @@ function getQuickAddButtons(selection, board) {
|
|
|
45931
45935
|
const adjustment = baseAdjustments[index2];
|
|
45932
45936
|
const newItemData = { ...itemData };
|
|
45933
45937
|
if (newItemData.transformation) {
|
|
45934
|
-
newItemData.transformation.translateX = adjustment.translateX +
|
|
45935
|
-
newItemData.transformation.translateY = adjustment.translateY +
|
|
45938
|
+
newItemData.transformation.translateX = adjustment.translateX + selectedMatrix.translateX;
|
|
45939
|
+
newItemData.transformation.translateY = adjustment.translateY + selectedMatrix.translateY + height3 / 2 - newHeight / 2;
|
|
45936
45940
|
}
|
|
45937
45941
|
const newMbr = new Mbr(newItemData.transformation?.translateX, newItemData.transformation?.translateY, (newItemData.transformation?.translateX || 0) + newWidth, (newItemData.transformation?.translateY || 0) + newHeight);
|
|
45938
45942
|
let step = 1;
|
|
@@ -46023,7 +46027,7 @@ function getQuickAddButtons(selection, board) {
|
|
|
46023
46027
|
}
|
|
46024
46028
|
function getQuickButtonsPositions(customMbr) {
|
|
46025
46029
|
const single = selection.items.getSingle();
|
|
46026
|
-
const itemMbr = customMbr ? customMbr : single?.getMbr();
|
|
46030
|
+
const itemMbr = customMbr ? customMbr : single instanceof BaseItem ? single.getWorldMbr() : single?.getMbr();
|
|
46027
46031
|
if (!itemMbr || single?.itemType !== "Sticker" && single?.itemType !== "Shape" && single?.itemType !== "AINode" && single?.itemType !== "RichText") {
|
|
46028
46032
|
return;
|
|
46029
46033
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -40295,7 +40295,7 @@ var stickerColors = {
|
|
|
40295
40295
|
var width = 200;
|
|
40296
40296
|
var height = 200;
|
|
40297
40297
|
var StickerShape = {
|
|
40298
|
-
textBounds: new Mbr(
|
|
40298
|
+
textBounds: new Mbr(8, 8, width - 8, height - 8),
|
|
40299
40299
|
stickerPath: new Path([
|
|
40300
40300
|
new Line(new Point(0, 0), new Point(width, 0)),
|
|
40301
40301
|
new Line(new Point(width, 0), new Point(width, height)),
|
|
@@ -40536,16 +40536,19 @@ class Sticker extends BaseItem {
|
|
|
40536
40536
|
div.style.boxShadow = "0px 18px 24px rgba(20, 21, 26, 0.25), 0px 8px 8px rgba(20, 21, 26, 0.125)";
|
|
40537
40537
|
const autoScale = this.text.isAutosize() && this.text.getAutoSizeScale() || 1;
|
|
40538
40538
|
const textElement = this.text.renderHTML(documentFactory);
|
|
40539
|
-
const padding =
|
|
40539
|
+
const padding = 8;
|
|
40540
40540
|
textElement.id = `${this.getId()}_text`;
|
|
40541
40541
|
textElement.style.overflow = "auto";
|
|
40542
40542
|
positionRelatively(textElement, div, padding);
|
|
40543
40543
|
resetElementScale(textElement);
|
|
40544
40544
|
scaleElementBy(textElement, 1 / scaleX, 1 / scaleY);
|
|
40545
40545
|
scaleElementBy(textElement, autoScale, autoScale);
|
|
40546
|
-
|
|
40546
|
+
const maxAvailableWidth = unscaledWidth - 2 * padding;
|
|
40547
|
+
textElement.style.maxWidth = `${maxAvailableWidth * scaleX}px`;
|
|
40547
40548
|
if (autoScale < 1) {
|
|
40548
|
-
textElement.style.width = `${
|
|
40549
|
+
textElement.style.width = `${maxAvailableWidth * scaleX}px`;
|
|
40550
|
+
} else {
|
|
40551
|
+
textElement.style.width = "100%";
|
|
40549
40552
|
}
|
|
40550
40553
|
const textHeight = this.text.layoutNodes.height * autoScale;
|
|
40551
40554
|
if (textHeight < height2) {
|
|
@@ -45883,8 +45886,9 @@ function getQuickAddButtons(selection, board) {
|
|
|
45883
45886
|
let quickAddItems = undefined;
|
|
45884
45887
|
function calculateQuickAddPosition(index2, selectedItem, connectorStartPoint) {
|
|
45885
45888
|
const connectorStorage = new SessionStorage;
|
|
45886
|
-
const currMbr = selectedItem.getPathMbr();
|
|
45889
|
+
const currMbr = selectedItem instanceof BaseItem ? selectedItem.getWorldMbr() : selectedItem.getPathMbr();
|
|
45887
45890
|
const selectedItemData = selectedItem.serialize();
|
|
45891
|
+
const selectedMatrix = selectedItem instanceof BaseItem ? selectedItem.getWorldMatrix() : new Matrix(selectedItemData.transformation?.translateX || 0, selectedItemData.transformation?.translateY || 0);
|
|
45888
45892
|
const width2 = currMbr.getWidth();
|
|
45889
45893
|
const height3 = currMbr.getHeight();
|
|
45890
45894
|
let offsetX = width2;
|
|
@@ -45924,8 +45928,8 @@ function getQuickAddButtons(selection, board) {
|
|
|
45924
45928
|
const adjustment = baseAdjustments[index2];
|
|
45925
45929
|
const newItemData = { ...itemData };
|
|
45926
45930
|
if (newItemData.transformation) {
|
|
45927
|
-
newItemData.transformation.translateX = adjustment.translateX +
|
|
45928
|
-
newItemData.transformation.translateY = adjustment.translateY +
|
|
45931
|
+
newItemData.transformation.translateX = adjustment.translateX + selectedMatrix.translateX;
|
|
45932
|
+
newItemData.transformation.translateY = adjustment.translateY + selectedMatrix.translateY + height3 / 2 - newHeight / 2;
|
|
45929
45933
|
}
|
|
45930
45934
|
const newMbr = new Mbr(newItemData.transformation?.translateX, newItemData.transformation?.translateY, (newItemData.transformation?.translateX || 0) + newWidth, (newItemData.transformation?.translateY || 0) + newHeight);
|
|
45931
45935
|
let step = 1;
|
|
@@ -46016,7 +46020,7 @@ function getQuickAddButtons(selection, board) {
|
|
|
46016
46020
|
}
|
|
46017
46021
|
function getQuickButtonsPositions(customMbr) {
|
|
46018
46022
|
const single = selection.items.getSingle();
|
|
46019
|
-
const itemMbr = customMbr ? customMbr : single?.getMbr();
|
|
46023
|
+
const itemMbr = customMbr ? customMbr : single instanceof BaseItem ? single.getWorldMbr() : single?.getMbr();
|
|
46020
46024
|
if (!itemMbr || single?.itemType !== "Sticker" && single?.itemType !== "Shape" && single?.itemType !== "AINode" && single?.itemType !== "RichText") {
|
|
46021
46025
|
return;
|
|
46022
46026
|
}
|
package/dist/esm/node.js
CHANGED
|
@@ -42763,7 +42763,7 @@ var stickerColors = {
|
|
|
42763
42763
|
var width = 200;
|
|
42764
42764
|
var height = 200;
|
|
42765
42765
|
var StickerShape = {
|
|
42766
|
-
textBounds: new Mbr(
|
|
42766
|
+
textBounds: new Mbr(8, 8, width - 8, height - 8),
|
|
42767
42767
|
stickerPath: new Path([
|
|
42768
42768
|
new Line(new Point(0, 0), new Point(width, 0)),
|
|
42769
42769
|
new Line(new Point(width, 0), new Point(width, height)),
|
|
@@ -43004,16 +43004,19 @@ class Sticker extends BaseItem {
|
|
|
43004
43004
|
div.style.boxShadow = "0px 18px 24px rgba(20, 21, 26, 0.25), 0px 8px 8px rgba(20, 21, 26, 0.125)";
|
|
43005
43005
|
const autoScale = this.text.isAutosize() && this.text.getAutoSizeScale() || 1;
|
|
43006
43006
|
const textElement = this.text.renderHTML(documentFactory);
|
|
43007
|
-
const padding =
|
|
43007
|
+
const padding = 8;
|
|
43008
43008
|
textElement.id = `${this.getId()}_text`;
|
|
43009
43009
|
textElement.style.overflow = "auto";
|
|
43010
43010
|
positionRelatively(textElement, div, padding);
|
|
43011
43011
|
resetElementScale(textElement);
|
|
43012
43012
|
scaleElementBy(textElement, 1 / scaleX, 1 / scaleY);
|
|
43013
43013
|
scaleElementBy(textElement, autoScale, autoScale);
|
|
43014
|
-
|
|
43014
|
+
const maxAvailableWidth = unscaledWidth - 2 * padding;
|
|
43015
|
+
textElement.style.maxWidth = `${maxAvailableWidth * scaleX}px`;
|
|
43015
43016
|
if (autoScale < 1) {
|
|
43016
|
-
textElement.style.width = `${
|
|
43017
|
+
textElement.style.width = `${maxAvailableWidth * scaleX}px`;
|
|
43018
|
+
} else {
|
|
43019
|
+
textElement.style.width = "100%";
|
|
43017
43020
|
}
|
|
43018
43021
|
const textHeight = this.text.layoutNodes.height * autoScale;
|
|
43019
43022
|
if (textHeight < height2) {
|
|
@@ -48351,8 +48354,9 @@ function getQuickAddButtons(selection, board) {
|
|
|
48351
48354
|
let quickAddItems = undefined;
|
|
48352
48355
|
function calculateQuickAddPosition(index2, selectedItem, connectorStartPoint) {
|
|
48353
48356
|
const connectorStorage = new SessionStorage;
|
|
48354
|
-
const currMbr = selectedItem.getPathMbr();
|
|
48357
|
+
const currMbr = selectedItem instanceof BaseItem ? selectedItem.getWorldMbr() : selectedItem.getPathMbr();
|
|
48355
48358
|
const selectedItemData = selectedItem.serialize();
|
|
48359
|
+
const selectedMatrix = selectedItem instanceof BaseItem ? selectedItem.getWorldMatrix() : new Matrix(selectedItemData.transformation?.translateX || 0, selectedItemData.transformation?.translateY || 0);
|
|
48356
48360
|
const width2 = currMbr.getWidth();
|
|
48357
48361
|
const height3 = currMbr.getHeight();
|
|
48358
48362
|
let offsetX = width2;
|
|
@@ -48392,8 +48396,8 @@ function getQuickAddButtons(selection, board) {
|
|
|
48392
48396
|
const adjustment = baseAdjustments[index2];
|
|
48393
48397
|
const newItemData = { ...itemData };
|
|
48394
48398
|
if (newItemData.transformation) {
|
|
48395
|
-
newItemData.transformation.translateX = adjustment.translateX +
|
|
48396
|
-
newItemData.transformation.translateY = adjustment.translateY +
|
|
48399
|
+
newItemData.transformation.translateX = adjustment.translateX + selectedMatrix.translateX;
|
|
48400
|
+
newItemData.transformation.translateY = adjustment.translateY + selectedMatrix.translateY + height3 / 2 - newHeight / 2;
|
|
48397
48401
|
}
|
|
48398
48402
|
const newMbr = new Mbr(newItemData.transformation?.translateX, newItemData.transformation?.translateY, (newItemData.transformation?.translateX || 0) + newWidth, (newItemData.transformation?.translateY || 0) + newHeight);
|
|
48399
48403
|
let step = 1;
|
|
@@ -48484,7 +48488,7 @@ function getQuickAddButtons(selection, board) {
|
|
|
48484
48488
|
}
|
|
48485
48489
|
function getQuickButtonsPositions(customMbr) {
|
|
48486
48490
|
const single = selection.items.getSingle();
|
|
48487
|
-
const itemMbr = customMbr ? customMbr : single?.getMbr();
|
|
48491
|
+
const itemMbr = customMbr ? customMbr : single instanceof BaseItem ? single.getWorldMbr() : single?.getMbr();
|
|
48488
48492
|
if (!itemMbr || single?.itemType !== "Sticker" && single?.itemType !== "Shape" && single?.itemType !== "AINode" && single?.itemType !== "RichText") {
|
|
48489
48493
|
return;
|
|
48490
48494
|
}
|