leafer-draw 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/web.cjs +8 -5
- package/dist/web.esm.js +8 -5
- package/dist/web.esm.min.js +1 -1
- package/dist/web.js +25 -11
- package/dist/web.min.cjs +1 -1
- package/dist/web.min.js +1 -1
- package/dist/web.module.js +25 -11
- package/dist/web.module.min.js +1 -1
- package/package.json +2 -2
package/dist/web.module.js
CHANGED
|
@@ -6007,7 +6007,7 @@ class LeafLevelList {
|
|
|
6007
6007
|
}
|
|
6008
6008
|
}
|
|
6009
6009
|
|
|
6010
|
-
const version = "1.3.
|
|
6010
|
+
const version = "1.3.2";
|
|
6011
6011
|
|
|
6012
6012
|
const debug$4 = Debug.get('LeaferCanvas');
|
|
6013
6013
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
@@ -6226,7 +6226,7 @@ function useCanvas(_canvasType, _power) {
|
|
|
6226
6226
|
},
|
|
6227
6227
|
loadImage(src) {
|
|
6228
6228
|
return new Promise((resolve, reject) => {
|
|
6229
|
-
const img = new Image();
|
|
6229
|
+
const img = new Platform.origin.Image();
|
|
6230
6230
|
const { crossOrigin } = Platform.image;
|
|
6231
6231
|
if (crossOrigin) {
|
|
6232
6232
|
img.setAttribute('crossOrigin', crossOrigin);
|
|
@@ -6236,7 +6236,10 @@ function useCanvas(_canvasType, _power) {
|
|
|
6236
6236
|
img.onerror = (e) => { reject(e); };
|
|
6237
6237
|
img.src = Platform.image.getRealURL(src);
|
|
6238
6238
|
});
|
|
6239
|
-
}
|
|
6239
|
+
},
|
|
6240
|
+
Image,
|
|
6241
|
+
PointerEvent,
|
|
6242
|
+
DragEvent
|
|
6240
6243
|
};
|
|
6241
6244
|
Platform.event = {
|
|
6242
6245
|
stopDefault(origin) { origin.preventDefault(); },
|
|
@@ -6712,7 +6715,7 @@ class Renderer {
|
|
|
6712
6715
|
partRender() {
|
|
6713
6716
|
const { canvas, updateBlocks: list } = this;
|
|
6714
6717
|
if (!list)
|
|
6715
|
-
return
|
|
6718
|
+
return;
|
|
6716
6719
|
this.mergeBlocks();
|
|
6717
6720
|
list.forEach(block => { if (canvas.bounds.hit(block) && !block.isEmpty())
|
|
6718
6721
|
this.clipRender(block); });
|
|
@@ -7412,7 +7415,7 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
7412
7415
|
animate(_keyframe, _options, _type, _isTemp) {
|
|
7413
7416
|
return Plugin.need('animate');
|
|
7414
7417
|
}
|
|
7415
|
-
killAnimate(_type,
|
|
7418
|
+
killAnimate(_type, _nextStyle) { }
|
|
7416
7419
|
export(_filename, _options) {
|
|
7417
7420
|
return Plugin.need('export');
|
|
7418
7421
|
}
|
|
@@ -7908,8 +7911,6 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
7908
7911
|
this.created = true;
|
|
7909
7912
|
}
|
|
7910
7913
|
__onReady() {
|
|
7911
|
-
if (this.ready)
|
|
7912
|
-
return;
|
|
7913
7914
|
this.ready = true;
|
|
7914
7915
|
this.emitLeafer(LeaferEvent.BEFORE_READY);
|
|
7915
7916
|
this.emitLeafer(LeaferEvent.READY);
|
|
@@ -7923,6 +7924,20 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
7923
7924
|
this.emitLeafer(LeaferEvent.VIEW_READY);
|
|
7924
7925
|
WaitHelper.run(this.__viewReadyWait);
|
|
7925
7926
|
}
|
|
7927
|
+
__onLayoutEnd() {
|
|
7928
|
+
const { grow, growWidth, growHeight } = this.config;
|
|
7929
|
+
if (grow) {
|
|
7930
|
+
let { width, height, pixelRatio } = this;
|
|
7931
|
+
const bounds = grow === 'box' ? this.worldBoxBounds : this.__world;
|
|
7932
|
+
if (growWidth !== false)
|
|
7933
|
+
width = Math.max(1, bounds.x + bounds.width);
|
|
7934
|
+
if (growHeight !== false)
|
|
7935
|
+
height = Math.max(1, bounds.y + bounds.height);
|
|
7936
|
+
this.__doResize({ width, height, pixelRatio });
|
|
7937
|
+
}
|
|
7938
|
+
if (!this.ready)
|
|
7939
|
+
this.__onReady();
|
|
7940
|
+
}
|
|
7926
7941
|
__onNextRender() {
|
|
7927
7942
|
if (this.viewReady) {
|
|
7928
7943
|
WaitHelper.run(this.__nextRenderWait);
|
|
@@ -8016,10 +8031,9 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8016
8031
|
const runId = Run.start('FirstCreate ' + this.innerName);
|
|
8017
8032
|
this.once(LeaferEvent.START, () => Run.end(runId));
|
|
8018
8033
|
this.once(LayoutEvent.START, () => this.updateLazyBounds());
|
|
8019
|
-
this.once(LayoutEvent.END, () => this.__onReady());
|
|
8020
8034
|
this.once(RenderEvent.START, () => this.__onCreated());
|
|
8021
8035
|
this.once(RenderEvent.END, () => this.__onViewReady());
|
|
8022
|
-
this.__eventIds.push(this.on_(WatchEvent.DATA, this.__onWatchData, this), this.on_(RenderEvent.NEXT, this.__onNextRender, this));
|
|
8036
|
+
this.__eventIds.push(this.on_(WatchEvent.DATA, this.__onWatchData, this), this.on_(LayoutEvent.END, this.__onLayoutEnd, this), this.on_(RenderEvent.NEXT, this.__onNextRender, this));
|
|
8023
8037
|
}
|
|
8024
8038
|
__removeListenEvents() {
|
|
8025
8039
|
this.off_(this.__eventIds);
|
|
@@ -9978,7 +9992,7 @@ function layoutChar(drawData, style, width, _height) {
|
|
|
9978
9992
|
rows.forEach(row => {
|
|
9979
9993
|
if (row.words) {
|
|
9980
9994
|
indentWidth = paraIndent && row.paraStart ? paraIndent : 0;
|
|
9981
|
-
addWordWidth = (width && textAlign === 'justify' && row.words.length > 1) ? (width - row.width - indentWidth) / (row.words.length - 1) : 0;
|
|
9995
|
+
addWordWidth = (width && (textAlign === 'justify' || textAlign === 'both') && row.words.length > 1) ? (width - row.width - indentWidth) / (row.words.length - 1) : 0;
|
|
9982
9996
|
mode = (letterSpacing || row.isOverflow) ? CharMode : (addWordWidth > 0.01 ? WordMode : TextMode);
|
|
9983
9997
|
if (row.isOverflow && !letterSpacing)
|
|
9984
9998
|
row.textMode = true;
|
|
@@ -10000,7 +10014,7 @@ function layoutChar(drawData, style, width, _height) {
|
|
|
10000
10014
|
else {
|
|
10001
10015
|
charX = toChar(word.data, charX, row.data, row.isOverflow);
|
|
10002
10016
|
}
|
|
10003
|
-
if (!row.paraEnd
|
|
10017
|
+
if (addWordWidth && (!row.paraEnd || textAlign === 'both')) {
|
|
10004
10018
|
charX += addWordWidth;
|
|
10005
10019
|
row.width += addWordWidth;
|
|
10006
10020
|
}
|