@leafer-draw/worker 1.4.2 → 1.5.1
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 +27 -23
- 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 +27 -23
- 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
|
@@ -2032,13 +2032,11 @@ var LeaferUI = (function (exports) {
|
|
|
2032
2032
|
this.worldTransform = {};
|
|
2033
2033
|
if (!config)
|
|
2034
2034
|
config = minSize;
|
|
2035
|
-
if (!config.pixelRatio)
|
|
2036
|
-
config.pixelRatio = Platform.devicePixelRatio;
|
|
2037
2035
|
this.manager = manager;
|
|
2038
2036
|
this.innerId = IncrementId.create(IncrementId.CNAVAS);
|
|
2039
2037
|
const { width, height, pixelRatio } = config;
|
|
2040
2038
|
this.autoLayout = !width || !height;
|
|
2041
|
-
this.size.pixelRatio = pixelRatio;
|
|
2039
|
+
this.size.pixelRatio = pixelRatio | Platform.devicePixelRatio;
|
|
2042
2040
|
this.config = config;
|
|
2043
2041
|
this.init();
|
|
2044
2042
|
}
|
|
@@ -2235,7 +2233,7 @@ var LeaferUI = (function (exports) {
|
|
|
2235
2233
|
tempBounds$1.ceil();
|
|
2236
2234
|
}
|
|
2237
2235
|
isSameSize(size) {
|
|
2238
|
-
return this.width === size.width && this.height === size.height && this.pixelRatio === size.pixelRatio;
|
|
2236
|
+
return this.width === size.width && this.height === size.height && (!size.pixelRatio || this.pixelRatio === size.pixelRatio);
|
|
2239
2237
|
}
|
|
2240
2238
|
getSameCanvas(useSameWorldTransform, useSameSmooth) {
|
|
2241
2239
|
const canvas = this.manager ? this.manager.get(this.size) : Creator.canvas(Object.assign({}, this.size));
|
|
@@ -4073,13 +4071,10 @@ var LeaferUI = (function (exports) {
|
|
|
4073
4071
|
if (defaultValue === undefined) {
|
|
4074
4072
|
property.get = function () { return this[computedKey]; };
|
|
4075
4073
|
}
|
|
4076
|
-
else if (typeof defaultValue === '
|
|
4077
|
-
const { clone } = DataHelper;
|
|
4074
|
+
else if (typeof defaultValue === 'function') {
|
|
4078
4075
|
property.get = function () {
|
|
4079
4076
|
let v = this[computedKey];
|
|
4080
|
-
|
|
4081
|
-
this[computedKey] = v = clone(defaultValue);
|
|
4082
|
-
return v;
|
|
4077
|
+
return v === undefined ? defaultValue(this.__leaf) : v;
|
|
4083
4078
|
};
|
|
4084
4079
|
}
|
|
4085
4080
|
if (key === 'width') {
|
|
@@ -5725,10 +5720,10 @@ var LeaferUI = (function (exports) {
|
|
|
5725
5720
|
static changeAttr(attrName, defaultValue, fn) {
|
|
5726
5721
|
fn ? this.addAttr(attrName, defaultValue, fn) : defineDataProcessor(this.prototype, attrName, defaultValue);
|
|
5727
5722
|
}
|
|
5728
|
-
static addAttr(attrName, defaultValue, fn) {
|
|
5723
|
+
static addAttr(attrName, defaultValue, fn, helpValue) {
|
|
5729
5724
|
if (!fn)
|
|
5730
5725
|
fn = boundsType;
|
|
5731
|
-
fn(defaultValue)(this.prototype, attrName);
|
|
5726
|
+
fn(defaultValue, helpValue)(this.prototype, attrName);
|
|
5732
5727
|
}
|
|
5733
5728
|
__emitLifeEvent(type) {
|
|
5734
5729
|
if (this.hasEvent(type))
|
|
@@ -6055,7 +6050,7 @@ var LeaferUI = (function (exports) {
|
|
|
6055
6050
|
}
|
|
6056
6051
|
}
|
|
6057
6052
|
|
|
6058
|
-
const version = "1.
|
|
6053
|
+
const version = "1.5.1";
|
|
6059
6054
|
|
|
6060
6055
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6061
6056
|
get allowBackgroundColor() { return true; }
|
|
@@ -6785,7 +6780,11 @@ var LeaferUI = (function (exports) {
|
|
|
6785
6780
|
setStyleName() { return Plugin.need('state'); },
|
|
6786
6781
|
set() { return Plugin.need('state'); }
|
|
6787
6782
|
};
|
|
6788
|
-
const Transition = {
|
|
6783
|
+
const Transition = {
|
|
6784
|
+
list: {},
|
|
6785
|
+
register(attrName, fn) { Transition.list[attrName] = fn; },
|
|
6786
|
+
get(attrName) { return Transition.list[attrName]; }
|
|
6787
|
+
};
|
|
6789
6788
|
|
|
6790
6789
|
const { parse, objectToCanvasData } = PathConvert;
|
|
6791
6790
|
const emptyPaint = {};
|
|
@@ -7209,9 +7208,6 @@ var LeaferUI = (function (exports) {
|
|
|
7209
7208
|
this.__drawPathByBox(pen);
|
|
7210
7209
|
return pen;
|
|
7211
7210
|
}
|
|
7212
|
-
get editConfig() { return undefined; }
|
|
7213
|
-
get editOuter() { return ''; }
|
|
7214
|
-
get editInner() { return ''; }
|
|
7215
7211
|
constructor(data) {
|
|
7216
7212
|
super(data);
|
|
7217
7213
|
}
|
|
@@ -7293,8 +7289,11 @@ var LeaferUI = (function (exports) {
|
|
|
7293
7289
|
export(_filename, _options) {
|
|
7294
7290
|
return Plugin.need('export');
|
|
7295
7291
|
}
|
|
7292
|
+
syncExport(_filename, _options) {
|
|
7293
|
+
return Plugin.need('export');
|
|
7294
|
+
}
|
|
7296
7295
|
clone(data) {
|
|
7297
|
-
const json = this.toJSON();
|
|
7296
|
+
const json = DataHelper.clone(this.toJSON());
|
|
7298
7297
|
if (data)
|
|
7299
7298
|
Object.assign(json, data);
|
|
7300
7299
|
return UI_1.one(json);
|
|
@@ -7593,7 +7592,7 @@ var LeaferUI = (function (exports) {
|
|
|
7593
7592
|
get layoutLocked() { return !this.layouter.running; }
|
|
7594
7593
|
get FPS() { return this.renderer ? this.renderer.FPS : 60; }
|
|
7595
7594
|
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(); }
|
|
7595
|
+
get clientBounds() { return (this.canvas && this.canvas.getClientBounds(true)) || getBoundsData(); }
|
|
7597
7596
|
constructor(userConfig, data) {
|
|
7598
7597
|
super(data);
|
|
7599
7598
|
this.config = {
|
|
@@ -7895,6 +7894,10 @@ var LeaferUI = (function (exports) {
|
|
|
7895
7894
|
getPagePointByClient(clientPoint, updateClient) {
|
|
7896
7895
|
return this.getPagePoint(this.getWorldPointByClient(clientPoint, updateClient));
|
|
7897
7896
|
}
|
|
7897
|
+
getClientPointByWorld(worldPoint) {
|
|
7898
|
+
const { x, y } = this.clientBounds;
|
|
7899
|
+
return { x: x + worldPoint.x, y: y + worldPoint.y };
|
|
7900
|
+
}
|
|
7898
7901
|
updateClientBounds() {
|
|
7899
7902
|
this.canvas && this.canvas.updateClientBounds();
|
|
7900
7903
|
}
|
|
@@ -9930,13 +9933,14 @@ var LeaferUI = (function (exports) {
|
|
|
9930
9933
|
}
|
|
9931
9934
|
|
|
9932
9935
|
function layoutText(drawData, style) {
|
|
9933
|
-
const { rows, bounds } = drawData;
|
|
9936
|
+
const { rows, bounds } = drawData, countRows = rows.length;
|
|
9934
9937
|
const { __lineHeight, __baseLine, __letterSpacing, __clipText, textAlign, verticalAlign, paraSpacing, autoSizeAlign } = style;
|
|
9935
|
-
let { x, y, width, height } = bounds, realHeight = __lineHeight *
|
|
9938
|
+
let { x, y, width, height } = bounds, realHeight = __lineHeight * countRows + (paraSpacing ? paraSpacing * (drawData.paraNumber - 1) : 0);
|
|
9936
9939
|
let starY = __baseLine;
|
|
9937
9940
|
if (__clipText && realHeight > height) {
|
|
9938
9941
|
realHeight = Math.max(height, __lineHeight);
|
|
9939
|
-
|
|
9942
|
+
if (countRows > 1)
|
|
9943
|
+
drawData.overflow = countRows;
|
|
9940
9944
|
}
|
|
9941
9945
|
else if (height || autoSizeAlign) {
|
|
9942
9946
|
switch (verticalAlign) {
|
|
@@ -9948,7 +9952,7 @@ var LeaferUI = (function (exports) {
|
|
|
9948
9952
|
}
|
|
9949
9953
|
starY += y;
|
|
9950
9954
|
let row, rowX, rowWidth, layoutWidth = (width || autoSizeAlign) ? width : drawData.maxWidth;
|
|
9951
|
-
for (let i = 0, len =
|
|
9955
|
+
for (let i = 0, len = countRows; i < len; i++) {
|
|
9952
9956
|
row = rows[i];
|
|
9953
9957
|
row.x = x;
|
|
9954
9958
|
if (row.width < width || (row.width > width && !__clipText)) {
|
|
@@ -10017,7 +10021,7 @@ var LeaferUI = (function (exports) {
|
|
|
10017
10021
|
if (i === end && charRight < right) {
|
|
10018
10022
|
break;
|
|
10019
10023
|
}
|
|
10020
|
-
else if (charRight < right && char.char !== ' ') {
|
|
10024
|
+
else if ((charRight < right && char.char !== ' ') || !i) {
|
|
10021
10025
|
row.data.splice(i + 1);
|
|
10022
10026
|
row.width -= char.width;
|
|
10023
10027
|
break;
|