@leafer-ui/miniapp 2.0.8 → 2.1.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 +15 -8
- package/dist/miniapp.esm.js +16 -9
- 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 +46 -20
- package/dist/miniapp.module.min.js +1 -1
- package/dist/miniapp.module.min.js.map +1 -1
- package/package.json +10 -10
package/dist/miniapp.module.js
CHANGED
|
@@ -7079,7 +7079,7 @@ class LeafLevelList {
|
|
|
7079
7079
|
}
|
|
7080
7080
|
}
|
|
7081
7081
|
|
|
7082
|
-
const version = "2.0
|
|
7082
|
+
const version = "2.1.0";
|
|
7083
7083
|
|
|
7084
7084
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
7085
7085
|
get allowBackgroundColor() {
|
|
@@ -7141,6 +7141,7 @@ class LeaferCanvas extends LeaferCanvasBase {
|
|
|
7141
7141
|
updateClientBounds(callback) {
|
|
7142
7142
|
if (this.viewSelect) Platform.miniapp.getBounds(this.viewSelect).then(bounds => {
|
|
7143
7143
|
this.clientBounds = bounds;
|
|
7144
|
+
this.updateViewSize();
|
|
7144
7145
|
if (callback) callback();
|
|
7145
7146
|
});
|
|
7146
7147
|
}
|
|
@@ -7240,7 +7241,7 @@ function useCanvas(_canvasType, app) {
|
|
|
7240
7241
|
},
|
|
7241
7242
|
loadImage(src, _crossOrigin, _leaferImage) {
|
|
7242
7243
|
return new Promise((resolve, reject) => {
|
|
7243
|
-
const img = Platform.
|
|
7244
|
+
const img = Platform.getCanvas().view.createImage();
|
|
7244
7245
|
img.onload = () => {
|
|
7245
7246
|
resolve(img);
|
|
7246
7247
|
};
|
|
@@ -7335,21 +7336,25 @@ function useCanvas(_canvasType, app) {
|
|
|
7335
7336
|
};
|
|
7336
7337
|
Platform.canvas = Creator.canvas();
|
|
7337
7338
|
Platform.conicGradientSupport = !!Platform.canvas.context.createConicGradient;
|
|
7339
|
+
defineKey(Platform, "devicePixelRatio", {
|
|
7340
|
+
get() {
|
|
7341
|
+
return Math.max(1, app.getWindowInfo ? app.getWindowInfo().pixelRatio : app.getSystemInfoSync().pixelRatio);
|
|
7342
|
+
}
|
|
7343
|
+
});
|
|
7338
7344
|
}
|
|
7339
7345
|
|
|
7340
7346
|
Platform.name = "miniapp";
|
|
7341
7347
|
|
|
7348
|
+
Platform.getCanvas = function() {
|
|
7349
|
+
const {renderCanvas: renderCanvas} = Platform;
|
|
7350
|
+
return renderCanvas && renderCanvas.view ? renderCanvas : Platform.canvas;
|
|
7351
|
+
};
|
|
7352
|
+
|
|
7342
7353
|
Platform.requestRender = function(render) {
|
|
7343
|
-
const {view: view} = Platform.
|
|
7354
|
+
const {view: view} = Platform.getCanvas();
|
|
7344
7355
|
view.requestAnimationFrame ? view.requestAnimationFrame(render) : setTimeout(render, 16);
|
|
7345
7356
|
};
|
|
7346
7357
|
|
|
7347
|
-
defineKey(Platform, "devicePixelRatio", {
|
|
7348
|
-
get() {
|
|
7349
|
-
return Math.max(1, wx.getWindowInfo ? wx.getWindowInfo().pixelRatio : wx.getSystemInfoSync().pixelRatio);
|
|
7350
|
-
}
|
|
7351
|
-
});
|
|
7352
|
-
|
|
7353
7358
|
class Watcher {
|
|
7354
7359
|
get childrenChanged() {
|
|
7355
7360
|
return this.hasAdd || this.hasRemove || this.hasVisible;
|
|
@@ -8239,8 +8244,8 @@ class UIData extends LeafData {
|
|
|
8239
8244
|
return this.__getRealStrokeWidth();
|
|
8240
8245
|
}
|
|
8241
8246
|
get __maxStrokeWidth() {
|
|
8242
|
-
const t = this;
|
|
8243
|
-
return t.__hasMultiStrokeStyle ? Math.max(t.__hasMultiStrokeStyle,
|
|
8247
|
+
const t = this, strokeWidth = t.__hasStrokeSides || t.strokeWidth;
|
|
8248
|
+
return t.__hasMultiStrokeStyle ? Math.max(t.__hasMultiStrokeStyle, strokeWidth) : strokeWidth;
|
|
8244
8249
|
}
|
|
8245
8250
|
get __hasMultiPaint() {
|
|
8246
8251
|
const t = this;
|
|
@@ -8341,6 +8346,10 @@ class UIData extends LeafData {
|
|
|
8341
8346
|
}
|
|
8342
8347
|
return strokeWidth;
|
|
8343
8348
|
}
|
|
8349
|
+
__checkComplex() {
|
|
8350
|
+
const t = this;
|
|
8351
|
+
stintSet$3(t, "__complex", t.__isFills || t.__isStrokes || t.cornerRadius || t.__useEffect);
|
|
8352
|
+
}
|
|
8344
8353
|
__setPaint(attrName, value) {
|
|
8345
8354
|
this.__setInput(attrName, value);
|
|
8346
8355
|
const layout = this.__leaf.__layout;
|
|
@@ -8575,7 +8584,7 @@ const UIRender = {
|
|
|
8575
8584
|
data.__useEffect = !!(shadow || otherEffect);
|
|
8576
8585
|
}
|
|
8577
8586
|
data.__checkSingle();
|
|
8578
|
-
|
|
8587
|
+
data.__checkComplex();
|
|
8579
8588
|
},
|
|
8580
8589
|
__drawFast(canvas, options) {
|
|
8581
8590
|
drawFast(this, canvas, options);
|
|
@@ -9624,11 +9633,16 @@ let Polygon = class Polygon extends UI {
|
|
|
9624
9633
|
if (data.points) {
|
|
9625
9634
|
drawPoints$1(path, data.points, data.curve, data.closed);
|
|
9626
9635
|
} else {
|
|
9627
|
-
const {width: width, height: height, sides: sides} = data;
|
|
9636
|
+
const {width: width, height: height, sides: sides, startAngle: startAngle} = data;
|
|
9628
9637
|
const rx = width / 2, ry = height / 2;
|
|
9629
|
-
|
|
9638
|
+
let startRadian = 0, radian;
|
|
9639
|
+
if (startAngle) {
|
|
9640
|
+
startRadian = startAngle * OneRadian;
|
|
9641
|
+
moveTo$2(path, rx + rx * sin$1(startRadian), ry - ry * cos$1(startRadian));
|
|
9642
|
+
} else moveTo$2(path, rx, 0);
|
|
9630
9643
|
for (let i = 1; i < sides; i++) {
|
|
9631
|
-
|
|
9644
|
+
radian = i * 2 * PI$1 / sides + startRadian;
|
|
9645
|
+
lineTo$2(path, rx + rx * sin$1(radian), ry - ry * cos$1(radian));
|
|
9632
9646
|
}
|
|
9633
9647
|
closePath$1(path);
|
|
9634
9648
|
}
|
|
@@ -9639,6 +9653,8 @@ __decorate([ dataProcessor(PolygonData) ], Polygon.prototype, "__", void 0);
|
|
|
9639
9653
|
|
|
9640
9654
|
__decorate([ pathType(3) ], Polygon.prototype, "sides", void 0);
|
|
9641
9655
|
|
|
9656
|
+
__decorate([ pathType(0) ], Polygon.prototype, "startAngle", void 0);
|
|
9657
|
+
|
|
9642
9658
|
__decorate([ pathType() ], Polygon.prototype, "points", void 0);
|
|
9643
9659
|
|
|
9644
9660
|
__decorate([ pathType(0) ], Polygon.prototype, "curve", void 0);
|
|
@@ -9654,12 +9670,17 @@ let Star = class Star extends UI {
|
|
|
9654
9670
|
return "Star";
|
|
9655
9671
|
}
|
|
9656
9672
|
__updatePath() {
|
|
9657
|
-
const {width: width, height: height, corners: corners, innerRadius: innerRadius} = this.__;
|
|
9673
|
+
const {width: width, height: height, corners: corners, innerRadius: innerRadius, startAngle: startAngle} = this.__;
|
|
9658
9674
|
const rx = width / 2, ry = height / 2;
|
|
9659
9675
|
const path = this.__.path = [];
|
|
9660
|
-
|
|
9676
|
+
let startRadian = 0, radian;
|
|
9677
|
+
if (startAngle) {
|
|
9678
|
+
startRadian = startAngle * OneRadian;
|
|
9679
|
+
moveTo$1(path, rx + rx * sin(startRadian), ry - ry * cos(startRadian));
|
|
9680
|
+
} else moveTo$1(path, rx, 0);
|
|
9661
9681
|
for (let i = 1; i < corners * 2; i++) {
|
|
9662
|
-
|
|
9682
|
+
radian = i * PI / corners + startRadian;
|
|
9683
|
+
lineTo$1(path, rx + (i % 2 === 0 ? rx : rx * innerRadius) * sin(radian), ry - (i % 2 === 0 ? ry : ry * innerRadius) * cos(radian));
|
|
9663
9684
|
}
|
|
9664
9685
|
closePath(path);
|
|
9665
9686
|
}
|
|
@@ -9671,6 +9692,8 @@ __decorate([ pathType(5) ], Star.prototype, "corners", void 0);
|
|
|
9671
9692
|
|
|
9672
9693
|
__decorate([ pathType(.382) ], Star.prototype, "innerRadius", void 0);
|
|
9673
9694
|
|
|
9695
|
+
__decorate([ pathType(0) ], Star.prototype, "startAngle", void 0);
|
|
9696
|
+
|
|
9674
9697
|
Star = __decorate([ registerUI() ], Star);
|
|
9675
9698
|
|
|
9676
9699
|
const {moveTo: moveTo, lineTo: lineTo, drawPoints: drawPoints} = PathCommandDataHelper;
|
|
@@ -10029,7 +10052,8 @@ let Pen = class Pen extends Group {
|
|
|
10029
10052
|
return this;
|
|
10030
10053
|
}
|
|
10031
10054
|
paint() {
|
|
10032
|
-
|
|
10055
|
+
const {pathElement: pathElement} = this;
|
|
10056
|
+
if (!pathElement.__layout.boxChanged) pathElement.forceUpdate("path");
|
|
10033
10057
|
}
|
|
10034
10058
|
};
|
|
10035
10059
|
|
|
@@ -10271,7 +10295,7 @@ const DragBoundsHelper = {
|
|
|
10271
10295
|
return dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds;
|
|
10272
10296
|
},
|
|
10273
10297
|
isInnerMode(content, dragBounds, dragBoundsType, sideType) {
|
|
10274
|
-
return dragBoundsType === "inner" || dragBoundsType === "auto" && content[sideType] > dragBounds[sideType];
|
|
10298
|
+
return dragBoundsType === "inner" || dragBoundsType === "auto" && float(content[sideType]) > float(dragBounds[sideType]);
|
|
10275
10299
|
},
|
|
10276
10300
|
getValidMove(content, dragBounds, dragBoundsType, move, change) {
|
|
10277
10301
|
const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
|
|
@@ -11741,6 +11765,8 @@ function stroke(stroke, ui, canvas, renderOptions) {
|
|
|
11741
11765
|
if (!data.__strokeWidth) return;
|
|
11742
11766
|
if (data.__font) {
|
|
11743
11767
|
Paint.strokeText(stroke, ui, canvas, renderOptions);
|
|
11768
|
+
} else if (data.__pathForStroke) {
|
|
11769
|
+
Paint.fillStroke(stroke, ui, canvas, renderOptions);
|
|
11744
11770
|
} else {
|
|
11745
11771
|
switch (data.strokeAlign) {
|
|
11746
11772
|
case "center":
|