@leafer-draw/miniapp 2.0.8 → 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 +38 -16
- package/dist/miniapp.module.min.js +1 -1
- package/dist/miniapp.module.min.js.map +1 -1
- package/package.json +7 -7
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;
|
|
@@ -9424,11 +9429,16 @@ let Polygon = class Polygon extends UI {
|
|
|
9424
9429
|
if (data.points) {
|
|
9425
9430
|
drawPoints$1(path, data.points, data.curve, data.closed);
|
|
9426
9431
|
} else {
|
|
9427
|
-
const {width: width, height: height, sides: sides} = data;
|
|
9432
|
+
const {width: width, height: height, sides: sides, startAngle: startAngle} = data;
|
|
9428
9433
|
const rx = width / 2, ry = height / 2;
|
|
9429
|
-
|
|
9434
|
+
let startRadian = 0, radian;
|
|
9435
|
+
if (startAngle) {
|
|
9436
|
+
startRadian = startAngle * OneRadian;
|
|
9437
|
+
moveTo$2(path, rx + rx * sin$1(startRadian), ry - ry * cos$1(startRadian));
|
|
9438
|
+
} else moveTo$2(path, rx, 0);
|
|
9430
9439
|
for (let i = 1; i < sides; i++) {
|
|
9431
|
-
|
|
9440
|
+
radian = i * 2 * PI$1 / sides + startRadian;
|
|
9441
|
+
lineTo$2(path, rx + rx * sin$1(radian), ry - ry * cos$1(radian));
|
|
9432
9442
|
}
|
|
9433
9443
|
closePath$1(path);
|
|
9434
9444
|
}
|
|
@@ -9439,6 +9449,8 @@ __decorate([ dataProcessor(PolygonData) ], Polygon.prototype, "__", void 0);
|
|
|
9439
9449
|
|
|
9440
9450
|
__decorate([ pathType(3) ], Polygon.prototype, "sides", void 0);
|
|
9441
9451
|
|
|
9452
|
+
__decorate([ pathType(0) ], Polygon.prototype, "startAngle", void 0);
|
|
9453
|
+
|
|
9442
9454
|
__decorate([ pathType() ], Polygon.prototype, "points", void 0);
|
|
9443
9455
|
|
|
9444
9456
|
__decorate([ pathType(0) ], Polygon.prototype, "curve", void 0);
|
|
@@ -9454,12 +9466,17 @@ let Star = class Star extends UI {
|
|
|
9454
9466
|
return "Star";
|
|
9455
9467
|
}
|
|
9456
9468
|
__updatePath() {
|
|
9457
|
-
const {width: width, height: height, corners: corners, innerRadius: innerRadius} = this.__;
|
|
9469
|
+
const {width: width, height: height, corners: corners, innerRadius: innerRadius, startAngle: startAngle} = this.__;
|
|
9458
9470
|
const rx = width / 2, ry = height / 2;
|
|
9459
9471
|
const path = this.__.path = [];
|
|
9460
|
-
|
|
9472
|
+
let startRadian = 0, radian;
|
|
9473
|
+
if (startAngle) {
|
|
9474
|
+
startRadian = startAngle * OneRadian;
|
|
9475
|
+
moveTo$1(path, rx + rx * sin(startRadian), ry - ry * cos(startRadian));
|
|
9476
|
+
} else moveTo$1(path, rx, 0);
|
|
9461
9477
|
for (let i = 1; i < corners * 2; i++) {
|
|
9462
|
-
|
|
9478
|
+
radian = i * PI / corners + startRadian;
|
|
9479
|
+
lineTo$1(path, rx + (i % 2 === 0 ? rx : rx * innerRadius) * sin(radian), ry - (i % 2 === 0 ? ry : ry * innerRadius) * cos(radian));
|
|
9463
9480
|
}
|
|
9464
9481
|
closePath(path);
|
|
9465
9482
|
}
|
|
@@ -9471,6 +9488,8 @@ __decorate([ pathType(5) ], Star.prototype, "corners", void 0);
|
|
|
9471
9488
|
|
|
9472
9489
|
__decorate([ pathType(.382) ], Star.prototype, "innerRadius", void 0);
|
|
9473
9490
|
|
|
9491
|
+
__decorate([ pathType(0) ], Star.prototype, "startAngle", void 0);
|
|
9492
|
+
|
|
9474
9493
|
Star = __decorate([ registerUI() ], Star);
|
|
9475
9494
|
|
|
9476
9495
|
const {moveTo: moveTo, lineTo: lineTo, drawPoints: drawPoints} = PathCommandDataHelper;
|
|
@@ -9829,7 +9848,8 @@ let Pen = class Pen extends Group {
|
|
|
9829
9848
|
return this;
|
|
9830
9849
|
}
|
|
9831
9850
|
paint() {
|
|
9832
|
-
|
|
9851
|
+
const {pathElement: pathElement} = this;
|
|
9852
|
+
if (!pathElement.__layout.boxChanged) pathElement.forceUpdate("path");
|
|
9833
9853
|
}
|
|
9834
9854
|
};
|
|
9835
9855
|
|
|
@@ -9913,6 +9933,8 @@ function stroke(stroke, ui, canvas, renderOptions) {
|
|
|
9913
9933
|
if (!data.__strokeWidth) return;
|
|
9914
9934
|
if (data.__font) {
|
|
9915
9935
|
Paint.strokeText(stroke, ui, canvas, renderOptions);
|
|
9936
|
+
} else if (data.__pathForStroke) {
|
|
9937
|
+
Paint.fillStroke(stroke, ui, canvas, renderOptions);
|
|
9916
9938
|
} else {
|
|
9917
9939
|
switch (data.strokeAlign) {
|
|
9918
9940
|
case "center":
|