@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.js
CHANGED
|
@@ -4073,12 +4073,11 @@ var LeaferUI = (function (exports) {
|
|
|
4073
4073
|
if (defaultValue === undefined) {
|
|
4074
4074
|
property.get = function () { return this[computedKey]; };
|
|
4075
4075
|
}
|
|
4076
|
-
else if (typeof defaultValue === '
|
|
4077
|
-
const { clone } = DataHelper;
|
|
4076
|
+
else if (typeof defaultValue === 'function') {
|
|
4078
4077
|
property.get = function () {
|
|
4079
4078
|
let v = this[computedKey];
|
|
4080
4079
|
if (v === undefined)
|
|
4081
|
-
this[computedKey] = v =
|
|
4080
|
+
this[computedKey] = v = defaultValue(this.__leaf);
|
|
4082
4081
|
return v;
|
|
4083
4082
|
};
|
|
4084
4083
|
}
|
|
@@ -5725,10 +5724,10 @@ var LeaferUI = (function (exports) {
|
|
|
5725
5724
|
static changeAttr(attrName, defaultValue, fn) {
|
|
5726
5725
|
fn ? this.addAttr(attrName, defaultValue, fn) : defineDataProcessor(this.prototype, attrName, defaultValue);
|
|
5727
5726
|
}
|
|
5728
|
-
static addAttr(attrName, defaultValue, fn) {
|
|
5727
|
+
static addAttr(attrName, defaultValue, fn, helpValue) {
|
|
5729
5728
|
if (!fn)
|
|
5730
5729
|
fn = boundsType;
|
|
5731
|
-
fn(defaultValue)(this.prototype, attrName);
|
|
5730
|
+
fn(defaultValue, helpValue)(this.prototype, attrName);
|
|
5732
5731
|
}
|
|
5733
5732
|
__emitLifeEvent(type) {
|
|
5734
5733
|
if (this.hasEvent(type))
|
|
@@ -6055,7 +6054,7 @@ var LeaferUI = (function (exports) {
|
|
|
6055
6054
|
}
|
|
6056
6055
|
}
|
|
6057
6056
|
|
|
6058
|
-
const version = "1.
|
|
6057
|
+
const version = "1.5.0";
|
|
6059
6058
|
|
|
6060
6059
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6061
6060
|
get allowBackgroundColor() { return true; }
|
|
@@ -6942,7 +6941,11 @@ var LeaferUI = (function (exports) {
|
|
|
6942
6941
|
setStyleName() { return Plugin.need('state'); },
|
|
6943
6942
|
set() { return Plugin.need('state'); }
|
|
6944
6943
|
};
|
|
6945
|
-
const Transition = {
|
|
6944
|
+
const Transition = {
|
|
6945
|
+
list: {},
|
|
6946
|
+
register(attrName, fn) { Transition.list[attrName] = fn; },
|
|
6947
|
+
get(attrName) { return Transition.list[attrName]; }
|
|
6948
|
+
};
|
|
6946
6949
|
|
|
6947
6950
|
const { parse, objectToCanvasData } = PathConvert;
|
|
6948
6951
|
const emptyPaint = {};
|
|
@@ -7366,9 +7369,6 @@ var LeaferUI = (function (exports) {
|
|
|
7366
7369
|
this.__drawPathByBox(pen);
|
|
7367
7370
|
return pen;
|
|
7368
7371
|
}
|
|
7369
|
-
get editConfig() { return undefined; }
|
|
7370
|
-
get editOuter() { return ''; }
|
|
7371
|
-
get editInner() { return ''; }
|
|
7372
7372
|
constructor(data) {
|
|
7373
7373
|
super(data);
|
|
7374
7374
|
}
|
|
@@ -7450,8 +7450,11 @@ var LeaferUI = (function (exports) {
|
|
|
7450
7450
|
export(_filename, _options) {
|
|
7451
7451
|
return Plugin.need('export');
|
|
7452
7452
|
}
|
|
7453
|
+
syncExport(_filename, _options) {
|
|
7454
|
+
return Plugin.need('export');
|
|
7455
|
+
}
|
|
7453
7456
|
clone(data) {
|
|
7454
|
-
const json = this.toJSON();
|
|
7457
|
+
const json = DataHelper.clone(this.toJSON());
|
|
7455
7458
|
if (data)
|
|
7456
7459
|
Object.assign(json, data);
|
|
7457
7460
|
return UI_1.one(json);
|
|
@@ -7750,7 +7753,7 @@ var LeaferUI = (function (exports) {
|
|
|
7750
7753
|
get layoutLocked() { return !this.layouter.running; }
|
|
7751
7754
|
get FPS() { return this.renderer ? this.renderer.FPS : 60; }
|
|
7752
7755
|
get cursorPoint() { return (this.interaction && this.interaction.hoverData) || { x: this.width / 2, y: this.height / 2 }; }
|
|
7753
|
-
get clientBounds() { return this.canvas && this.canvas.getClientBounds(); }
|
|
7756
|
+
get clientBounds() { return (this.canvas && this.canvas.getClientBounds(true)) || getBoundsData(); }
|
|
7754
7757
|
constructor(userConfig, data) {
|
|
7755
7758
|
super(data);
|
|
7756
7759
|
this.config = {
|
|
@@ -8052,6 +8055,10 @@ var LeaferUI = (function (exports) {
|
|
|
8052
8055
|
getPagePointByClient(clientPoint, updateClient) {
|
|
8053
8056
|
return this.getPagePoint(this.getWorldPointByClient(clientPoint, updateClient));
|
|
8054
8057
|
}
|
|
8058
|
+
getClientPointByWorld(worldPoint) {
|
|
8059
|
+
const { x, y } = this.clientBounds;
|
|
8060
|
+
return { x: x + worldPoint.x, y: y + worldPoint.y };
|
|
8061
|
+
}
|
|
8055
8062
|
updateClientBounds() {
|
|
8056
8063
|
this.canvas && this.canvas.updateClientBounds();
|
|
8057
8064
|
}
|
|
@@ -10020,8 +10027,6 @@ var LeaferUI = (function (exports) {
|
|
|
10020
10027
|
h.setStrokeOptions(data);
|
|
10021
10028
|
};
|
|
10022
10029
|
ui$1.__hit = function (inner) {
|
|
10023
|
-
if (Platform.name === 'miniapp')
|
|
10024
|
-
this.__drawHitPath(this.__hitCanvas);
|
|
10025
10030
|
const data = this.__;
|
|
10026
10031
|
if (data.__isHitPixel && this.__hitPixel(inner))
|
|
10027
10032
|
return true;
|
|
@@ -11376,13 +11381,14 @@ var LeaferUI = (function (exports) {
|
|
|
11376
11381
|
}
|
|
11377
11382
|
|
|
11378
11383
|
function layoutText(drawData, style) {
|
|
11379
|
-
const { rows, bounds } = drawData;
|
|
11384
|
+
const { rows, bounds } = drawData, countRows = rows.length;
|
|
11380
11385
|
const { __lineHeight, __baseLine, __letterSpacing, __clipText, textAlign, verticalAlign, paraSpacing, autoSizeAlign } = style;
|
|
11381
|
-
let { x, y, width, height } = bounds, realHeight = __lineHeight *
|
|
11386
|
+
let { x, y, width, height } = bounds, realHeight = __lineHeight * countRows + (paraSpacing ? paraSpacing * (drawData.paraNumber - 1) : 0);
|
|
11382
11387
|
let starY = __baseLine;
|
|
11383
11388
|
if (__clipText && realHeight > height) {
|
|
11384
11389
|
realHeight = Math.max(height, __lineHeight);
|
|
11385
|
-
|
|
11390
|
+
if (countRows > 1)
|
|
11391
|
+
drawData.overflow = countRows;
|
|
11386
11392
|
}
|
|
11387
11393
|
else if (height || autoSizeAlign) {
|
|
11388
11394
|
switch (verticalAlign) {
|
|
@@ -11394,7 +11400,7 @@ var LeaferUI = (function (exports) {
|
|
|
11394
11400
|
}
|
|
11395
11401
|
starY += y;
|
|
11396
11402
|
let row, rowX, rowWidth, layoutWidth = (width || autoSizeAlign) ? width : drawData.maxWidth;
|
|
11397
|
-
for (let i = 0, len =
|
|
11403
|
+
for (let i = 0, len = countRows; i < len; i++) {
|
|
11398
11404
|
row = rows[i];
|
|
11399
11405
|
row.x = x;
|
|
11400
11406
|
if (row.width < width || (row.width > width && !__clipText)) {
|
|
@@ -11463,7 +11469,7 @@ var LeaferUI = (function (exports) {
|
|
|
11463
11469
|
if (i === end && charRight < right) {
|
|
11464
11470
|
break;
|
|
11465
11471
|
}
|
|
11466
|
-
else if (charRight < right && char.char !== ' ') {
|
|
11472
|
+
else if ((charRight < right && char.char !== ' ') || !i) {
|
|
11467
11473
|
row.data.splice(i + 1);
|
|
11468
11474
|
row.width -= char.width;
|
|
11469
11475
|
break;
|