@leafer/core 1.0.0 → 1.0.1
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/lib/core.cjs +55 -27
- package/lib/core.esm.js +55 -27
- package/lib/core.esm.min.js +1 -1
- package/lib/core.min.cjs +1 -1
- package/package.json +18 -18
- package/src/index.ts +1 -1
- package/types/index.d.ts +1 -1
package/lib/core.cjs
CHANGED
|
@@ -50,6 +50,8 @@ const I$1 = IncrementId;
|
|
|
50
50
|
const { round, pow: pow$1, PI: PI$2 } = Math;
|
|
51
51
|
const MathHelper = {
|
|
52
52
|
within(value, min, max) {
|
|
53
|
+
if (typeof min === 'object')
|
|
54
|
+
max = min.max, min = min.min;
|
|
53
55
|
if (min !== undefined && value < min)
|
|
54
56
|
value = min;
|
|
55
57
|
if (max !== undefined && value > max)
|
|
@@ -152,10 +154,10 @@ const MatrixHelper = {
|
|
|
152
154
|
t.e += x;
|
|
153
155
|
t.f += y;
|
|
154
156
|
},
|
|
155
|
-
translateInner(t, x, y,
|
|
157
|
+
translateInner(t, x, y, hasOrigin) {
|
|
156
158
|
t.e += t.a * x + t.c * y;
|
|
157
159
|
t.f += t.b * x + t.d * y;
|
|
158
|
-
if (
|
|
160
|
+
if (hasOrigin)
|
|
159
161
|
t.e -= x, t.f -= y;
|
|
160
162
|
},
|
|
161
163
|
scale(t, scaleX, scaleY = scaleX) {
|
|
@@ -314,7 +316,7 @@ const MatrixHelper = {
|
|
|
314
316
|
to.y -= (f * a - e * b) * s;
|
|
315
317
|
}
|
|
316
318
|
},
|
|
317
|
-
setLayout(t, layout, origin, bcChanged) {
|
|
319
|
+
setLayout(t, layout, origin, around, bcChanged) {
|
|
318
320
|
const { x, y, scaleX, scaleY } = layout;
|
|
319
321
|
if (bcChanged === undefined)
|
|
320
322
|
bcChanged = layout.rotation || layout.skewX || layout.skewY;
|
|
@@ -346,10 +348,10 @@ const MatrixHelper = {
|
|
|
346
348
|
}
|
|
347
349
|
t.e = x;
|
|
348
350
|
t.f = y;
|
|
349
|
-
if (origin)
|
|
350
|
-
M$6.translateInner(t, -origin.x, -origin.y,
|
|
351
|
+
if (origin = origin || around)
|
|
352
|
+
M$6.translateInner(t, -origin.x, -origin.y, !around);
|
|
351
353
|
},
|
|
352
|
-
getLayout(t, origin, firstSkewY) {
|
|
354
|
+
getLayout(t, origin, around, firstSkewY) {
|
|
353
355
|
const { a, b, c, d, e, f } = t;
|
|
354
356
|
let x = e, y = f, scaleX, scaleY, rotation, skewX, skewY;
|
|
355
357
|
if (b || c) {
|
|
@@ -378,9 +380,11 @@ const MatrixHelper = {
|
|
|
378
380
|
scaleY = d;
|
|
379
381
|
rotation = skewX = skewY = 0;
|
|
380
382
|
}
|
|
381
|
-
if (origin) {
|
|
383
|
+
if (origin = around || origin) {
|
|
382
384
|
x += origin.x * a + origin.y * c;
|
|
383
385
|
y += origin.x * b + origin.y * d;
|
|
386
|
+
if (!around)
|
|
387
|
+
x -= origin.x, y -= origin.y;
|
|
384
388
|
}
|
|
385
389
|
return { x, y, scaleX, scaleY, rotation, skewX, skewY };
|
|
386
390
|
},
|
|
@@ -708,12 +712,12 @@ class Matrix {
|
|
|
708
712
|
toInnerPoint(outer, to, distance) {
|
|
709
713
|
MatrixHelper.toInnerPoint(this, outer, to, distance);
|
|
710
714
|
}
|
|
711
|
-
setLayout(data, origin) {
|
|
712
|
-
MatrixHelper.setLayout(this, data, origin);
|
|
715
|
+
setLayout(data, origin, around) {
|
|
716
|
+
MatrixHelper.setLayout(this, data, origin, around);
|
|
713
717
|
return this;
|
|
714
718
|
}
|
|
715
|
-
getLayout(origin, firstSkewY) {
|
|
716
|
-
return MatrixHelper.getLayout(this, origin, firstSkewY);
|
|
719
|
+
getLayout(origin, around, firstSkewY) {
|
|
720
|
+
return MatrixHelper.getLayout(this, origin, around, firstSkewY);
|
|
717
721
|
}
|
|
718
722
|
withScale(scaleX, scaleY) {
|
|
719
723
|
return MatrixHelper.withScale(this, scaleX, scaleY);
|
|
@@ -2001,7 +2005,7 @@ class LeaferCanvasBase extends Canvas {
|
|
|
2001
2005
|
DataHelper.copyAttrs(this.size, size, canvasSizeAttrs);
|
|
2002
2006
|
this.size.pixelRatio || (this.size.pixelRatio = 1);
|
|
2003
2007
|
this.bounds = new Bounds(0, 0, this.width, this.height);
|
|
2004
|
-
if (!this.unreal) {
|
|
2008
|
+
if (this.context && !this.unreal) {
|
|
2005
2009
|
this.updateViewSize();
|
|
2006
2010
|
this.smooth = this.config.smooth;
|
|
2007
2011
|
}
|
|
@@ -2174,7 +2178,7 @@ class LeaferCanvasBase extends Canvas {
|
|
|
2174
2178
|
this.manager ? this.manager.recycle(this) : this.destroy();
|
|
2175
2179
|
}
|
|
2176
2180
|
}
|
|
2177
|
-
updateRender() { }
|
|
2181
|
+
updateRender(_bounds) { }
|
|
2178
2182
|
unrealCanvas() { }
|
|
2179
2183
|
destroy() {
|
|
2180
2184
|
this.manager = this.view = this.parentView = null;
|
|
@@ -4068,8 +4072,13 @@ const LeafHelper = {
|
|
|
4068
4072
|
zoomOfLocal(t, origin, scaleX, scaleY = scaleX, resize) {
|
|
4069
4073
|
copy$3(matrix, t.__localMatrix);
|
|
4070
4074
|
scaleOfOuter(matrix, origin, scaleX, scaleY);
|
|
4071
|
-
|
|
4072
|
-
|
|
4075
|
+
if (t.origin || t.around) {
|
|
4076
|
+
L.setTransform(t, matrix, resize);
|
|
4077
|
+
}
|
|
4078
|
+
else {
|
|
4079
|
+
moveByMatrix(t, matrix);
|
|
4080
|
+
t.scaleResize(scaleX, scaleY, resize !== true);
|
|
4081
|
+
}
|
|
4073
4082
|
},
|
|
4074
4083
|
rotateOfWorld(t, origin, angle) {
|
|
4075
4084
|
L.rotateOfLocal(t, getTempLocal(t, origin), angle);
|
|
@@ -4077,8 +4086,13 @@ const LeafHelper = {
|
|
|
4077
4086
|
rotateOfLocal(t, origin, angle) {
|
|
4078
4087
|
copy$3(matrix, t.__localMatrix);
|
|
4079
4088
|
rotateOfOuter(matrix, origin, angle);
|
|
4080
|
-
|
|
4081
|
-
|
|
4089
|
+
if (t.origin || t.around) {
|
|
4090
|
+
L.setTransform(t, matrix);
|
|
4091
|
+
}
|
|
4092
|
+
else {
|
|
4093
|
+
moveByMatrix(t, matrix);
|
|
4094
|
+
t.rotation = MathHelper.formatRotation(t.rotation + angle);
|
|
4095
|
+
}
|
|
4082
4096
|
},
|
|
4083
4097
|
skewOfWorld(t, origin, skewX, skewY, resize) {
|
|
4084
4098
|
L.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize);
|
|
@@ -4101,7 +4115,7 @@ const LeafHelper = {
|
|
|
4101
4115
|
L.setTransform(t, matrix, resize);
|
|
4102
4116
|
},
|
|
4103
4117
|
setTransform(t, transform, resize) {
|
|
4104
|
-
const layout = getLayout(transform);
|
|
4118
|
+
const layout = getLayout(transform, t.origin && L.getInnerOrigin(t, t.origin), t.around && L.getInnerOrigin(t, t.around));
|
|
4105
4119
|
if (resize) {
|
|
4106
4120
|
const scaleX = layout.scaleX / t.scaleX;
|
|
4107
4121
|
const scaleY = layout.scaleY / t.scaleY;
|
|
@@ -4114,13 +4128,19 @@ const LeafHelper = {
|
|
|
4114
4128
|
t.set(layout);
|
|
4115
4129
|
}
|
|
4116
4130
|
},
|
|
4131
|
+
getFlipTransform(t, axis) {
|
|
4132
|
+
const m = getMatrixData();
|
|
4133
|
+
const sign = axis === 'x' ? 1 : -1;
|
|
4134
|
+
scaleOfOuter(m, L.getLocalOrigin(t, 'center'), -1 * sign, 1 * sign);
|
|
4135
|
+
return m;
|
|
4136
|
+
},
|
|
4117
4137
|
getLocalOrigin(t, origin) {
|
|
4118
4138
|
return PointHelper.tempToOuterOf(L.getInnerOrigin(t, origin), t.localTransform);
|
|
4119
4139
|
},
|
|
4120
4140
|
getInnerOrigin(t, origin) {
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
return
|
|
4141
|
+
const innerOrigin = {};
|
|
4142
|
+
AroundHelper.toPoint(origin, t.boxBounds, innerOrigin);
|
|
4143
|
+
return innerOrigin;
|
|
4124
4144
|
},
|
|
4125
4145
|
getRelativeWorld(t, relative, temp) {
|
|
4126
4146
|
copy$3(matrix, t.worldTransform);
|
|
@@ -4547,7 +4567,10 @@ const LeafEventer = {
|
|
|
4547
4567
|
on(type, listener, options) {
|
|
4548
4568
|
let capture, once;
|
|
4549
4569
|
if (options) {
|
|
4550
|
-
if (
|
|
4570
|
+
if (options === 'once') {
|
|
4571
|
+
once = true;
|
|
4572
|
+
}
|
|
4573
|
+
else if (typeof options === 'boolean') {
|
|
4551
4574
|
capture = options;
|
|
4552
4575
|
}
|
|
4553
4576
|
else {
|
|
@@ -4578,7 +4601,7 @@ const LeafEventer = {
|
|
|
4578
4601
|
if (listener) {
|
|
4579
4602
|
let capture;
|
|
4580
4603
|
if (options)
|
|
4581
|
-
capture = typeof options === 'boolean' ? options : options.capture;
|
|
4604
|
+
capture = typeof options === 'boolean' ? options : (options === 'once' ? false : options.capture);
|
|
4582
4605
|
let events, index;
|
|
4583
4606
|
const map = __getListenerMap(this, capture);
|
|
4584
4607
|
typeList.forEach(type => {
|
|
@@ -4880,7 +4903,7 @@ const LeafMatrix = {
|
|
|
4880
4903
|
const layout = this.__layout, local = this.__local, data = this.__;
|
|
4881
4904
|
if (layout.affectScaleOrRotation) {
|
|
4882
4905
|
if (layout.scaleChanged || layout.rotationChanged) {
|
|
4883
|
-
setLayout(local, data, null, layout.affectRotation);
|
|
4906
|
+
setLayout(local, data, null, null, layout.affectRotation);
|
|
4884
4907
|
layout.scaleChanged = layout.rotationChanged = false;
|
|
4885
4908
|
}
|
|
4886
4909
|
}
|
|
@@ -4888,7 +4911,7 @@ const LeafMatrix = {
|
|
|
4888
4911
|
local.f = data.y + data.offsetY;
|
|
4889
4912
|
if (data.around || data.origin) {
|
|
4890
4913
|
toPoint(data.around || data.origin, layout.boxBounds, tempPoint);
|
|
4891
|
-
translateInner(local, -tempPoint.x, -tempPoint.y, data.
|
|
4914
|
+
translateInner(local, -tempPoint.x, -tempPoint.y, !data.around);
|
|
4892
4915
|
}
|
|
4893
4916
|
}
|
|
4894
4917
|
this.__layout.matrixChanged = false;
|
|
@@ -5117,7 +5140,7 @@ const { LEAF, create } = IncrementId;
|
|
|
5117
5140
|
const { toInnerPoint, toOuterPoint, multiplyParent } = MatrixHelper;
|
|
5118
5141
|
const { toOuterOf } = BoundsHelper;
|
|
5119
5142
|
const { copy } = PointHelper;
|
|
5120
|
-
const { moveLocal, zoomOfLocal, rotateOfLocal, skewOfLocal, moveWorld, zoomOfWorld, rotateOfWorld, skewOfWorld, transform, transformWorld, setTransform, getLocalOrigin, getRelativeWorld, drop } = LeafHelper;
|
|
5143
|
+
const { moveLocal, zoomOfLocal, rotateOfLocal, skewOfLocal, moveWorld, zoomOfWorld, rotateOfWorld, skewOfWorld, transform, transformWorld, setTransform, getFlipTransform, getLocalOrigin, getRelativeWorld, drop } = LeafHelper;
|
|
5121
5144
|
exports.Leaf = class Leaf {
|
|
5122
5145
|
get tag() { return this.__tag; }
|
|
5123
5146
|
set tag(_value) { }
|
|
@@ -5143,6 +5166,8 @@ exports.Leaf = class Leaf {
|
|
|
5143
5166
|
get __ignoreHitWorld() { return (this.__hasMask || this.__hasEraser) && this.__.hitChildren; }
|
|
5144
5167
|
get __inLazyBounds() { const { leafer } = this; return leafer && leafer.created && leafer.lazyBounds.hit(this.__world); }
|
|
5145
5168
|
get pathInputed() { return this.__.__pathInputed; }
|
|
5169
|
+
set event(map) { let event; for (let key in map)
|
|
5170
|
+
event = map[key], event instanceof Array ? this.on(key, event[0], event[1]) : this.on(key, event); }
|
|
5146
5171
|
constructor(data) {
|
|
5147
5172
|
this.innerId = create(LEAF);
|
|
5148
5173
|
this.reset(data);
|
|
@@ -5402,6 +5427,9 @@ exports.Leaf = class Leaf {
|
|
|
5402
5427
|
skewOfWorld(worldOrigin, skewX, skewY, resize) {
|
|
5403
5428
|
skewOfWorld(this, worldOrigin, skewX, skewY, resize);
|
|
5404
5429
|
}
|
|
5430
|
+
flip(axis) {
|
|
5431
|
+
transform(this, getFlipTransform(this, axis));
|
|
5432
|
+
}
|
|
5405
5433
|
scaleResize(scaleX, scaleY = scaleX, _noResize) {
|
|
5406
5434
|
this.scaleX *= scaleX;
|
|
5407
5435
|
this.scaleY *= scaleY;
|
|
@@ -5759,7 +5787,7 @@ class LeafLevelList {
|
|
|
5759
5787
|
}
|
|
5760
5788
|
}
|
|
5761
5789
|
|
|
5762
|
-
const version = "1.0.
|
|
5790
|
+
const version = "1.0.1";
|
|
5763
5791
|
const inviteCode = {};
|
|
5764
5792
|
|
|
5765
5793
|
exports.AlignHelper = AlignHelper;
|
package/lib/core.esm.js
CHANGED
|
@@ -48,6 +48,8 @@ const I$1 = IncrementId;
|
|
|
48
48
|
const { round, pow: pow$1, PI: PI$2 } = Math;
|
|
49
49
|
const MathHelper = {
|
|
50
50
|
within(value, min, max) {
|
|
51
|
+
if (typeof min === 'object')
|
|
52
|
+
max = min.max, min = min.min;
|
|
51
53
|
if (min !== undefined && value < min)
|
|
52
54
|
value = min;
|
|
53
55
|
if (max !== undefined && value > max)
|
|
@@ -150,10 +152,10 @@ const MatrixHelper = {
|
|
|
150
152
|
t.e += x;
|
|
151
153
|
t.f += y;
|
|
152
154
|
},
|
|
153
|
-
translateInner(t, x, y,
|
|
155
|
+
translateInner(t, x, y, hasOrigin) {
|
|
154
156
|
t.e += t.a * x + t.c * y;
|
|
155
157
|
t.f += t.b * x + t.d * y;
|
|
156
|
-
if (
|
|
158
|
+
if (hasOrigin)
|
|
157
159
|
t.e -= x, t.f -= y;
|
|
158
160
|
},
|
|
159
161
|
scale(t, scaleX, scaleY = scaleX) {
|
|
@@ -312,7 +314,7 @@ const MatrixHelper = {
|
|
|
312
314
|
to.y -= (f * a - e * b) * s;
|
|
313
315
|
}
|
|
314
316
|
},
|
|
315
|
-
setLayout(t, layout, origin, bcChanged) {
|
|
317
|
+
setLayout(t, layout, origin, around, bcChanged) {
|
|
316
318
|
const { x, y, scaleX, scaleY } = layout;
|
|
317
319
|
if (bcChanged === undefined)
|
|
318
320
|
bcChanged = layout.rotation || layout.skewX || layout.skewY;
|
|
@@ -344,10 +346,10 @@ const MatrixHelper = {
|
|
|
344
346
|
}
|
|
345
347
|
t.e = x;
|
|
346
348
|
t.f = y;
|
|
347
|
-
if (origin)
|
|
348
|
-
M$6.translateInner(t, -origin.x, -origin.y,
|
|
349
|
+
if (origin = origin || around)
|
|
350
|
+
M$6.translateInner(t, -origin.x, -origin.y, !around);
|
|
349
351
|
},
|
|
350
|
-
getLayout(t, origin, firstSkewY) {
|
|
352
|
+
getLayout(t, origin, around, firstSkewY) {
|
|
351
353
|
const { a, b, c, d, e, f } = t;
|
|
352
354
|
let x = e, y = f, scaleX, scaleY, rotation, skewX, skewY;
|
|
353
355
|
if (b || c) {
|
|
@@ -376,9 +378,11 @@ const MatrixHelper = {
|
|
|
376
378
|
scaleY = d;
|
|
377
379
|
rotation = skewX = skewY = 0;
|
|
378
380
|
}
|
|
379
|
-
if (origin) {
|
|
381
|
+
if (origin = around || origin) {
|
|
380
382
|
x += origin.x * a + origin.y * c;
|
|
381
383
|
y += origin.x * b + origin.y * d;
|
|
384
|
+
if (!around)
|
|
385
|
+
x -= origin.x, y -= origin.y;
|
|
382
386
|
}
|
|
383
387
|
return { x, y, scaleX, scaleY, rotation, skewX, skewY };
|
|
384
388
|
},
|
|
@@ -706,12 +710,12 @@ class Matrix {
|
|
|
706
710
|
toInnerPoint(outer, to, distance) {
|
|
707
711
|
MatrixHelper.toInnerPoint(this, outer, to, distance);
|
|
708
712
|
}
|
|
709
|
-
setLayout(data, origin) {
|
|
710
|
-
MatrixHelper.setLayout(this, data, origin);
|
|
713
|
+
setLayout(data, origin, around) {
|
|
714
|
+
MatrixHelper.setLayout(this, data, origin, around);
|
|
711
715
|
return this;
|
|
712
716
|
}
|
|
713
|
-
getLayout(origin, firstSkewY) {
|
|
714
|
-
return MatrixHelper.getLayout(this, origin, firstSkewY);
|
|
717
|
+
getLayout(origin, around, firstSkewY) {
|
|
718
|
+
return MatrixHelper.getLayout(this, origin, around, firstSkewY);
|
|
715
719
|
}
|
|
716
720
|
withScale(scaleX, scaleY) {
|
|
717
721
|
return MatrixHelper.withScale(this, scaleX, scaleY);
|
|
@@ -1999,7 +2003,7 @@ class LeaferCanvasBase extends Canvas {
|
|
|
1999
2003
|
DataHelper.copyAttrs(this.size, size, canvasSizeAttrs);
|
|
2000
2004
|
this.size.pixelRatio || (this.size.pixelRatio = 1);
|
|
2001
2005
|
this.bounds = new Bounds(0, 0, this.width, this.height);
|
|
2002
|
-
if (!this.unreal) {
|
|
2006
|
+
if (this.context && !this.unreal) {
|
|
2003
2007
|
this.updateViewSize();
|
|
2004
2008
|
this.smooth = this.config.smooth;
|
|
2005
2009
|
}
|
|
@@ -2172,7 +2176,7 @@ class LeaferCanvasBase extends Canvas {
|
|
|
2172
2176
|
this.manager ? this.manager.recycle(this) : this.destroy();
|
|
2173
2177
|
}
|
|
2174
2178
|
}
|
|
2175
|
-
updateRender() { }
|
|
2179
|
+
updateRender(_bounds) { }
|
|
2176
2180
|
unrealCanvas() { }
|
|
2177
2181
|
destroy() {
|
|
2178
2182
|
this.manager = this.view = this.parentView = null;
|
|
@@ -4066,8 +4070,13 @@ const LeafHelper = {
|
|
|
4066
4070
|
zoomOfLocal(t, origin, scaleX, scaleY = scaleX, resize) {
|
|
4067
4071
|
copy$3(matrix, t.__localMatrix);
|
|
4068
4072
|
scaleOfOuter(matrix, origin, scaleX, scaleY);
|
|
4069
|
-
|
|
4070
|
-
|
|
4073
|
+
if (t.origin || t.around) {
|
|
4074
|
+
L.setTransform(t, matrix, resize);
|
|
4075
|
+
}
|
|
4076
|
+
else {
|
|
4077
|
+
moveByMatrix(t, matrix);
|
|
4078
|
+
t.scaleResize(scaleX, scaleY, resize !== true);
|
|
4079
|
+
}
|
|
4071
4080
|
},
|
|
4072
4081
|
rotateOfWorld(t, origin, angle) {
|
|
4073
4082
|
L.rotateOfLocal(t, getTempLocal(t, origin), angle);
|
|
@@ -4075,8 +4084,13 @@ const LeafHelper = {
|
|
|
4075
4084
|
rotateOfLocal(t, origin, angle) {
|
|
4076
4085
|
copy$3(matrix, t.__localMatrix);
|
|
4077
4086
|
rotateOfOuter(matrix, origin, angle);
|
|
4078
|
-
|
|
4079
|
-
|
|
4087
|
+
if (t.origin || t.around) {
|
|
4088
|
+
L.setTransform(t, matrix);
|
|
4089
|
+
}
|
|
4090
|
+
else {
|
|
4091
|
+
moveByMatrix(t, matrix);
|
|
4092
|
+
t.rotation = MathHelper.formatRotation(t.rotation + angle);
|
|
4093
|
+
}
|
|
4080
4094
|
},
|
|
4081
4095
|
skewOfWorld(t, origin, skewX, skewY, resize) {
|
|
4082
4096
|
L.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize);
|
|
@@ -4099,7 +4113,7 @@ const LeafHelper = {
|
|
|
4099
4113
|
L.setTransform(t, matrix, resize);
|
|
4100
4114
|
},
|
|
4101
4115
|
setTransform(t, transform, resize) {
|
|
4102
|
-
const layout = getLayout(transform);
|
|
4116
|
+
const layout = getLayout(transform, t.origin && L.getInnerOrigin(t, t.origin), t.around && L.getInnerOrigin(t, t.around));
|
|
4103
4117
|
if (resize) {
|
|
4104
4118
|
const scaleX = layout.scaleX / t.scaleX;
|
|
4105
4119
|
const scaleY = layout.scaleY / t.scaleY;
|
|
@@ -4112,13 +4126,19 @@ const LeafHelper = {
|
|
|
4112
4126
|
t.set(layout);
|
|
4113
4127
|
}
|
|
4114
4128
|
},
|
|
4129
|
+
getFlipTransform(t, axis) {
|
|
4130
|
+
const m = getMatrixData();
|
|
4131
|
+
const sign = axis === 'x' ? 1 : -1;
|
|
4132
|
+
scaleOfOuter(m, L.getLocalOrigin(t, 'center'), -1 * sign, 1 * sign);
|
|
4133
|
+
return m;
|
|
4134
|
+
},
|
|
4115
4135
|
getLocalOrigin(t, origin) {
|
|
4116
4136
|
return PointHelper.tempToOuterOf(L.getInnerOrigin(t, origin), t.localTransform);
|
|
4117
4137
|
},
|
|
4118
4138
|
getInnerOrigin(t, origin) {
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
return
|
|
4139
|
+
const innerOrigin = {};
|
|
4140
|
+
AroundHelper.toPoint(origin, t.boxBounds, innerOrigin);
|
|
4141
|
+
return innerOrigin;
|
|
4122
4142
|
},
|
|
4123
4143
|
getRelativeWorld(t, relative, temp) {
|
|
4124
4144
|
copy$3(matrix, t.worldTransform);
|
|
@@ -4545,7 +4565,10 @@ const LeafEventer = {
|
|
|
4545
4565
|
on(type, listener, options) {
|
|
4546
4566
|
let capture, once;
|
|
4547
4567
|
if (options) {
|
|
4548
|
-
if (
|
|
4568
|
+
if (options === 'once') {
|
|
4569
|
+
once = true;
|
|
4570
|
+
}
|
|
4571
|
+
else if (typeof options === 'boolean') {
|
|
4549
4572
|
capture = options;
|
|
4550
4573
|
}
|
|
4551
4574
|
else {
|
|
@@ -4576,7 +4599,7 @@ const LeafEventer = {
|
|
|
4576
4599
|
if (listener) {
|
|
4577
4600
|
let capture;
|
|
4578
4601
|
if (options)
|
|
4579
|
-
capture = typeof options === 'boolean' ? options : options.capture;
|
|
4602
|
+
capture = typeof options === 'boolean' ? options : (options === 'once' ? false : options.capture);
|
|
4580
4603
|
let events, index;
|
|
4581
4604
|
const map = __getListenerMap(this, capture);
|
|
4582
4605
|
typeList.forEach(type => {
|
|
@@ -4878,7 +4901,7 @@ const LeafMatrix = {
|
|
|
4878
4901
|
const layout = this.__layout, local = this.__local, data = this.__;
|
|
4879
4902
|
if (layout.affectScaleOrRotation) {
|
|
4880
4903
|
if (layout.scaleChanged || layout.rotationChanged) {
|
|
4881
|
-
setLayout(local, data, null, layout.affectRotation);
|
|
4904
|
+
setLayout(local, data, null, null, layout.affectRotation);
|
|
4882
4905
|
layout.scaleChanged = layout.rotationChanged = false;
|
|
4883
4906
|
}
|
|
4884
4907
|
}
|
|
@@ -4886,7 +4909,7 @@ const LeafMatrix = {
|
|
|
4886
4909
|
local.f = data.y + data.offsetY;
|
|
4887
4910
|
if (data.around || data.origin) {
|
|
4888
4911
|
toPoint(data.around || data.origin, layout.boxBounds, tempPoint);
|
|
4889
|
-
translateInner(local, -tempPoint.x, -tempPoint.y, data.
|
|
4912
|
+
translateInner(local, -tempPoint.x, -tempPoint.y, !data.around);
|
|
4890
4913
|
}
|
|
4891
4914
|
}
|
|
4892
4915
|
this.__layout.matrixChanged = false;
|
|
@@ -5115,7 +5138,7 @@ const { LEAF, create } = IncrementId;
|
|
|
5115
5138
|
const { toInnerPoint, toOuterPoint, multiplyParent } = MatrixHelper;
|
|
5116
5139
|
const { toOuterOf } = BoundsHelper;
|
|
5117
5140
|
const { copy } = PointHelper;
|
|
5118
|
-
const { moveLocal, zoomOfLocal, rotateOfLocal, skewOfLocal, moveWorld, zoomOfWorld, rotateOfWorld, skewOfWorld, transform, transformWorld, setTransform, getLocalOrigin, getRelativeWorld, drop } = LeafHelper;
|
|
5141
|
+
const { moveLocal, zoomOfLocal, rotateOfLocal, skewOfLocal, moveWorld, zoomOfWorld, rotateOfWorld, skewOfWorld, transform, transformWorld, setTransform, getFlipTransform, getLocalOrigin, getRelativeWorld, drop } = LeafHelper;
|
|
5119
5142
|
let Leaf = class Leaf {
|
|
5120
5143
|
get tag() { return this.__tag; }
|
|
5121
5144
|
set tag(_value) { }
|
|
@@ -5141,6 +5164,8 @@ let Leaf = class Leaf {
|
|
|
5141
5164
|
get __ignoreHitWorld() { return (this.__hasMask || this.__hasEraser) && this.__.hitChildren; }
|
|
5142
5165
|
get __inLazyBounds() { const { leafer } = this; return leafer && leafer.created && leafer.lazyBounds.hit(this.__world); }
|
|
5143
5166
|
get pathInputed() { return this.__.__pathInputed; }
|
|
5167
|
+
set event(map) { let event; for (let key in map)
|
|
5168
|
+
event = map[key], event instanceof Array ? this.on(key, event[0], event[1]) : this.on(key, event); }
|
|
5144
5169
|
constructor(data) {
|
|
5145
5170
|
this.innerId = create(LEAF);
|
|
5146
5171
|
this.reset(data);
|
|
@@ -5400,6 +5425,9 @@ let Leaf = class Leaf {
|
|
|
5400
5425
|
skewOfWorld(worldOrigin, skewX, skewY, resize) {
|
|
5401
5426
|
skewOfWorld(this, worldOrigin, skewX, skewY, resize);
|
|
5402
5427
|
}
|
|
5428
|
+
flip(axis) {
|
|
5429
|
+
transform(this, getFlipTransform(this, axis));
|
|
5430
|
+
}
|
|
5403
5431
|
scaleResize(scaleX, scaleY = scaleX, _noResize) {
|
|
5404
5432
|
this.scaleX *= scaleX;
|
|
5405
5433
|
this.scaleY *= scaleY;
|
|
@@ -5757,7 +5785,7 @@ class LeafLevelList {
|
|
|
5757
5785
|
}
|
|
5758
5786
|
}
|
|
5759
5787
|
|
|
5760
|
-
const version = "1.0.
|
|
5788
|
+
const version = "1.0.1";
|
|
5761
5789
|
const inviteCode = {};
|
|
5762
5790
|
|
|
5763
5791
|
export { AlignHelper, AnimateEvent, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Branch, BranchHelper, BranchRender, CanvasManager, ChildEvent, Creator, DataHelper, Debug, Direction4, Direction9, EllipseHelper, Event, EventCreator, FileHelper, ImageEvent, ImageManager, IncrementId, LayoutEvent, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, LeaferCanvasBase, LeaferEvent, LeaferImage, MathHelper, Matrix, MatrixHelper, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Platform, Point, PointHelper, PropertyEvent, RectHelper, RenderEvent, ResizeEvent, Run, StringNumberMap, TaskItem, TaskProcessor, TwoPointBoundsHelper, UICreator, WaitHelper, WatchEvent, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, inviteCode, layoutProcessor, maskType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, rewrite, rewriteAble, rotationType, scaleType, sortType, strokeType, surfaceType, tempBounds, tempMatrix, tempPoint$2 as tempPoint, useModule, version, visibleType };
|