@leafer-ui/worker 1.4.2 → 1.5.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 +6 -5
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.esm.js +6 -5
- package/dist/worker.esm.js.map +1 -1
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.esm.min.js.map +1 -1
- package/dist/worker.js +25 -19
- package/dist/worker.js.map +1 -1
- 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 +25 -19
- package/dist/worker.module.js.map +1 -1
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +10 -10
package/dist/worker.module.js
CHANGED
|
@@ -4070,12 +4070,11 @@ function defineDataProcessor(target, key, defaultValue) {
|
|
|
4070
4070
|
if (defaultValue === undefined) {
|
|
4071
4071
|
property.get = function () { return this[computedKey]; };
|
|
4072
4072
|
}
|
|
4073
|
-
else if (typeof defaultValue === '
|
|
4074
|
-
const { clone } = DataHelper;
|
|
4073
|
+
else if (typeof defaultValue === 'function') {
|
|
4075
4074
|
property.get = function () {
|
|
4076
4075
|
let v = this[computedKey];
|
|
4077
4076
|
if (v === undefined)
|
|
4078
|
-
this[computedKey] = v =
|
|
4077
|
+
this[computedKey] = v = defaultValue(this.__leaf);
|
|
4079
4078
|
return v;
|
|
4080
4079
|
};
|
|
4081
4080
|
}
|
|
@@ -5722,10 +5721,10 @@ let Leaf = class Leaf {
|
|
|
5722
5721
|
static changeAttr(attrName, defaultValue, fn) {
|
|
5723
5722
|
fn ? this.addAttr(attrName, defaultValue, fn) : defineDataProcessor(this.prototype, attrName, defaultValue);
|
|
5724
5723
|
}
|
|
5725
|
-
static addAttr(attrName, defaultValue, fn) {
|
|
5724
|
+
static addAttr(attrName, defaultValue, fn, helpValue) {
|
|
5726
5725
|
if (!fn)
|
|
5727
5726
|
fn = boundsType;
|
|
5728
|
-
fn(defaultValue)(this.prototype, attrName);
|
|
5727
|
+
fn(defaultValue, helpValue)(this.prototype, attrName);
|
|
5729
5728
|
}
|
|
5730
5729
|
__emitLifeEvent(type) {
|
|
5731
5730
|
if (this.hasEvent(type))
|
|
@@ -6052,7 +6051,7 @@ class LeafLevelList {
|
|
|
6052
6051
|
}
|
|
6053
6052
|
}
|
|
6054
6053
|
|
|
6055
|
-
const version = "1.
|
|
6054
|
+
const version = "1.5.0";
|
|
6056
6055
|
|
|
6057
6056
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6058
6057
|
get allowBackgroundColor() { return true; }
|
|
@@ -6939,7 +6938,11 @@ const State = {
|
|
|
6939
6938
|
setStyleName() { return Plugin.need('state'); },
|
|
6940
6939
|
set() { return Plugin.need('state'); }
|
|
6941
6940
|
};
|
|
6942
|
-
const Transition = {
|
|
6941
|
+
const Transition = {
|
|
6942
|
+
list: {},
|
|
6943
|
+
register(attrName, fn) { Transition.list[attrName] = fn; },
|
|
6944
|
+
get(attrName) { return Transition.list[attrName]; }
|
|
6945
|
+
};
|
|
6943
6946
|
|
|
6944
6947
|
const { parse, objectToCanvasData } = PathConvert;
|
|
6945
6948
|
const emptyPaint = {};
|
|
@@ -7363,9 +7366,6 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
7363
7366
|
this.__drawPathByBox(pen);
|
|
7364
7367
|
return pen;
|
|
7365
7368
|
}
|
|
7366
|
-
get editConfig() { return undefined; }
|
|
7367
|
-
get editOuter() { return ''; }
|
|
7368
|
-
get editInner() { return ''; }
|
|
7369
7369
|
constructor(data) {
|
|
7370
7370
|
super(data);
|
|
7371
7371
|
}
|
|
@@ -7447,8 +7447,11 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
7447
7447
|
export(_filename, _options) {
|
|
7448
7448
|
return Plugin.need('export');
|
|
7449
7449
|
}
|
|
7450
|
+
syncExport(_filename, _options) {
|
|
7451
|
+
return Plugin.need('export');
|
|
7452
|
+
}
|
|
7450
7453
|
clone(data) {
|
|
7451
|
-
const json = this.toJSON();
|
|
7454
|
+
const json = DataHelper.clone(this.toJSON());
|
|
7452
7455
|
if (data)
|
|
7453
7456
|
Object.assign(json, data);
|
|
7454
7457
|
return UI_1.one(json);
|
|
@@ -7747,7 +7750,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
7747
7750
|
get layoutLocked() { return !this.layouter.running; }
|
|
7748
7751
|
get FPS() { return this.renderer ? this.renderer.FPS : 60; }
|
|
7749
7752
|
get cursorPoint() { return (this.interaction && this.interaction.hoverData) || { x: this.width / 2, y: this.height / 2 }; }
|
|
7750
|
-
get clientBounds() { return this.canvas && this.canvas.getClientBounds(); }
|
|
7753
|
+
get clientBounds() { return (this.canvas && this.canvas.getClientBounds(true)) || getBoundsData(); }
|
|
7751
7754
|
constructor(userConfig, data) {
|
|
7752
7755
|
super(data);
|
|
7753
7756
|
this.config = {
|
|
@@ -8049,6 +8052,10 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8049
8052
|
getPagePointByClient(clientPoint, updateClient) {
|
|
8050
8053
|
return this.getPagePoint(this.getWorldPointByClient(clientPoint, updateClient));
|
|
8051
8054
|
}
|
|
8055
|
+
getClientPointByWorld(worldPoint) {
|
|
8056
|
+
const { x, y } = this.clientBounds;
|
|
8057
|
+
return { x: x + worldPoint.x, y: y + worldPoint.y };
|
|
8058
|
+
}
|
|
8052
8059
|
updateClientBounds() {
|
|
8053
8060
|
this.canvas && this.canvas.updateClientBounds();
|
|
8054
8061
|
}
|
|
@@ -10017,8 +10024,6 @@ ui$1.__updateHitCanvas = function () {
|
|
|
10017
10024
|
h.setStrokeOptions(data);
|
|
10018
10025
|
};
|
|
10019
10026
|
ui$1.__hit = function (inner) {
|
|
10020
|
-
if (Platform.name === 'miniapp')
|
|
10021
|
-
this.__drawHitPath(this.__hitCanvas);
|
|
10022
10027
|
const data = this.__;
|
|
10023
10028
|
if (data.__isHitPixel && this.__hitPixel(inner))
|
|
10024
10029
|
return true;
|
|
@@ -11373,13 +11378,14 @@ function toChar(data, charX, rowData, isOverflow) {
|
|
|
11373
11378
|
}
|
|
11374
11379
|
|
|
11375
11380
|
function layoutText(drawData, style) {
|
|
11376
|
-
const { rows, bounds } = drawData;
|
|
11381
|
+
const { rows, bounds } = drawData, countRows = rows.length;
|
|
11377
11382
|
const { __lineHeight, __baseLine, __letterSpacing, __clipText, textAlign, verticalAlign, paraSpacing, autoSizeAlign } = style;
|
|
11378
|
-
let { x, y, width, height } = bounds, realHeight = __lineHeight *
|
|
11383
|
+
let { x, y, width, height } = bounds, realHeight = __lineHeight * countRows + (paraSpacing ? paraSpacing * (drawData.paraNumber - 1) : 0);
|
|
11379
11384
|
let starY = __baseLine;
|
|
11380
11385
|
if (__clipText && realHeight > height) {
|
|
11381
11386
|
realHeight = Math.max(height, __lineHeight);
|
|
11382
|
-
|
|
11387
|
+
if (countRows > 1)
|
|
11388
|
+
drawData.overflow = countRows;
|
|
11383
11389
|
}
|
|
11384
11390
|
else if (height || autoSizeAlign) {
|
|
11385
11391
|
switch (verticalAlign) {
|
|
@@ -11391,7 +11397,7 @@ function layoutText(drawData, style) {
|
|
|
11391
11397
|
}
|
|
11392
11398
|
starY += y;
|
|
11393
11399
|
let row, rowX, rowWidth, layoutWidth = (width || autoSizeAlign) ? width : drawData.maxWidth;
|
|
11394
|
-
for (let i = 0, len =
|
|
11400
|
+
for (let i = 0, len = countRows; i < len; i++) {
|
|
11395
11401
|
row = rows[i];
|
|
11396
11402
|
row.x = x;
|
|
11397
11403
|
if (row.width < width || (row.width > width && !__clipText)) {
|
|
@@ -11460,7 +11466,7 @@ function clipText(drawData, style, x, width) {
|
|
|
11460
11466
|
if (i === end && charRight < right) {
|
|
11461
11467
|
break;
|
|
11462
11468
|
}
|
|
11463
|
-
else if (charRight < right && char.char !== ' ') {
|
|
11469
|
+
else if ((charRight < right && char.char !== ' ') || !i) {
|
|
11464
11470
|
row.data.splice(i + 1);
|
|
11465
11471
|
row.width -= char.width;
|
|
11466
11472
|
break;
|