@leafer-ui/miniapp 2.0.7 → 2.0.9
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 +39 -17
- 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.0.9";
|
|
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;
|
|
@@ -9624,11 +9629,16 @@ let Polygon = class Polygon extends UI {
|
|
|
9624
9629
|
if (data.points) {
|
|
9625
9630
|
drawPoints$1(path, data.points, data.curve, data.closed);
|
|
9626
9631
|
} else {
|
|
9627
|
-
const {width: width, height: height, sides: sides} = data;
|
|
9632
|
+
const {width: width, height: height, sides: sides, startAngle: startAngle} = data;
|
|
9628
9633
|
const rx = width / 2, ry = height / 2;
|
|
9629
|
-
|
|
9634
|
+
let startRadian = 0, radian;
|
|
9635
|
+
if (startAngle) {
|
|
9636
|
+
startRadian = startAngle * OneRadian;
|
|
9637
|
+
moveTo$2(path, rx + rx * sin$1(startRadian), ry - ry * cos$1(startRadian));
|
|
9638
|
+
} else moveTo$2(path, rx, 0);
|
|
9630
9639
|
for (let i = 1; i < sides; i++) {
|
|
9631
|
-
|
|
9640
|
+
radian = i * 2 * PI$1 / sides + startRadian;
|
|
9641
|
+
lineTo$2(path, rx + rx * sin$1(radian), ry - ry * cos$1(radian));
|
|
9632
9642
|
}
|
|
9633
9643
|
closePath$1(path);
|
|
9634
9644
|
}
|
|
@@ -9639,6 +9649,8 @@ __decorate([ dataProcessor(PolygonData) ], Polygon.prototype, "__", void 0);
|
|
|
9639
9649
|
|
|
9640
9650
|
__decorate([ pathType(3) ], Polygon.prototype, "sides", void 0);
|
|
9641
9651
|
|
|
9652
|
+
__decorate([ pathType(0) ], Polygon.prototype, "startAngle", void 0);
|
|
9653
|
+
|
|
9642
9654
|
__decorate([ pathType() ], Polygon.prototype, "points", void 0);
|
|
9643
9655
|
|
|
9644
9656
|
__decorate([ pathType(0) ], Polygon.prototype, "curve", void 0);
|
|
@@ -9654,12 +9666,17 @@ let Star = class Star extends UI {
|
|
|
9654
9666
|
return "Star";
|
|
9655
9667
|
}
|
|
9656
9668
|
__updatePath() {
|
|
9657
|
-
const {width: width, height: height, corners: corners, innerRadius: innerRadius} = this.__;
|
|
9669
|
+
const {width: width, height: height, corners: corners, innerRadius: innerRadius, startAngle: startAngle} = this.__;
|
|
9658
9670
|
const rx = width / 2, ry = height / 2;
|
|
9659
9671
|
const path = this.__.path = [];
|
|
9660
|
-
|
|
9672
|
+
let startRadian = 0, radian;
|
|
9673
|
+
if (startAngle) {
|
|
9674
|
+
startRadian = startAngle * OneRadian;
|
|
9675
|
+
moveTo$1(path, rx + rx * sin(startRadian), ry - ry * cos(startRadian));
|
|
9676
|
+
} else moveTo$1(path, rx, 0);
|
|
9661
9677
|
for (let i = 1; i < corners * 2; i++) {
|
|
9662
|
-
|
|
9678
|
+
radian = i * PI / corners + startRadian;
|
|
9679
|
+
lineTo$1(path, rx + (i % 2 === 0 ? rx : rx * innerRadius) * sin(radian), ry - (i % 2 === 0 ? ry : ry * innerRadius) * cos(radian));
|
|
9663
9680
|
}
|
|
9664
9681
|
closePath(path);
|
|
9665
9682
|
}
|
|
@@ -9671,6 +9688,8 @@ __decorate([ pathType(5) ], Star.prototype, "corners", void 0);
|
|
|
9671
9688
|
|
|
9672
9689
|
__decorate([ pathType(.382) ], Star.prototype, "innerRadius", void 0);
|
|
9673
9690
|
|
|
9691
|
+
__decorate([ pathType(0) ], Star.prototype, "startAngle", void 0);
|
|
9692
|
+
|
|
9674
9693
|
Star = __decorate([ registerUI() ], Star);
|
|
9675
9694
|
|
|
9676
9695
|
const {moveTo: moveTo, lineTo: lineTo, drawPoints: drawPoints} = PathCommandDataHelper;
|
|
@@ -10029,7 +10048,8 @@ let Pen = class Pen extends Group {
|
|
|
10029
10048
|
return this;
|
|
10030
10049
|
}
|
|
10031
10050
|
paint() {
|
|
10032
|
-
|
|
10051
|
+
const {pathElement: pathElement} = this;
|
|
10052
|
+
if (!pathElement.__layout.boxChanged) pathElement.forceUpdate("path");
|
|
10033
10053
|
}
|
|
10034
10054
|
};
|
|
10035
10055
|
|
|
@@ -10271,7 +10291,7 @@ const DragBoundsHelper = {
|
|
|
10271
10291
|
return dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds;
|
|
10272
10292
|
},
|
|
10273
10293
|
isInnerMode(content, dragBounds, dragBoundsType, sideType) {
|
|
10274
|
-
return dragBoundsType === "inner" || dragBoundsType === "auto" && content[sideType] > dragBounds[sideType];
|
|
10294
|
+
return dragBoundsType === "inner" || dragBoundsType === "auto" && float(content[sideType]) > float(dragBounds[sideType]);
|
|
10275
10295
|
},
|
|
10276
10296
|
getValidMove(content, dragBounds, dragBoundsType, move, change) {
|
|
10277
10297
|
const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
|
|
@@ -11741,6 +11761,8 @@ function stroke(stroke, ui, canvas, renderOptions) {
|
|
|
11741
11761
|
if (!data.__strokeWidth) return;
|
|
11742
11762
|
if (data.__font) {
|
|
11743
11763
|
Paint.strokeText(stroke, ui, canvas, renderOptions);
|
|
11764
|
+
} else if (data.__pathForStroke) {
|
|
11765
|
+
Paint.fillStroke(stroke, ui, canvas, renderOptions);
|
|
11744
11766
|
} else {
|
|
11745
11767
|
switch (data.strokeAlign) {
|
|
11746
11768
|
case "center":
|