@leafer-game/worker 1.9.6 → 1.9.7
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/worker.js +45 -14
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +47 -15
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +12 -12
package/dist/worker.js
CHANGED
|
@@ -392,6 +392,15 @@ var LeaferUI = function(exports) {
|
|
|
392
392
|
t.c *= scaleY;
|
|
393
393
|
t.d *= scaleY;
|
|
394
394
|
},
|
|
395
|
+
pixelScale(t, pixelRatio, to) {
|
|
396
|
+
to || (to = t);
|
|
397
|
+
to.a = t.a * pixelRatio;
|
|
398
|
+
to.b = t.b * pixelRatio;
|
|
399
|
+
to.c = t.c * pixelRatio;
|
|
400
|
+
to.d = t.d * pixelRatio;
|
|
401
|
+
to.e = t.e * pixelRatio;
|
|
402
|
+
to.f = t.f * pixelRatio;
|
|
403
|
+
},
|
|
395
404
|
scaleOfOuter(t, origin, scaleX, scaleY) {
|
|
396
405
|
M$7.toInnerPoint(t, origin, tempPoint$4);
|
|
397
406
|
M$7.scaleOfInner(t, tempPoint$4, scaleX, scaleY);
|
|
@@ -882,6 +891,10 @@ var LeaferUI = function(exports) {
|
|
|
882
891
|
this.scaleY *= y || x;
|
|
883
892
|
return this;
|
|
884
893
|
}
|
|
894
|
+
pixelScale(pixelRatio) {
|
|
895
|
+
MatrixHelper.pixelScale(this, pixelRatio);
|
|
896
|
+
return this;
|
|
897
|
+
}
|
|
885
898
|
scaleOfOuter(origin, x, y) {
|
|
886
899
|
MatrixHelper.scaleOfOuter(this, origin, x, y);
|
|
887
900
|
return this;
|
|
@@ -1991,7 +2004,7 @@ var LeaferUI = function(exports) {
|
|
|
1991
2004
|
__decorate([ contextMethod() ], Canvas.prototype, "fillText", null);
|
|
1992
2005
|
__decorate([ contextMethod() ], Canvas.prototype, "measureText", null);
|
|
1993
2006
|
__decorate([ contextMethod() ], Canvas.prototype, "strokeText", null);
|
|
1994
|
-
const {copy: copy$8, multiplyParent: multiplyParent$4} = MatrixHelper, {round: round$4} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
|
|
2007
|
+
const {copy: copy$8, multiplyParent: multiplyParent$4, pixelScale: pixelScale} = MatrixHelper, {round: round$4} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
|
|
1995
2008
|
const minSize = {
|
|
1996
2009
|
width: 1,
|
|
1997
2010
|
height: 1,
|
|
@@ -2089,12 +2102,7 @@ var LeaferUI = function(exports) {
|
|
|
2089
2102
|
setWorld(matrix, parentMatrix) {
|
|
2090
2103
|
const {pixelRatio: pixelRatio, pixelSnap: pixelSnap} = this, w = this.worldTransform;
|
|
2091
2104
|
if (parentMatrix) multiplyParent$4(matrix, parentMatrix, w);
|
|
2092
|
-
|
|
2093
|
-
w.b = matrix.b * pixelRatio;
|
|
2094
|
-
w.c = matrix.c * pixelRatio;
|
|
2095
|
-
w.d = matrix.d * pixelRatio;
|
|
2096
|
-
w.e = matrix.e * pixelRatio;
|
|
2097
|
-
w.f = matrix.f * pixelRatio;
|
|
2105
|
+
pixelScale(matrix, pixelRatio, w);
|
|
2098
2106
|
if (pixelSnap) {
|
|
2099
2107
|
if (matrix.half && matrix.half * pixelRatio % 2) w.e = round$4(w.e - .5) + .5, w.f = round$4(w.f - .5) + .5; else w.e = round$4(w.e),
|
|
2100
2108
|
w.f = round$4(w.f);
|
|
@@ -4008,6 +4016,17 @@ var LeaferUI = function(exports) {
|
|
|
4008
4016
|
}
|
|
4009
4017
|
}));
|
|
4010
4018
|
}
|
|
4019
|
+
function dimType(defaultValue) {
|
|
4020
|
+
return decorateLeafAttr(defaultValue, key => attr({
|
|
4021
|
+
set(value) {
|
|
4022
|
+
if (this.__setAttr(key, value)) {
|
|
4023
|
+
const data = this.__;
|
|
4024
|
+
DataHelper.stintSet(data, "__useDim", data.dim || data.bright || data.dimskip);
|
|
4025
|
+
this.__layout.surfaceChange();
|
|
4026
|
+
}
|
|
4027
|
+
}
|
|
4028
|
+
}));
|
|
4029
|
+
}
|
|
4011
4030
|
function opacityType(defaultValue) {
|
|
4012
4031
|
return decorateLeafAttr(defaultValue, key => attr({
|
|
4013
4032
|
set(value) {
|
|
@@ -4048,7 +4067,7 @@ var LeaferUI = function(exports) {
|
|
|
4048
4067
|
return decorateLeafAttr(defaultValue, key => attr({
|
|
4049
4068
|
set(value) {
|
|
4050
4069
|
if (this.__setAttr(key, value)) {
|
|
4051
|
-
this.__layout.
|
|
4070
|
+
this.__layout.surfaceChange();
|
|
4052
4071
|
this.waitParent(() => {
|
|
4053
4072
|
this.parent.__layout.childrenSortChange();
|
|
4054
4073
|
});
|
|
@@ -4082,7 +4101,7 @@ var LeaferUI = function(exports) {
|
|
|
4082
4101
|
set(value) {
|
|
4083
4102
|
if (this.__setAttr(key, value)) {
|
|
4084
4103
|
this.__layout.hitCanvasChanged = true;
|
|
4085
|
-
if (Debug.showBounds === "hit") this.__layout.
|
|
4104
|
+
if (Debug.showBounds === "hit") this.__layout.surfaceChange();
|
|
4086
4105
|
if (this.leafer) this.leafer.updateCursor();
|
|
4087
4106
|
}
|
|
4088
4107
|
}
|
|
@@ -5480,6 +5499,7 @@ var LeaferUI = function(exports) {
|
|
|
5480
5499
|
if (options.shape) return this.__renderShape(canvas, options);
|
|
5481
5500
|
if (this.__worldOpacity) {
|
|
5482
5501
|
const data = this.__;
|
|
5502
|
+
if (data.bright && !options.topRendering) return options.topList.add(this);
|
|
5483
5503
|
canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
|
|
5484
5504
|
canvas.opacity = options.dimOpacity && !data.dimskip ? data.opacity * options.dimOpacity : data.opacity;
|
|
5485
5505
|
if (this.__.__single) {
|
|
@@ -5526,7 +5546,9 @@ var LeaferUI = function(exports) {
|
|
|
5526
5546
|
this.__nowWorld = this.__getNowWorld(options);
|
|
5527
5547
|
if (this.__worldOpacity) {
|
|
5528
5548
|
const data = this.__;
|
|
5529
|
-
if (data.
|
|
5549
|
+
if (data.__useDim) {
|
|
5550
|
+
if (data.dim) options.dimOpacity = data.dim === true ? .2 : data.dim; else if (data.bright && !options.topRendering) return options.topList.add(this); else if (data.dimskip) options.dimOpacity && (options.dimOpacity = 0);
|
|
5551
|
+
}
|
|
5530
5552
|
if (data.__single && !this.isBranchLeaf) {
|
|
5531
5553
|
if (data.eraser === "path") return this.__renderEraser(canvas, options);
|
|
5532
5554
|
const tempCanvas = canvas.getSameCanvas(false, true);
|
|
@@ -6351,7 +6373,7 @@ var LeaferUI = function(exports) {
|
|
|
6351
6373
|
this.levelMap = null;
|
|
6352
6374
|
}
|
|
6353
6375
|
}
|
|
6354
|
-
const version = "1.9.
|
|
6376
|
+
const version = "1.9.7";
|
|
6355
6377
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6356
6378
|
get allowBackgroundColor() {
|
|
6357
6379
|
return true;
|
|
@@ -6878,7 +6900,7 @@ var LeaferUI = function(exports) {
|
|
|
6878
6900
|
};
|
|
6879
6901
|
if (this.needFill) canvas.fillWorld(bounds, this.config.fill);
|
|
6880
6902
|
if (Debug.showRepaint) Debug.drawRepaint(canvas, bounds);
|
|
6881
|
-
this.target
|
|
6903
|
+
Platform.render(this.target, canvas, options);
|
|
6882
6904
|
this.renderBounds = realBounds = realBounds || bounds;
|
|
6883
6905
|
this.renderOptions = options;
|
|
6884
6906
|
this.totalBounds.isEmpty() ? this.totalBounds = realBounds : this.totalBounds.add(realBounds);
|
|
@@ -7147,6 +7169,14 @@ var LeaferUI = function(exports) {
|
|
|
7147
7169
|
selector: (target, options) => new Selector(target, options)
|
|
7148
7170
|
});
|
|
7149
7171
|
Platform.layout = Layouter.fullLayout;
|
|
7172
|
+
Platform.render = function(target, canvas, options) {
|
|
7173
|
+
const topOptions = Object.assign(Object.assign({}, options), {
|
|
7174
|
+
topRendering: true
|
|
7175
|
+
});
|
|
7176
|
+
options.topList = new LeafList;
|
|
7177
|
+
target.__render(canvas, options);
|
|
7178
|
+
if (options.topList.length) options.topList.forEach(item => item.__render(canvas, topOptions));
|
|
7179
|
+
};
|
|
7150
7180
|
function effectType(defaultValue) {
|
|
7151
7181
|
return decorateLeafAttr(defaultValue, key => attr({
|
|
7152
7182
|
set(value) {
|
|
@@ -7864,8 +7894,8 @@ var LeaferUI = function(exports) {
|
|
|
7864
7894
|
__decorate([ opacityType(1) ], exports.UI.prototype, "opacity", void 0);
|
|
7865
7895
|
__decorate([ visibleType(true) ], exports.UI.prototype, "visible", void 0);
|
|
7866
7896
|
__decorate([ surfaceType(false) ], exports.UI.prototype, "locked", void 0);
|
|
7867
|
-
__decorate([
|
|
7868
|
-
__decorate([
|
|
7897
|
+
__decorate([ dimType(false) ], exports.UI.prototype, "dim", void 0);
|
|
7898
|
+
__decorate([ dimType(false) ], exports.UI.prototype, "dimskip", void 0);
|
|
7869
7899
|
__decorate([ sortType(0) ], exports.UI.prototype, "zIndex", void 0);
|
|
7870
7900
|
__decorate([ maskType(false) ], exports.UI.prototype, "mask", void 0);
|
|
7871
7901
|
__decorate([ eraserType(false) ], exports.UI.prototype, "eraser", void 0);
|
|
@@ -13658,6 +13688,7 @@ var LeaferUI = function(exports) {
|
|
|
13658
13688
|
exports.defineDataProcessor = defineDataProcessor;
|
|
13659
13689
|
exports.defineKey = defineKey;
|
|
13660
13690
|
exports.defineLeafAttr = defineLeafAttr;
|
|
13691
|
+
exports.dimType = dimType;
|
|
13661
13692
|
exports.doBoundsType = doBoundsType;
|
|
13662
13693
|
exports.doStrokeType = doStrokeType;
|
|
13663
13694
|
exports.effectType = effectType;
|