@leafer-editor/worker 1.3.1 → 1.3.2
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.js +23 -10
- package/dist/worker.min.js +1 -1
- package/dist/worker.module.js +23 -10
- package/dist/worker.module.min.js +1 -1
- package/package.json +15 -15
package/dist/worker.js
CHANGED
|
@@ -6010,7 +6010,7 @@ var LeaferUI = (function (exports) {
|
|
|
6010
6010
|
}
|
|
6011
6011
|
}
|
|
6012
6012
|
|
|
6013
|
-
const version = "1.3.
|
|
6013
|
+
const version = "1.3.2";
|
|
6014
6014
|
|
|
6015
6015
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6016
6016
|
get allowBackgroundColor() { return true; }
|
|
@@ -6542,7 +6542,7 @@ var LeaferUI = (function (exports) {
|
|
|
6542
6542
|
partRender() {
|
|
6543
6543
|
const { canvas, updateBlocks: list } = this;
|
|
6544
6544
|
if (!list)
|
|
6545
|
-
return
|
|
6545
|
+
return;
|
|
6546
6546
|
this.mergeBlocks();
|
|
6547
6547
|
list.forEach(block => { if (canvas.bounds.hit(block) && !block.isEmpty())
|
|
6548
6548
|
this.clipRender(block); });
|
|
@@ -7398,7 +7398,7 @@ var LeaferUI = (function (exports) {
|
|
|
7398
7398
|
animate(_keyframe, _options, _type, _isTemp) {
|
|
7399
7399
|
return Plugin.need('animate');
|
|
7400
7400
|
}
|
|
7401
|
-
killAnimate(_type,
|
|
7401
|
+
killAnimate(_type, _nextStyle) { }
|
|
7402
7402
|
export(_filename, _options) {
|
|
7403
7403
|
return Plugin.need('export');
|
|
7404
7404
|
}
|
|
@@ -7894,8 +7894,6 @@ var LeaferUI = (function (exports) {
|
|
|
7894
7894
|
this.created = true;
|
|
7895
7895
|
}
|
|
7896
7896
|
__onReady() {
|
|
7897
|
-
if (this.ready)
|
|
7898
|
-
return;
|
|
7899
7897
|
this.ready = true;
|
|
7900
7898
|
this.emitLeafer(LeaferEvent.BEFORE_READY);
|
|
7901
7899
|
this.emitLeafer(LeaferEvent.READY);
|
|
@@ -7909,6 +7907,20 @@ var LeaferUI = (function (exports) {
|
|
|
7909
7907
|
this.emitLeafer(LeaferEvent.VIEW_READY);
|
|
7910
7908
|
WaitHelper.run(this.__viewReadyWait);
|
|
7911
7909
|
}
|
|
7910
|
+
__onLayoutEnd() {
|
|
7911
|
+
const { grow, growWidth, growHeight } = this.config;
|
|
7912
|
+
if (grow) {
|
|
7913
|
+
let { width, height, pixelRatio } = this;
|
|
7914
|
+
const bounds = grow === 'box' ? this.worldBoxBounds : this.__world;
|
|
7915
|
+
if (growWidth !== false)
|
|
7916
|
+
width = Math.max(1, bounds.x + bounds.width);
|
|
7917
|
+
if (growHeight !== false)
|
|
7918
|
+
height = Math.max(1, bounds.y + bounds.height);
|
|
7919
|
+
this.__doResize({ width, height, pixelRatio });
|
|
7920
|
+
}
|
|
7921
|
+
if (!this.ready)
|
|
7922
|
+
this.__onReady();
|
|
7923
|
+
}
|
|
7912
7924
|
__onNextRender() {
|
|
7913
7925
|
if (this.viewReady) {
|
|
7914
7926
|
WaitHelper.run(this.__nextRenderWait);
|
|
@@ -8002,10 +8014,9 @@ var LeaferUI = (function (exports) {
|
|
|
8002
8014
|
const runId = Run.start('FirstCreate ' + this.innerName);
|
|
8003
8015
|
this.once(LeaferEvent.START, () => Run.end(runId));
|
|
8004
8016
|
this.once(LayoutEvent.START, () => this.updateLazyBounds());
|
|
8005
|
-
this.once(LayoutEvent.END, () => this.__onReady());
|
|
8006
8017
|
this.once(RenderEvent.START, () => this.__onCreated());
|
|
8007
8018
|
this.once(RenderEvent.END, () => this.__onViewReady());
|
|
8008
|
-
this.__eventIds.push(this.on_(WatchEvent.DATA, this.__onWatchData, this), this.on_(RenderEvent.NEXT, this.__onNextRender, this));
|
|
8019
|
+
this.__eventIds.push(this.on_(WatchEvent.DATA, this.__onWatchData, this), this.on_(LayoutEvent.END, this.__onLayoutEnd, this), this.on_(RenderEvent.NEXT, this.__onNextRender, this));
|
|
8009
8020
|
}
|
|
8010
8021
|
__removeListenEvents() {
|
|
8011
8022
|
this.off_(this.__eventIds);
|
|
@@ -11252,7 +11263,7 @@ var LeaferUI = (function (exports) {
|
|
|
11252
11263
|
rows.forEach(row => {
|
|
11253
11264
|
if (row.words) {
|
|
11254
11265
|
indentWidth = paraIndent && row.paraStart ? paraIndent : 0;
|
|
11255
|
-
addWordWidth = (width && textAlign === 'justify' && row.words.length > 1) ? (width - row.width - indentWidth) / (row.words.length - 1) : 0;
|
|
11266
|
+
addWordWidth = (width && (textAlign === 'justify' || textAlign === 'both') && row.words.length > 1) ? (width - row.width - indentWidth) / (row.words.length - 1) : 0;
|
|
11256
11267
|
mode = (letterSpacing || row.isOverflow) ? CharMode : (addWordWidth > 0.01 ? WordMode : TextMode);
|
|
11257
11268
|
if (row.isOverflow && !letterSpacing)
|
|
11258
11269
|
row.textMode = true;
|
|
@@ -11274,7 +11285,7 @@ var LeaferUI = (function (exports) {
|
|
|
11274
11285
|
else {
|
|
11275
11286
|
charX = toChar(word.data, charX, row.data, row.isOverflow);
|
|
11276
11287
|
}
|
|
11277
|
-
if (!row.paraEnd
|
|
11288
|
+
if (addWordWidth && (!row.paraEnd || textAlign === 'both')) {
|
|
11278
11289
|
charX += addWordWidth;
|
|
11279
11290
|
row.width += addWordWidth;
|
|
11280
11291
|
}
|
|
@@ -12414,6 +12425,8 @@ var LeaferUI = (function (exports) {
|
|
|
12414
12425
|
const { editor } = this;
|
|
12415
12426
|
if (editor.single) {
|
|
12416
12427
|
const { element } = editor;
|
|
12428
|
+
if (element.locked)
|
|
12429
|
+
return;
|
|
12417
12430
|
if (element.isBranch && !element.editInner) {
|
|
12418
12431
|
if (element.textBox) {
|
|
12419
12432
|
const { children } = element;
|
|
@@ -14789,7 +14802,7 @@ ${filterStyle}
|
|
|
14789
14802
|
style.fontWeight = text.fontWeight;
|
|
14790
14803
|
style.textDecoration = textDecoration === 'delete' ? 'line-through' : textDecoration;
|
|
14791
14804
|
style.textTransform = textCaseMap[text.textCase];
|
|
14792
|
-
style.textAlign = text.textAlign;
|
|
14805
|
+
style.textAlign = text.textAlign === 'both' ? 'justify' : text.textAlign;
|
|
14793
14806
|
style.display = 'flex';
|
|
14794
14807
|
style.flexDirection = 'column';
|
|
14795
14808
|
style.justifyContent = verticalAlignMap[text.verticalAlign];
|