@leafer-draw/miniapp 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/miniapp.cjs +6 -5
- package/dist/miniapp.cjs.map +1 -1
- package/dist/miniapp.esm.js +6 -5
- package/dist/miniapp.esm.js.map +1 -1
- package/dist/miniapp.esm.min.js +1 -1
- package/dist/miniapp.esm.min.js.map +1 -1
- package/dist/miniapp.min.cjs +1 -1
- package/dist/miniapp.min.cjs.map +1 -1
- package/dist/miniapp.module.js +25 -17
- package/dist/miniapp.module.js.map +1 -1
- package/dist/miniapp.module.min.js +1 -1
- package/dist/miniapp.module.min.js.map +1 -1
- package/package.json +8 -8
package/dist/miniapp.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 false; }
|
|
@@ -6921,7 +6920,11 @@ const State = {
|
|
|
6921
6920
|
setStyleName() { return Plugin.need('state'); },
|
|
6922
6921
|
set() { return Plugin.need('state'); }
|
|
6923
6922
|
};
|
|
6924
|
-
const Transition = {
|
|
6923
|
+
const Transition = {
|
|
6924
|
+
list: {},
|
|
6925
|
+
register(attrName, fn) { Transition.list[attrName] = fn; },
|
|
6926
|
+
get(attrName) { return Transition.list[attrName]; }
|
|
6927
|
+
};
|
|
6925
6928
|
|
|
6926
6929
|
const { parse, objectToCanvasData } = PathConvert;
|
|
6927
6930
|
const emptyPaint = {};
|
|
@@ -7345,9 +7348,6 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
7345
7348
|
this.__drawPathByBox(pen);
|
|
7346
7349
|
return pen;
|
|
7347
7350
|
}
|
|
7348
|
-
get editConfig() { return undefined; }
|
|
7349
|
-
get editOuter() { return ''; }
|
|
7350
|
-
get editInner() { return ''; }
|
|
7351
7351
|
constructor(data) {
|
|
7352
7352
|
super(data);
|
|
7353
7353
|
}
|
|
@@ -7429,8 +7429,11 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
7429
7429
|
export(_filename, _options) {
|
|
7430
7430
|
return Plugin.need('export');
|
|
7431
7431
|
}
|
|
7432
|
+
syncExport(_filename, _options) {
|
|
7433
|
+
return Plugin.need('export');
|
|
7434
|
+
}
|
|
7432
7435
|
clone(data) {
|
|
7433
|
-
const json = this.toJSON();
|
|
7436
|
+
const json = DataHelper.clone(this.toJSON());
|
|
7434
7437
|
if (data)
|
|
7435
7438
|
Object.assign(json, data);
|
|
7436
7439
|
return UI_1.one(json);
|
|
@@ -7729,7 +7732,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
7729
7732
|
get layoutLocked() { return !this.layouter.running; }
|
|
7730
7733
|
get FPS() { return this.renderer ? this.renderer.FPS : 60; }
|
|
7731
7734
|
get cursorPoint() { return (this.interaction && this.interaction.hoverData) || { x: this.width / 2, y: this.height / 2 }; }
|
|
7732
|
-
get clientBounds() { return this.canvas && this.canvas.getClientBounds(); }
|
|
7735
|
+
get clientBounds() { return (this.canvas && this.canvas.getClientBounds(true)) || getBoundsData(); }
|
|
7733
7736
|
constructor(userConfig, data) {
|
|
7734
7737
|
super(data);
|
|
7735
7738
|
this.config = {
|
|
@@ -8031,6 +8034,10 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8031
8034
|
getPagePointByClient(clientPoint, updateClient) {
|
|
8032
8035
|
return this.getPagePoint(this.getWorldPointByClient(clientPoint, updateClient));
|
|
8033
8036
|
}
|
|
8037
|
+
getClientPointByWorld(worldPoint) {
|
|
8038
|
+
const { x, y } = this.clientBounds;
|
|
8039
|
+
return { x: x + worldPoint.x, y: y + worldPoint.y };
|
|
8040
|
+
}
|
|
8034
8041
|
updateClientBounds() {
|
|
8035
8042
|
this.canvas && this.canvas.updateClientBounds();
|
|
8036
8043
|
}
|
|
@@ -10066,13 +10073,14 @@ function toChar(data, charX, rowData, isOverflow) {
|
|
|
10066
10073
|
}
|
|
10067
10074
|
|
|
10068
10075
|
function layoutText(drawData, style) {
|
|
10069
|
-
const { rows, bounds } = drawData;
|
|
10076
|
+
const { rows, bounds } = drawData, countRows = rows.length;
|
|
10070
10077
|
const { __lineHeight, __baseLine, __letterSpacing, __clipText, textAlign, verticalAlign, paraSpacing, autoSizeAlign } = style;
|
|
10071
|
-
let { x, y, width, height } = bounds, realHeight = __lineHeight *
|
|
10078
|
+
let { x, y, width, height } = bounds, realHeight = __lineHeight * countRows + (paraSpacing ? paraSpacing * (drawData.paraNumber - 1) : 0);
|
|
10072
10079
|
let starY = __baseLine;
|
|
10073
10080
|
if (__clipText && realHeight > height) {
|
|
10074
10081
|
realHeight = Math.max(height, __lineHeight);
|
|
10075
|
-
|
|
10082
|
+
if (countRows > 1)
|
|
10083
|
+
drawData.overflow = countRows;
|
|
10076
10084
|
}
|
|
10077
10085
|
else if (height || autoSizeAlign) {
|
|
10078
10086
|
switch (verticalAlign) {
|
|
@@ -10084,7 +10092,7 @@ function layoutText(drawData, style) {
|
|
|
10084
10092
|
}
|
|
10085
10093
|
starY += y;
|
|
10086
10094
|
let row, rowX, rowWidth, layoutWidth = (width || autoSizeAlign) ? width : drawData.maxWidth;
|
|
10087
|
-
for (let i = 0, len =
|
|
10095
|
+
for (let i = 0, len = countRows; i < len; i++) {
|
|
10088
10096
|
row = rows[i];
|
|
10089
10097
|
row.x = x;
|
|
10090
10098
|
if (row.width < width || (row.width > width && !__clipText)) {
|
|
@@ -10153,7 +10161,7 @@ function clipText(drawData, style, x, width) {
|
|
|
10153
10161
|
if (i === end && charRight < right) {
|
|
10154
10162
|
break;
|
|
10155
10163
|
}
|
|
10156
|
-
else if (charRight < right && char.char !== ' ') {
|
|
10164
|
+
else if ((charRight < right && char.char !== ' ') || !i) {
|
|
10157
10165
|
row.data.splice(i + 1);
|
|
10158
10166
|
row.width -= char.width;
|
|
10159
10167
|
break;
|