@leafer-game/miniapp 1.2.0 → 1.2.2
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.module.js +39 -27
- package/dist/miniapp.module.min.js +1 -1
- package/package.json +9 -4
package/dist/miniapp.module.js
CHANGED
|
@@ -2047,11 +2047,11 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2047
2047
|
toBlob(_type, _quality) { return undefined; }
|
|
2048
2048
|
toDataURL(_type, _quality) { return undefined; }
|
|
2049
2049
|
saveAs(_filename, _quality) { return undefined; }
|
|
2050
|
-
resize(size) {
|
|
2050
|
+
resize(size, safeResize = true) {
|
|
2051
2051
|
if (this.isSameSize(size))
|
|
2052
2052
|
return;
|
|
2053
2053
|
let takeCanvas;
|
|
2054
|
-
if (this.context && !this.unreal && this.width) {
|
|
2054
|
+
if (this.context && !this.unreal && safeResize && this.width) {
|
|
2055
2055
|
takeCanvas = this.getSameCanvas();
|
|
2056
2056
|
takeCanvas.copyWorld(this);
|
|
2057
2057
|
}
|
|
@@ -4253,18 +4253,21 @@ const LeafHelper = {
|
|
|
4253
4253
|
L$1.setTransform(t, matrix$1, resize);
|
|
4254
4254
|
},
|
|
4255
4255
|
setTransform(t, transform, resize) {
|
|
4256
|
-
const
|
|
4256
|
+
const data = t.__, originPoint = data.origin && L$1.getInnerOrigin(t, data.origin);
|
|
4257
|
+
const layout = getLayout(transform, originPoint, data.around && L$1.getInnerOrigin(t, data.around));
|
|
4257
4258
|
if (resize) {
|
|
4258
|
-
const scaleX = layout.scaleX / t.scaleX;
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4259
|
+
const scaleX = layout.scaleX / t.scaleX, scaleY = layout.scaleY / t.scaleY;
|
|
4260
|
+
delete layout.scaleX, delete layout.scaleY;
|
|
4261
|
+
if (originPoint) {
|
|
4262
|
+
BoundsHelper.scale(t.boxBounds, Math.abs(scaleX), Math.abs(scaleY));
|
|
4263
|
+
const changedPoint = L$1.getInnerOrigin(t, data.origin);
|
|
4264
|
+
PointHelper.move(layout, originPoint.x - changedPoint.x, originPoint.y - changedPoint.y);
|
|
4265
|
+
}
|
|
4262
4266
|
t.set(layout);
|
|
4263
|
-
t.scaleResize(scaleX, scaleY,
|
|
4267
|
+
t.scaleResize(scaleX, scaleY, false);
|
|
4264
4268
|
}
|
|
4265
|
-
else
|
|
4269
|
+
else
|
|
4266
4270
|
t.set(layout);
|
|
4267
|
-
}
|
|
4268
4271
|
},
|
|
4269
4272
|
getFlipTransform(t, axis) {
|
|
4270
4273
|
const m = getMatrixData();
|
|
@@ -4947,14 +4950,15 @@ class Eventer {
|
|
|
4947
4950
|
if (list) {
|
|
4948
4951
|
let item;
|
|
4949
4952
|
for (let i = 0, len = list.length; i < len; i++) {
|
|
4950
|
-
item = list[i]
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4953
|
+
if (item = list[i]) {
|
|
4954
|
+
item.listener(event);
|
|
4955
|
+
if (item.once) {
|
|
4956
|
+
this.off(type, item.listener, capture);
|
|
4957
|
+
i--, len--;
|
|
4958
|
+
}
|
|
4959
|
+
if (event && event.isStopNow)
|
|
4960
|
+
break;
|
|
4955
4961
|
}
|
|
4956
|
-
if (event && event.isStopNow)
|
|
4957
|
-
break;
|
|
4958
4962
|
}
|
|
4959
4963
|
}
|
|
4960
4964
|
this.syncEventer && this.syncEventer.emitEvent(event, capture);
|
|
@@ -5431,7 +5435,7 @@ let Leaf = class Leaf {
|
|
|
5431
5435
|
this.__[attrName] = value === undefined ? null : undefined;
|
|
5432
5436
|
this[attrName] = value;
|
|
5433
5437
|
}
|
|
5434
|
-
forceRender(_bounds) {
|
|
5438
|
+
forceRender(_bounds, _sync) {
|
|
5435
5439
|
this.forceUpdate('surface');
|
|
5436
5440
|
}
|
|
5437
5441
|
__updateWorldMatrix() { }
|
|
@@ -6001,7 +6005,7 @@ class LeafLevelList {
|
|
|
6001
6005
|
}
|
|
6002
6006
|
}
|
|
6003
6007
|
|
|
6004
|
-
const version = "1.2.
|
|
6008
|
+
const version = "1.2.2";
|
|
6005
6009
|
|
|
6006
6010
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6007
6011
|
get allowBackgroundColor() { return false; }
|
|
@@ -8040,10 +8044,13 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8040
8044
|
const data = DataHelper.copyAttrs({}, size, canvasSizeAttrs);
|
|
8041
8045
|
Object.keys(data).forEach(key => this[key] = data[key]);
|
|
8042
8046
|
}
|
|
8043
|
-
forceRender(bounds) {
|
|
8044
|
-
|
|
8045
|
-
if (
|
|
8046
|
-
|
|
8047
|
+
forceRender(bounds, sync) {
|
|
8048
|
+
const { renderer } = this;
|
|
8049
|
+
if (renderer) {
|
|
8050
|
+
renderer.addBlock(bounds ? new Bounds(bounds) : this.canvas.bounds);
|
|
8051
|
+
if (this.viewReady)
|
|
8052
|
+
sync ? renderer.render() : renderer.update();
|
|
8053
|
+
}
|
|
8047
8054
|
}
|
|
8048
8055
|
requestRender(change = false) {
|
|
8049
8056
|
if (this.renderer)
|
|
@@ -8160,6 +8167,8 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8160
8167
|
this.requestRender();
|
|
8161
8168
|
}
|
|
8162
8169
|
}
|
|
8170
|
+
else
|
|
8171
|
+
this.requestRender();
|
|
8163
8172
|
}
|
|
8164
8173
|
__checkViewCompleted(emit = true) {
|
|
8165
8174
|
this.nextRender(() => {
|
|
@@ -8725,10 +8734,10 @@ let Canvas = class Canvas extends Rect {
|
|
|
8725
8734
|
__updateSize() {
|
|
8726
8735
|
const { canvas } = this;
|
|
8727
8736
|
if (canvas) {
|
|
8728
|
-
const { smooth } = this.__;
|
|
8737
|
+
const { smooth, safeResize } = this.__;
|
|
8738
|
+
canvas.resize(this.__, safeResize);
|
|
8729
8739
|
if (canvas.smooth !== smooth)
|
|
8730
8740
|
canvas.smooth = smooth;
|
|
8731
|
-
canvas.resize(this.__);
|
|
8732
8741
|
}
|
|
8733
8742
|
}
|
|
8734
8743
|
destroy() {
|
|
@@ -8754,6 +8763,9 @@ __decorate([
|
|
|
8754
8763
|
__decorate([
|
|
8755
8764
|
resizeType(true)
|
|
8756
8765
|
], Canvas.prototype, "smooth", void 0);
|
|
8766
|
+
__decorate([
|
|
8767
|
+
dataType(false)
|
|
8768
|
+
], Canvas.prototype, "safeResize", void 0);
|
|
8757
8769
|
__decorate([
|
|
8758
8770
|
resizeType()
|
|
8759
8771
|
], Canvas.prototype, "contextSettings", void 0);
|
|
@@ -9032,8 +9044,8 @@ let App = class App extends Leafer {
|
|
|
9032
9044
|
super.lockLayout();
|
|
9033
9045
|
this.children.forEach(leafer => leafer.lockLayout());
|
|
9034
9046
|
}
|
|
9035
|
-
forceRender(bounds) {
|
|
9036
|
-
this.children.forEach(leafer => leafer.forceRender(bounds));
|
|
9047
|
+
forceRender(bounds, sync) {
|
|
9048
|
+
this.children.forEach(leafer => leafer.forceRender(bounds, sync));
|
|
9037
9049
|
}
|
|
9038
9050
|
addLeafer(merge) {
|
|
9039
9051
|
const leafer = new Leafer(merge);
|