@leafer-draw/worker 2.1.11 → 2.2.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.
- package/dist/worker.cjs +9 -4
- package/dist/worker.esm.js +22 -17
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.esm.min.js.map +1 -1
- package/dist/worker.js +15 -7
- package/dist/worker.min.cjs +1 -1
- package/dist/worker.min.cjs.map +1 -1
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +15 -7
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +7 -7
package/dist/worker.module.js
CHANGED
|
@@ -856,6 +856,11 @@ const PointHelper = {
|
|
|
856
856
|
toOuterOf(t, matrix, to) {
|
|
857
857
|
toOuterPoint$3(matrix, t, to);
|
|
858
858
|
},
|
|
859
|
+
toVertical(t, rotation, verticalDistance, to) {
|
|
860
|
+
const r = rotation * OneRadian;
|
|
861
|
+
t.x += -Math.sin(r) * verticalDistance;
|
|
862
|
+
t.y += Math.cos(r) * verticalDistance;
|
|
863
|
+
},
|
|
859
864
|
getCenter(t, to) {
|
|
860
865
|
return {
|
|
861
866
|
x: t.x + (to.x - t.x) / 2,
|
|
@@ -6985,7 +6990,7 @@ class LeafLevelList {
|
|
|
6985
6990
|
}
|
|
6986
6991
|
}
|
|
6987
6992
|
|
|
6988
|
-
const version = "2.
|
|
6993
|
+
const version = "2.2.0";
|
|
6989
6994
|
|
|
6990
6995
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6991
6996
|
get allowBackgroundColor() {
|
|
@@ -9429,7 +9434,7 @@ let Text = class Text extends UI {
|
|
|
9429
9434
|
data.__font = `${italic ? "italic " : ""}${textCase === "small-caps" ? "small-caps " : ""}${fontWeight !== "normal" ? fontWeight + " " : ""}${fontSize || 12}px ${fontFamily || "caption"}`;
|
|
9430
9435
|
stintSet$1(data, "__padding", padding && MathHelper.fourNumber(padding));
|
|
9431
9436
|
stintSet$1(data, "__clipText", textOverflow !== "show" && !data.__autoSize);
|
|
9432
|
-
stintSet$1(data, "__isCharMode", width || height || data.__letterSpacing || textCase !== "none");
|
|
9437
|
+
stintSet$1(data, "__isCharMode", width || height || data.__letterSpacing || data.motionText || textCase !== "none");
|
|
9433
9438
|
data.__textDrawData = TextConvert.getDrawData((data.__isPlacehold = data.placeholder && data.text === "") ? data.placeholder : data.text, this.__);
|
|
9434
9439
|
}
|
|
9435
9440
|
__updateBoxBounds() {
|
|
@@ -9454,7 +9459,7 @@ let Text = class Text extends UI {
|
|
|
9454
9459
|
this.__updateNaturalSize();
|
|
9455
9460
|
} else super.__updateBoxBounds();
|
|
9456
9461
|
if (italic) b.width += fontSize * .16;
|
|
9457
|
-
DataHelper.stintSet(this, "isOverflow", !includes(b, contentBounds));
|
|
9462
|
+
DataHelper.stintSet(this, "isOverflow", !includes(b, contentBounds) && !data.motionText);
|
|
9458
9463
|
if (this.isOverflow) setList(data.__textBoxBounds = {}, [ b, contentBounds ]), layout.renderChanged = true; else data.__textBoxBounds = b;
|
|
9459
9464
|
}
|
|
9460
9465
|
__updateRenderSpread() {
|
|
@@ -9639,7 +9644,8 @@ function fillPathOrText(ui, canvas, renderOptions) {
|
|
|
9639
9644
|
ui.__.__font ? Paint.fillText(ui, canvas, renderOptions) : ui.__.windingRule ? canvas.fill(ui.__.windingRule) : canvas.fill();
|
|
9640
9645
|
}
|
|
9641
9646
|
|
|
9642
|
-
function fillText(ui, canvas,
|
|
9647
|
+
function fillText(ui, canvas, renderOptions) {
|
|
9648
|
+
if (ui.motionText) return Paint.fillMotionText(ui, canvas, renderOptions);
|
|
9643
9649
|
const data = ui.__, {rows: rows, decorationY: decorationY} = data.__textDrawData;
|
|
9644
9650
|
if (data.__isPlacehold && data.placeholderColor) canvas.fillStyle = data.placeholderColor;
|
|
9645
9651
|
let row;
|
|
@@ -11001,7 +11007,8 @@ const TextMode = 2;
|
|
|
11001
11007
|
|
|
11002
11008
|
function layoutChar(drawData, style, width, _height) {
|
|
11003
11009
|
const {rows: rows} = drawData;
|
|
11004
|
-
const {textAlign: textAlign, paraIndent: paraIndent
|
|
11010
|
+
const {textAlign: textAlign, paraIndent: paraIndent} = style;
|
|
11011
|
+
const useLetter = style.__letterSpacing || style.motionText;
|
|
11005
11012
|
const justifyLast = width && textAlign.includes("both");
|
|
11006
11013
|
const justify = justifyLast || width && textAlign.includes("justify");
|
|
11007
11014
|
const justifyLetter = justify && textAlign.includes("letter");
|
|
@@ -11014,8 +11021,8 @@ function layoutChar(drawData, style, width, _height) {
|
|
|
11014
11021
|
remainingWidth = width - row.width - indentWidth;
|
|
11015
11022
|
if (justifyLetter) addLetterWidth = remainingWidth / (row.words.reduce((total, item) => total + item.data.length, 0) - 1); else addWordWidth = wordsLength > 1 ? remainingWidth / (wordsLength - 1) : 0;
|
|
11016
11023
|
}
|
|
11017
|
-
mode =
|
|
11018
|
-
if (row.isOverflow && !
|
|
11024
|
+
mode = useLetter || row.isOverflow || justifyLetter ? CharMode : addWordWidth ? WordMode : TextMode;
|
|
11025
|
+
if (row.isOverflow && !useLetter) row.textMode = true;
|
|
11019
11026
|
if (mode === TextMode) {
|
|
11020
11027
|
row.x += indentWidth;
|
|
11021
11028
|
toTextChar$1(row);
|
|
@@ -11216,6 +11223,7 @@ function getDrawData(content, style) {
|
|
|
11216
11223
|
let width = style.__getInput("width") || 0;
|
|
11217
11224
|
let height = style.__getInput("height") || 0;
|
|
11218
11225
|
const {__padding: padding} = style;
|
|
11226
|
+
if (style.motionText) width = height = 0;
|
|
11219
11227
|
if (padding) {
|
|
11220
11228
|
if (width) x = padding[left], width -= padding[right] + padding[left], !width && (width = .01); else if (!style.autoSizeAlign) x = padding[left];
|
|
11221
11229
|
if (height) y = padding[top], height -= padding[top] + padding[bottom], !height && (height = .01); else if (!style.autoSizeAlign) y = padding[top];
|