@leafer-draw/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 -17
- 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 -17
- 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 +7 -7
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; }
|
|
@@ -6785,7 +6784,11 @@ var LeaferUI = (function (exports) {
|
|
|
6785
6784
|
setStyleName() { return Plugin.need('state'); },
|
|
6786
6785
|
set() { return Plugin.need('state'); }
|
|
6787
6786
|
};
|
|
6788
|
-
const Transition = {
|
|
6787
|
+
const Transition = {
|
|
6788
|
+
list: {},
|
|
6789
|
+
register(attrName, fn) { Transition.list[attrName] = fn; },
|
|
6790
|
+
get(attrName) { return Transition.list[attrName]; }
|
|
6791
|
+
};
|
|
6789
6792
|
|
|
6790
6793
|
const { parse, objectToCanvasData } = PathConvert;
|
|
6791
6794
|
const emptyPaint = {};
|
|
@@ -7209,9 +7212,6 @@ var LeaferUI = (function (exports) {
|
|
|
7209
7212
|
this.__drawPathByBox(pen);
|
|
7210
7213
|
return pen;
|
|
7211
7214
|
}
|
|
7212
|
-
get editConfig() { return undefined; }
|
|
7213
|
-
get editOuter() { return ''; }
|
|
7214
|
-
get editInner() { return ''; }
|
|
7215
7215
|
constructor(data) {
|
|
7216
7216
|
super(data);
|
|
7217
7217
|
}
|
|
@@ -7293,8 +7293,11 @@ var LeaferUI = (function (exports) {
|
|
|
7293
7293
|
export(_filename, _options) {
|
|
7294
7294
|
return Plugin.need('export');
|
|
7295
7295
|
}
|
|
7296
|
+
syncExport(_filename, _options) {
|
|
7297
|
+
return Plugin.need('export');
|
|
7298
|
+
}
|
|
7296
7299
|
clone(data) {
|
|
7297
|
-
const json = this.toJSON();
|
|
7300
|
+
const json = DataHelper.clone(this.toJSON());
|
|
7298
7301
|
if (data)
|
|
7299
7302
|
Object.assign(json, data);
|
|
7300
7303
|
return UI_1.one(json);
|
|
@@ -7593,7 +7596,7 @@ var LeaferUI = (function (exports) {
|
|
|
7593
7596
|
get layoutLocked() { return !this.layouter.running; }
|
|
7594
7597
|
get FPS() { return this.renderer ? this.renderer.FPS : 60; }
|
|
7595
7598
|
get cursorPoint() { return (this.interaction && this.interaction.hoverData) || { x: this.width / 2, y: this.height / 2 }; }
|
|
7596
|
-
get clientBounds() { return this.canvas && this.canvas.getClientBounds(); }
|
|
7599
|
+
get clientBounds() { return (this.canvas && this.canvas.getClientBounds(true)) || getBoundsData(); }
|
|
7597
7600
|
constructor(userConfig, data) {
|
|
7598
7601
|
super(data);
|
|
7599
7602
|
this.config = {
|
|
@@ -7895,6 +7898,10 @@ var LeaferUI = (function (exports) {
|
|
|
7895
7898
|
getPagePointByClient(clientPoint, updateClient) {
|
|
7896
7899
|
return this.getPagePoint(this.getWorldPointByClient(clientPoint, updateClient));
|
|
7897
7900
|
}
|
|
7901
|
+
getClientPointByWorld(worldPoint) {
|
|
7902
|
+
const { x, y } = this.clientBounds;
|
|
7903
|
+
return { x: x + worldPoint.x, y: y + worldPoint.y };
|
|
7904
|
+
}
|
|
7898
7905
|
updateClientBounds() {
|
|
7899
7906
|
this.canvas && this.canvas.updateClientBounds();
|
|
7900
7907
|
}
|
|
@@ -9930,13 +9937,14 @@ var LeaferUI = (function (exports) {
|
|
|
9930
9937
|
}
|
|
9931
9938
|
|
|
9932
9939
|
function layoutText(drawData, style) {
|
|
9933
|
-
const { rows, bounds } = drawData;
|
|
9940
|
+
const { rows, bounds } = drawData, countRows = rows.length;
|
|
9934
9941
|
const { __lineHeight, __baseLine, __letterSpacing, __clipText, textAlign, verticalAlign, paraSpacing, autoSizeAlign } = style;
|
|
9935
|
-
let { x, y, width, height } = bounds, realHeight = __lineHeight *
|
|
9942
|
+
let { x, y, width, height } = bounds, realHeight = __lineHeight * countRows + (paraSpacing ? paraSpacing * (drawData.paraNumber - 1) : 0);
|
|
9936
9943
|
let starY = __baseLine;
|
|
9937
9944
|
if (__clipText && realHeight > height) {
|
|
9938
9945
|
realHeight = Math.max(height, __lineHeight);
|
|
9939
|
-
|
|
9946
|
+
if (countRows > 1)
|
|
9947
|
+
drawData.overflow = countRows;
|
|
9940
9948
|
}
|
|
9941
9949
|
else if (height || autoSizeAlign) {
|
|
9942
9950
|
switch (verticalAlign) {
|
|
@@ -9948,7 +9956,7 @@ var LeaferUI = (function (exports) {
|
|
|
9948
9956
|
}
|
|
9949
9957
|
starY += y;
|
|
9950
9958
|
let row, rowX, rowWidth, layoutWidth = (width || autoSizeAlign) ? width : drawData.maxWidth;
|
|
9951
|
-
for (let i = 0, len =
|
|
9959
|
+
for (let i = 0, len = countRows; i < len; i++) {
|
|
9952
9960
|
row = rows[i];
|
|
9953
9961
|
row.x = x;
|
|
9954
9962
|
if (row.width < width || (row.width > width && !__clipText)) {
|
|
@@ -10017,7 +10025,7 @@ var LeaferUI = (function (exports) {
|
|
|
10017
10025
|
if (i === end && charRight < right) {
|
|
10018
10026
|
break;
|
|
10019
10027
|
}
|
|
10020
|
-
else if (charRight < right && char.char !== ' ') {
|
|
10028
|
+
else if ((charRight < right && char.char !== ' ') || !i) {
|
|
10021
10029
|
row.data.splice(i + 1);
|
|
10022
10030
|
row.width -= char.width;
|
|
10023
10031
|
break;
|