@leafer-ui/worker 1.0.2 → 1.0.4
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.cjs +34 -21
- package/dist/worker.esm.js +35 -22
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.js +412 -361
- package/dist/worker.min.cjs +1 -1
- package/dist/worker.min.js +1 -1
- package/dist/worker.module.js +409 -358
- package/dist/worker.module.min.js +1 -1
- package/package.json +9 -9
- package/src/index.ts +2 -0
- package/types/index.d.ts +1 -0
package/dist/worker.js
CHANGED
|
@@ -122,11 +122,18 @@ var LeaferUI = (function (exports) {
|
|
|
122
122
|
scaleData.scaleX = (typeof size === 'number' ? size : size.width) / originSize.width;
|
|
123
123
|
scaleData.scaleY = (typeof size === 'number' ? size : size.height) / originSize.height;
|
|
124
124
|
}
|
|
125
|
-
else if (scale)
|
|
126
|
-
scaleData
|
|
127
|
-
scaleData.scaleY = typeof scale === 'number' ? scale : scale.y;
|
|
128
|
-
}
|
|
125
|
+
else if (scale)
|
|
126
|
+
MathHelper.assignScale(scaleData, scale);
|
|
129
127
|
return scaleData;
|
|
128
|
+
},
|
|
129
|
+
assignScale(scaleData, scale) {
|
|
130
|
+
if (typeof scale === 'number') {
|
|
131
|
+
scaleData.scaleX = scaleData.scaleY = scale;
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
scaleData.scaleX = scale.x;
|
|
135
|
+
scaleData.scaleY = scale.y;
|
|
136
|
+
}
|
|
130
137
|
}
|
|
131
138
|
};
|
|
132
139
|
const OneRadian = PI$4 / 180;
|
|
@@ -1258,7 +1265,6 @@ var LeaferUI = (function (exports) {
|
|
|
1258
1265
|
tempPoint: {},
|
|
1259
1266
|
get: get$4,
|
|
1260
1267
|
toPoint(around, bounds, to, onlySize, pointBounds) {
|
|
1261
|
-
to || (to = {});
|
|
1262
1268
|
const point = get$4(around);
|
|
1263
1269
|
to.x = point.x;
|
|
1264
1270
|
to.y = point.y;
|
|
@@ -1393,6 +1399,10 @@ var LeaferUI = (function (exports) {
|
|
|
1393
1399
|
};
|
|
1394
1400
|
const R = Run;
|
|
1395
1401
|
|
|
1402
|
+
function needPlugin(name) {
|
|
1403
|
+
console.error('need plugin: @leafer-in/' + name);
|
|
1404
|
+
}
|
|
1405
|
+
|
|
1396
1406
|
const debug$e = Debug.get('UICreator');
|
|
1397
1407
|
const UICreator = {
|
|
1398
1408
|
list: {},
|
|
@@ -1655,6 +1665,9 @@ var LeaferUI = (function (exports) {
|
|
|
1655
1665
|
Answer[Answer["YesAndSkip"] = 3] = "YesAndSkip";
|
|
1656
1666
|
})(exports.Answer || (exports.Answer = {}));
|
|
1657
1667
|
const emptyData = {};
|
|
1668
|
+
function isNull(value) {
|
|
1669
|
+
return value === undefined || value === null;
|
|
1670
|
+
}
|
|
1658
1671
|
|
|
1659
1672
|
/******************************************************************************
|
|
1660
1673
|
Copyright (c) Microsoft Corporation.
|
|
@@ -2420,7 +2433,7 @@ var LeaferUI = (function (exports) {
|
|
|
2420
2433
|
let startY = y = rotationSin * radiusX * startCos + rotationCos * radiusY * startSin;
|
|
2421
2434
|
let fromX = cx + x, fromY = cy + y;
|
|
2422
2435
|
if (data)
|
|
2423
|
-
data.push(L$6, fromX, fromY);
|
|
2436
|
+
data.push(data.length ? L$6 : M$5, fromX, fromY);
|
|
2424
2437
|
if (setPointBounds)
|
|
2425
2438
|
setPoint$2(setPointBounds, fromX, fromY);
|
|
2426
2439
|
if (setStartPoint)
|
|
@@ -3089,8 +3102,7 @@ var LeaferUI = (function (exports) {
|
|
|
3089
3102
|
toTwoPointBounds(data, setPointBounds) {
|
|
3090
3103
|
if (!data || !data.length)
|
|
3091
3104
|
return setPoint$1(setPointBounds, 0, 0);
|
|
3092
|
-
let command;
|
|
3093
|
-
let i = 0, x = 0, y = 0, x1, y1, toX, toY;
|
|
3105
|
+
let i = 0, x = 0, y = 0, x1, y1, toX, toY, command;
|
|
3094
3106
|
const len = data.length;
|
|
3095
3107
|
while (i < len) {
|
|
3096
3108
|
command = data[i];
|
|
@@ -3746,7 +3758,7 @@ var LeaferUI = (function (exports) {
|
|
|
3746
3758
|
set(value) {
|
|
3747
3759
|
if (this.__setAttr(key, value)) {
|
|
3748
3760
|
this.__layout.matrixChanged || this.__layout.matrixChange();
|
|
3749
|
-
this.__hasAutoLayout = !!
|
|
3761
|
+
this.__hasAutoLayout = !!(this.origin || this.around || this.flow);
|
|
3750
3762
|
if (!this.__local)
|
|
3751
3763
|
this.__layout.createLocal();
|
|
3752
3764
|
}
|
|
@@ -3839,14 +3851,25 @@ var LeaferUI = (function (exports) {
|
|
|
3839
3851
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3840
3852
|
set(value) {
|
|
3841
3853
|
const oldValue = this.visible;
|
|
3842
|
-
if (
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3854
|
+
if (oldValue === true && value === 0) {
|
|
3855
|
+
if (this.animationOut)
|
|
3856
|
+
return this.__runAnimation('out', () => doVisible(this, key, value, oldValue));
|
|
3857
|
+
}
|
|
3858
|
+
else if (oldValue === 0 && value === true) {
|
|
3859
|
+
if (this.animation)
|
|
3860
|
+
this.__runAnimation('in');
|
|
3846
3861
|
}
|
|
3862
|
+
doVisible(this, key, value, oldValue);
|
|
3847
3863
|
}
|
|
3848
3864
|
}));
|
|
3849
3865
|
}
|
|
3866
|
+
function doVisible(leaf, key, value, oldValue) {
|
|
3867
|
+
if (leaf.__setAttr(key, value)) {
|
|
3868
|
+
leaf.__layout.opacityChanged || leaf.__layout.opacityChange();
|
|
3869
|
+
if (oldValue === 0 || value === 0)
|
|
3870
|
+
doBoundsType(leaf);
|
|
3871
|
+
}
|
|
3872
|
+
}
|
|
3850
3873
|
function sortType(defaultValue) {
|
|
3851
3874
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3852
3875
|
set(value) {
|
|
@@ -3930,7 +3953,16 @@ var LeaferUI = (function (exports) {
|
|
|
3930
3953
|
if (defaultValue === undefined) {
|
|
3931
3954
|
property.get = function () { return this[computedKey]; };
|
|
3932
3955
|
}
|
|
3933
|
-
else if (
|
|
3956
|
+
else if (typeof defaultValue === 'object') {
|
|
3957
|
+
const { clone } = DataHelper;
|
|
3958
|
+
property.get = function () {
|
|
3959
|
+
let v = this[computedKey];
|
|
3960
|
+
if (v === undefined)
|
|
3961
|
+
this[computedKey] = v = clone(defaultValue);
|
|
3962
|
+
return v;
|
|
3963
|
+
};
|
|
3964
|
+
}
|
|
3965
|
+
if (key === 'width') {
|
|
3934
3966
|
property.get = function () {
|
|
3935
3967
|
const v = this[computedKey];
|
|
3936
3968
|
if (v === undefined) {
|
|
@@ -4454,15 +4486,16 @@ var LeaferUI = (function (exports) {
|
|
|
4454
4486
|
}
|
|
4455
4487
|
getLayoutBounds(type, relative = 'world', unscale) {
|
|
4456
4488
|
const { leaf } = this;
|
|
4457
|
-
let point, matrix, bounds = this.getInnerBounds(type);
|
|
4489
|
+
let point, matrix, layoutBounds, bounds = this.getInnerBounds(type);
|
|
4458
4490
|
switch (relative) {
|
|
4459
4491
|
case 'world':
|
|
4460
4492
|
point = leaf.getWorldPoint(bounds);
|
|
4461
4493
|
matrix = leaf.__world;
|
|
4462
4494
|
break;
|
|
4463
4495
|
case 'local':
|
|
4496
|
+
const { scaleX, scaleY, rotation, skewX, skewY } = leaf.__;
|
|
4497
|
+
layoutBounds = { scaleX, scaleY, rotation, skewX, skewY };
|
|
4464
4498
|
point = leaf.getLocalPointByInner(bounds);
|
|
4465
|
-
matrix = leaf.__localMatrix;
|
|
4466
4499
|
break;
|
|
4467
4500
|
case 'inner':
|
|
4468
4501
|
point = bounds;
|
|
@@ -4474,7 +4507,8 @@ var LeaferUI = (function (exports) {
|
|
|
4474
4507
|
point = leaf.getWorldPoint(bounds, relative);
|
|
4475
4508
|
matrix = getRelativeWorld$1(leaf, relative, true);
|
|
4476
4509
|
}
|
|
4477
|
-
|
|
4510
|
+
if (!layoutBounds)
|
|
4511
|
+
layoutBounds = MatrixHelper.getLayout(matrix);
|
|
4478
4512
|
copy$6(layoutBounds, bounds);
|
|
4479
4513
|
PointHelper.copy(layoutBounds, point);
|
|
4480
4514
|
if (unscale) {
|
|
@@ -4597,144 +4631,6 @@ var LeaferUI = (function (exports) {
|
|
|
4597
4631
|
destroy() { }
|
|
4598
4632
|
}
|
|
4599
4633
|
|
|
4600
|
-
const empty = {};
|
|
4601
|
-
const LeafEventer = {
|
|
4602
|
-
on(type, listener, options) {
|
|
4603
|
-
let capture, once;
|
|
4604
|
-
if (options) {
|
|
4605
|
-
if (options === 'once') {
|
|
4606
|
-
once = true;
|
|
4607
|
-
}
|
|
4608
|
-
else if (typeof options === 'boolean') {
|
|
4609
|
-
capture = options;
|
|
4610
|
-
}
|
|
4611
|
-
else {
|
|
4612
|
-
capture = options.capture;
|
|
4613
|
-
once = options.once;
|
|
4614
|
-
}
|
|
4615
|
-
}
|
|
4616
|
-
let events;
|
|
4617
|
-
const map = __getListenerMap(this, capture, true);
|
|
4618
|
-
const typeList = typeof type === 'string' ? type.split(' ') : type;
|
|
4619
|
-
const item = once ? { listener, once } : { listener };
|
|
4620
|
-
typeList.forEach(type => {
|
|
4621
|
-
if (type) {
|
|
4622
|
-
events = map[type];
|
|
4623
|
-
if (events) {
|
|
4624
|
-
if (events.findIndex(item => item.listener === listener) === -1)
|
|
4625
|
-
events.push(item);
|
|
4626
|
-
}
|
|
4627
|
-
else {
|
|
4628
|
-
map[type] = [item];
|
|
4629
|
-
}
|
|
4630
|
-
}
|
|
4631
|
-
});
|
|
4632
|
-
},
|
|
4633
|
-
off(type, listener, options) {
|
|
4634
|
-
if (type) {
|
|
4635
|
-
const typeList = typeof type === 'string' ? type.split(' ') : type;
|
|
4636
|
-
if (listener) {
|
|
4637
|
-
let capture;
|
|
4638
|
-
if (options)
|
|
4639
|
-
capture = typeof options === 'boolean' ? options : (options === 'once' ? false : options.capture);
|
|
4640
|
-
let events, index;
|
|
4641
|
-
const map = __getListenerMap(this, capture);
|
|
4642
|
-
typeList.forEach(type => {
|
|
4643
|
-
if (type) {
|
|
4644
|
-
events = map[type];
|
|
4645
|
-
if (events) {
|
|
4646
|
-
index = events.findIndex(item => item.listener === listener);
|
|
4647
|
-
if (index > -1)
|
|
4648
|
-
events.splice(index, 1);
|
|
4649
|
-
if (!events.length)
|
|
4650
|
-
delete map[type];
|
|
4651
|
-
}
|
|
4652
|
-
}
|
|
4653
|
-
});
|
|
4654
|
-
}
|
|
4655
|
-
else {
|
|
4656
|
-
const { __bubbleMap: b, __captureMap: c } = this;
|
|
4657
|
-
typeList.forEach(type => {
|
|
4658
|
-
if (b)
|
|
4659
|
-
delete b[type];
|
|
4660
|
-
if (c)
|
|
4661
|
-
delete c[type];
|
|
4662
|
-
});
|
|
4663
|
-
}
|
|
4664
|
-
}
|
|
4665
|
-
else {
|
|
4666
|
-
this.__bubbleMap = this.__captureMap = undefined;
|
|
4667
|
-
}
|
|
4668
|
-
},
|
|
4669
|
-
on_(type, listener, bind, options) {
|
|
4670
|
-
if (bind)
|
|
4671
|
-
listener = listener.bind(bind);
|
|
4672
|
-
this.on(type, listener, options);
|
|
4673
|
-
return { type, current: this, listener, options };
|
|
4674
|
-
},
|
|
4675
|
-
off_(id) {
|
|
4676
|
-
if (!id)
|
|
4677
|
-
return;
|
|
4678
|
-
const list = id instanceof Array ? id : [id];
|
|
4679
|
-
list.forEach(item => item.current.off(item.type, item.listener, item.options));
|
|
4680
|
-
list.length = 0;
|
|
4681
|
-
},
|
|
4682
|
-
once(type, listener, capture) {
|
|
4683
|
-
this.on(type, listener, { once: true, capture });
|
|
4684
|
-
},
|
|
4685
|
-
emit(type, event, capture) {
|
|
4686
|
-
if (!event && EventCreator.has(type))
|
|
4687
|
-
event = EventCreator.get(type, { type, target: this, current: this });
|
|
4688
|
-
const map = __getListenerMap(this, capture);
|
|
4689
|
-
const list = map[type];
|
|
4690
|
-
if (list) {
|
|
4691
|
-
let item;
|
|
4692
|
-
for (let i = 0, len = list.length; i < len; i++) {
|
|
4693
|
-
item = list[i];
|
|
4694
|
-
item.listener(event);
|
|
4695
|
-
if (item.once) {
|
|
4696
|
-
this.off(type, item.listener, capture);
|
|
4697
|
-
i--, len--;
|
|
4698
|
-
}
|
|
4699
|
-
if (event && event.isStopNow)
|
|
4700
|
-
break;
|
|
4701
|
-
}
|
|
4702
|
-
}
|
|
4703
|
-
this.syncEventer && this.syncEventer.emitEvent(event, capture);
|
|
4704
|
-
},
|
|
4705
|
-
emitEvent(event, capture) {
|
|
4706
|
-
event.current = this;
|
|
4707
|
-
this.emit(event.type, event, capture);
|
|
4708
|
-
},
|
|
4709
|
-
hasEvent(type, capture) {
|
|
4710
|
-
if (this.syncEventer && this.syncEventer.hasEvent(type, capture))
|
|
4711
|
-
return true;
|
|
4712
|
-
const { __bubbleMap: b, __captureMap: c } = this;
|
|
4713
|
-
const hasB = b && b[type], hasC = c && c[type];
|
|
4714
|
-
return !!(capture === undefined ? (hasB || hasC) : (capture ? hasC : hasB));
|
|
4715
|
-
},
|
|
4716
|
-
};
|
|
4717
|
-
function __getListenerMap(eventer, capture, create) {
|
|
4718
|
-
if (capture) {
|
|
4719
|
-
const { __captureMap: c } = eventer;
|
|
4720
|
-
if (c) {
|
|
4721
|
-
return c;
|
|
4722
|
-
}
|
|
4723
|
-
else {
|
|
4724
|
-
return create ? eventer.__captureMap = {} : empty;
|
|
4725
|
-
}
|
|
4726
|
-
}
|
|
4727
|
-
else {
|
|
4728
|
-
const { __bubbleMap: b } = eventer;
|
|
4729
|
-
if (b) {
|
|
4730
|
-
return b;
|
|
4731
|
-
}
|
|
4732
|
-
else {
|
|
4733
|
-
return create ? eventer.__bubbleMap = {} : empty;
|
|
4734
|
-
}
|
|
4735
|
-
}
|
|
4736
|
-
}
|
|
4737
|
-
|
|
4738
4634
|
class Event {
|
|
4739
4635
|
constructor(type, target) {
|
|
4740
4636
|
this.bubbles = false;
|
|
@@ -4769,7 +4665,10 @@ var LeaferUI = (function (exports) {
|
|
|
4769
4665
|
}
|
|
4770
4666
|
ChildEvent.ADD = 'child.add';
|
|
4771
4667
|
ChildEvent.REMOVE = 'child.remove';
|
|
4772
|
-
ChildEvent.
|
|
4668
|
+
ChildEvent.CREATED = 'created';
|
|
4669
|
+
ChildEvent.MOUNTED = 'mounted';
|
|
4670
|
+
ChildEvent.UNMOUNTED = 'unmounted';
|
|
4671
|
+
ChildEvent.DESTROY = 'destroy';
|
|
4773
4672
|
|
|
4774
4673
|
class PropertyEvent extends Event {
|
|
4775
4674
|
constructor(type, target, attrName, oldValue, newValue) {
|
|
@@ -4847,10 +4746,6 @@ var LeaferUI = (function (exports) {
|
|
|
4847
4746
|
LayoutEvent.AGAIN = 'layout.again';
|
|
4848
4747
|
LayoutEvent.END = 'layout.end';
|
|
4849
4748
|
|
|
4850
|
-
class AnimateEvent extends Event {
|
|
4851
|
-
}
|
|
4852
|
-
AnimateEvent.FRAME = 'animate.frame';
|
|
4853
|
-
|
|
4854
4749
|
class RenderEvent extends Event {
|
|
4855
4750
|
constructor(type, times, bounds, options) {
|
|
4856
4751
|
super(type);
|
|
@@ -4883,6 +4778,157 @@ var LeaferUI = (function (exports) {
|
|
|
4883
4778
|
LeaferEvent.RESTART = 'leafer.restart';
|
|
4884
4779
|
LeaferEvent.END = 'leafer.end';
|
|
4885
4780
|
|
|
4781
|
+
const empty = {};
|
|
4782
|
+
class Eventer {
|
|
4783
|
+
set event(map) { this.on(map); }
|
|
4784
|
+
on(type, listener, options) {
|
|
4785
|
+
if (!listener) {
|
|
4786
|
+
let event, map = type;
|
|
4787
|
+
for (let key in map)
|
|
4788
|
+
event = map[key], event instanceof Array ? this.on(key, event[0], event[1]) : this.on(key, event);
|
|
4789
|
+
return;
|
|
4790
|
+
}
|
|
4791
|
+
let capture, once;
|
|
4792
|
+
if (options) {
|
|
4793
|
+
if (options === 'once') {
|
|
4794
|
+
once = true;
|
|
4795
|
+
}
|
|
4796
|
+
else if (typeof options === 'boolean') {
|
|
4797
|
+
capture = options;
|
|
4798
|
+
}
|
|
4799
|
+
else {
|
|
4800
|
+
capture = options.capture;
|
|
4801
|
+
once = options.once;
|
|
4802
|
+
}
|
|
4803
|
+
}
|
|
4804
|
+
let events;
|
|
4805
|
+
const map = __getListenerMap(this, capture, true);
|
|
4806
|
+
const typeList = typeof type === 'string' ? type.split(' ') : type;
|
|
4807
|
+
const item = once ? { listener, once } : { listener };
|
|
4808
|
+
typeList.forEach(type => {
|
|
4809
|
+
if (type) {
|
|
4810
|
+
events = map[type];
|
|
4811
|
+
if (events) {
|
|
4812
|
+
if (events.findIndex(item => item.listener === listener) === -1)
|
|
4813
|
+
events.push(item);
|
|
4814
|
+
}
|
|
4815
|
+
else {
|
|
4816
|
+
map[type] = [item];
|
|
4817
|
+
}
|
|
4818
|
+
}
|
|
4819
|
+
});
|
|
4820
|
+
}
|
|
4821
|
+
off(type, listener, options) {
|
|
4822
|
+
if (type) {
|
|
4823
|
+
const typeList = typeof type === 'string' ? type.split(' ') : type;
|
|
4824
|
+
if (listener) {
|
|
4825
|
+
let capture;
|
|
4826
|
+
if (options)
|
|
4827
|
+
capture = typeof options === 'boolean' ? options : (options === 'once' ? false : options.capture);
|
|
4828
|
+
let events, index;
|
|
4829
|
+
const map = __getListenerMap(this, capture);
|
|
4830
|
+
typeList.forEach(type => {
|
|
4831
|
+
if (type) {
|
|
4832
|
+
events = map[type];
|
|
4833
|
+
if (events) {
|
|
4834
|
+
index = events.findIndex(item => item.listener === listener);
|
|
4835
|
+
if (index > -1)
|
|
4836
|
+
events.splice(index, 1);
|
|
4837
|
+
if (!events.length)
|
|
4838
|
+
delete map[type];
|
|
4839
|
+
}
|
|
4840
|
+
}
|
|
4841
|
+
});
|
|
4842
|
+
}
|
|
4843
|
+
else {
|
|
4844
|
+
const { __bubbleMap: b, __captureMap: c } = this;
|
|
4845
|
+
typeList.forEach(type => {
|
|
4846
|
+
if (b)
|
|
4847
|
+
delete b[type];
|
|
4848
|
+
if (c)
|
|
4849
|
+
delete c[type];
|
|
4850
|
+
});
|
|
4851
|
+
}
|
|
4852
|
+
}
|
|
4853
|
+
else {
|
|
4854
|
+
this.__bubbleMap = this.__captureMap = undefined;
|
|
4855
|
+
}
|
|
4856
|
+
}
|
|
4857
|
+
on_(type, listener, bind, options) {
|
|
4858
|
+
if (bind)
|
|
4859
|
+
listener = listener.bind(bind);
|
|
4860
|
+
this.on(type, listener, options);
|
|
4861
|
+
return { type, current: this, listener, options };
|
|
4862
|
+
}
|
|
4863
|
+
off_(id) {
|
|
4864
|
+
if (!id)
|
|
4865
|
+
return;
|
|
4866
|
+
const list = id instanceof Array ? id : [id];
|
|
4867
|
+
list.forEach(item => item.current.off(item.type, item.listener, item.options));
|
|
4868
|
+
list.length = 0;
|
|
4869
|
+
}
|
|
4870
|
+
once(type, listener, capture) {
|
|
4871
|
+
this.on(type, listener, { once: true, capture });
|
|
4872
|
+
}
|
|
4873
|
+
emit(type, event, capture) {
|
|
4874
|
+
if (!event && EventCreator.has(type))
|
|
4875
|
+
event = EventCreator.get(type, { type, target: this, current: this });
|
|
4876
|
+
const map = __getListenerMap(this, capture);
|
|
4877
|
+
const list = map[type];
|
|
4878
|
+
if (list) {
|
|
4879
|
+
let item;
|
|
4880
|
+
for (let i = 0, len = list.length; i < len; i++) {
|
|
4881
|
+
item = list[i];
|
|
4882
|
+
item.listener(event);
|
|
4883
|
+
if (item.once) {
|
|
4884
|
+
this.off(type, item.listener, capture);
|
|
4885
|
+
i--, len--;
|
|
4886
|
+
}
|
|
4887
|
+
if (event && event.isStopNow)
|
|
4888
|
+
break;
|
|
4889
|
+
}
|
|
4890
|
+
}
|
|
4891
|
+
this.syncEventer && this.syncEventer.emitEvent(event, capture);
|
|
4892
|
+
}
|
|
4893
|
+
emitEvent(event, capture) {
|
|
4894
|
+
event.current = this;
|
|
4895
|
+
this.emit(event.type, event, capture);
|
|
4896
|
+
}
|
|
4897
|
+
hasEvent(type, capture) {
|
|
4898
|
+
if (this.syncEventer && this.syncEventer.hasEvent(type, capture))
|
|
4899
|
+
return true;
|
|
4900
|
+
const { __bubbleMap: b, __captureMap: c } = this;
|
|
4901
|
+
const hasB = b && b[type], hasC = c && c[type];
|
|
4902
|
+
return !!(capture === undefined ? (hasB || hasC) : (capture ? hasC : hasB));
|
|
4903
|
+
}
|
|
4904
|
+
destroy() {
|
|
4905
|
+
this.__captureMap = this.__bubbleMap = this.syncEventer = null;
|
|
4906
|
+
}
|
|
4907
|
+
}
|
|
4908
|
+
function __getListenerMap(eventer, capture, create) {
|
|
4909
|
+
if (capture) {
|
|
4910
|
+
const { __captureMap: c } = eventer;
|
|
4911
|
+
if (c) {
|
|
4912
|
+
return c;
|
|
4913
|
+
}
|
|
4914
|
+
else {
|
|
4915
|
+
return create ? eventer.__captureMap = {} : empty;
|
|
4916
|
+
}
|
|
4917
|
+
}
|
|
4918
|
+
else {
|
|
4919
|
+
const { __bubbleMap: b } = eventer;
|
|
4920
|
+
if (b) {
|
|
4921
|
+
return b;
|
|
4922
|
+
}
|
|
4923
|
+
else {
|
|
4924
|
+
return create ? eventer.__bubbleMap = {} : empty;
|
|
4925
|
+
}
|
|
4926
|
+
}
|
|
4927
|
+
}
|
|
4928
|
+
|
|
4929
|
+
const { on, on_, off, off_, once, emit: emit$2, emitEvent: emitEvent$1, hasEvent, destroy } = Eventer.prototype;
|
|
4930
|
+
const LeafEventer = { on, on_, off, off_, once, emit: emit$2, emitEvent: emitEvent$1, hasEvent, destroyEventer: destroy };
|
|
4931
|
+
|
|
4886
4932
|
const { isFinite } = Number;
|
|
4887
4933
|
const debug$7 = Debug.get('setAttr');
|
|
4888
4934
|
const LeafDataProxy = {
|
|
@@ -4894,9 +4940,7 @@ var LeaferUI = (function (exports) {
|
|
|
4894
4940
|
newValue = undefined;
|
|
4895
4941
|
}
|
|
4896
4942
|
if (typeof newValue === 'object' || oldValue !== newValue) {
|
|
4897
|
-
this.
|
|
4898
|
-
if (this.__proxyData)
|
|
4899
|
-
this.setProxyAttr(name, newValue);
|
|
4943
|
+
this.__realSetAttr(name, newValue);
|
|
4900
4944
|
const { CHANGE } = PropertyEvent;
|
|
4901
4945
|
const event = new PropertyEvent(CHANGE, this, name, oldValue, newValue);
|
|
4902
4946
|
if (this.isLeafer) {
|
|
@@ -4914,12 +4958,18 @@ var LeaferUI = (function (exports) {
|
|
|
4914
4958
|
}
|
|
4915
4959
|
}
|
|
4916
4960
|
else {
|
|
4917
|
-
this.
|
|
4918
|
-
if (this.__proxyData)
|
|
4919
|
-
this.setProxyAttr(name, newValue);
|
|
4961
|
+
this.__realSetAttr(name, newValue);
|
|
4920
4962
|
return true;
|
|
4921
4963
|
}
|
|
4922
4964
|
},
|
|
4965
|
+
__realSetAttr(name, newValue) {
|
|
4966
|
+
const data = this.__;
|
|
4967
|
+
data[name] = newValue;
|
|
4968
|
+
if (this.__proxyData)
|
|
4969
|
+
this.setProxyAttr(name, newValue);
|
|
4970
|
+
if (data.normalStyle)
|
|
4971
|
+
this.lockNormalStyle || data.normalStyle[name] === undefined || (data.normalStyle[name] = newValue);
|
|
4972
|
+
},
|
|
4923
4973
|
__getAttr(name) {
|
|
4924
4974
|
if (this.__proxyData)
|
|
4925
4975
|
return this.getProxyAttr(name);
|
|
@@ -5022,6 +5072,8 @@ var LeaferUI = (function (exports) {
|
|
|
5022
5072
|
layout.boundsChanged = false;
|
|
5023
5073
|
},
|
|
5024
5074
|
__updateLocalBoxBounds() {
|
|
5075
|
+
if (this.__hasMotionPath)
|
|
5076
|
+
this.__updateMotionPath();
|
|
5025
5077
|
if (this.__hasAutoLayout)
|
|
5026
5078
|
this.__updateAutoLayout();
|
|
5027
5079
|
toOuterOf$1(this.__layout.boxBounds, this.__local, this.__local);
|
|
@@ -5174,7 +5226,7 @@ var LeaferUI = (function (exports) {
|
|
|
5174
5226
|
const { LEAF, create } = IncrementId;
|
|
5175
5227
|
const { toInnerPoint, toOuterPoint, multiplyParent } = MatrixHelper;
|
|
5176
5228
|
const { toOuterOf } = BoundsHelper;
|
|
5177
|
-
const { copy: copy$4 } = PointHelper;
|
|
5229
|
+
const { copy: copy$4, move: move$1 } = PointHelper;
|
|
5178
5230
|
const { moveLocal, zoomOfLocal, rotateOfLocal, skewOfLocal, moveWorld, zoomOfWorld, rotateOfWorld, skewOfWorld, transform, transformWorld, setTransform, getFlipTransform, getLocalOrigin, getRelativeWorld, drop } = LeafHelper;
|
|
5179
5231
|
exports.Leaf = class Leaf {
|
|
5180
5232
|
get tag() { return this.__tag; }
|
|
@@ -5201,13 +5253,16 @@ var LeaferUI = (function (exports) {
|
|
|
5201
5253
|
get __ignoreHitWorld() { return (this.__hasMask || this.__hasEraser) && this.__.hitChildren; }
|
|
5202
5254
|
get __inLazyBounds() { const { leafer } = this; return leafer && leafer.created && leafer.lazyBounds.hit(this.__world); }
|
|
5203
5255
|
get pathInputed() { return this.__.__pathInputed; }
|
|
5204
|
-
set event(map) {
|
|
5205
|
-
event = map[key], event instanceof Array ? this.on(key, event[0], event[1]) : this.on(key, event); }
|
|
5256
|
+
set event(map) { this.on(map); }
|
|
5206
5257
|
constructor(data) {
|
|
5207
5258
|
this.innerId = create(LEAF);
|
|
5208
5259
|
this.reset(data);
|
|
5260
|
+
if (this.__bubbleMap)
|
|
5261
|
+
this.__emitLifeEvent(ChildEvent.CREATED);
|
|
5209
5262
|
}
|
|
5210
5263
|
reset(data) {
|
|
5264
|
+
if (this.leafer)
|
|
5265
|
+
this.leafer.forceRender(this.__world);
|
|
5211
5266
|
this.__world = { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0, x: 0, y: 0, width: 0, height: 0, scaleX: 1, scaleY: 1 };
|
|
5212
5267
|
if (data !== null)
|
|
5213
5268
|
this.__local = { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0, x: 0, y: 0, width: 0, height: 0 };
|
|
@@ -5229,12 +5284,12 @@ var LeaferUI = (function (exports) {
|
|
|
5229
5284
|
waitParent(item, bind) {
|
|
5230
5285
|
if (bind)
|
|
5231
5286
|
item = item.bind(bind);
|
|
5232
|
-
this.parent ? item() :
|
|
5287
|
+
this.parent ? item() : this.on(ChildEvent.ADD, item, 'once');
|
|
5233
5288
|
}
|
|
5234
5289
|
waitLeafer(item, bind) {
|
|
5235
5290
|
if (bind)
|
|
5236
5291
|
item = item.bind(bind);
|
|
5237
|
-
this.leafer ? item() :
|
|
5292
|
+
this.leafer ? item() : this.on(ChildEvent.MOUNTED, item, 'once');
|
|
5238
5293
|
}
|
|
5239
5294
|
nextRender(item, bind, off) {
|
|
5240
5295
|
this.leafer ? this.leafer.nextRender(item, bind, off) : this.waitLeafer(() => this.leafer.nextRender(item, bind, off));
|
|
@@ -5243,18 +5298,21 @@ var LeaferUI = (function (exports) {
|
|
|
5243
5298
|
this.nextRender(item, null, 'off');
|
|
5244
5299
|
}
|
|
5245
5300
|
__bindLeafer(leafer) {
|
|
5246
|
-
if (this.isLeafer)
|
|
5247
|
-
|
|
5248
|
-
leafer = this;
|
|
5249
|
-
}
|
|
5301
|
+
if (this.isLeafer && leafer !== null)
|
|
5302
|
+
leafer = this;
|
|
5250
5303
|
if (this.leafer && !leafer)
|
|
5251
5304
|
this.leafer.leafs--;
|
|
5252
5305
|
this.leafer = leafer;
|
|
5253
5306
|
if (leafer) {
|
|
5254
5307
|
leafer.leafs++;
|
|
5255
5308
|
this.__level = this.parent ? this.parent.__level + 1 : 1;
|
|
5256
|
-
if (this.
|
|
5257
|
-
|
|
5309
|
+
if (this.animation)
|
|
5310
|
+
this.__runAnimation('in');
|
|
5311
|
+
if (this.__bubbleMap)
|
|
5312
|
+
this.__emitLifeEvent(ChildEvent.MOUNTED);
|
|
5313
|
+
}
|
|
5314
|
+
else {
|
|
5315
|
+
this.__emitLifeEvent(ChildEvent.UNMOUNTED);
|
|
5258
5316
|
}
|
|
5259
5317
|
if (this.isBranch) {
|
|
5260
5318
|
const { children } = this;
|
|
@@ -5263,7 +5321,7 @@ var LeaferUI = (function (exports) {
|
|
|
5263
5321
|
}
|
|
5264
5322
|
}
|
|
5265
5323
|
}
|
|
5266
|
-
set(_data) { }
|
|
5324
|
+
set(_data, _isTemp) { }
|
|
5267
5325
|
get(_name) { return undefined; }
|
|
5268
5326
|
setAttr(name, value) { this[name] = value; }
|
|
5269
5327
|
getAttr(name) { return this[name]; }
|
|
@@ -5288,6 +5346,7 @@ var LeaferUI = (function (exports) {
|
|
|
5288
5346
|
findOne(_condition, _options) { return undefined; }
|
|
5289
5347
|
findId(_id) { return undefined; }
|
|
5290
5348
|
focus(_value) { }
|
|
5349
|
+
updateState() { }
|
|
5291
5350
|
updateLayout() {
|
|
5292
5351
|
this.__layout.update();
|
|
5293
5352
|
}
|
|
@@ -5395,11 +5454,24 @@ var LeaferUI = (function (exports) {
|
|
|
5395
5454
|
if (relative)
|
|
5396
5455
|
relative.worldToInner(to ? to : inner, null, distance);
|
|
5397
5456
|
}
|
|
5457
|
+
getBoxPoint(world, relative, distance, change) {
|
|
5458
|
+
return this.getBoxPointByInner(this.getInnerPoint(world, relative, distance, change), null, null, true);
|
|
5459
|
+
}
|
|
5460
|
+
getBoxPointByInner(inner, _relative, _distance, change) {
|
|
5461
|
+
const point = change ? inner : Object.assign({}, inner), { x, y } = this.boxBounds;
|
|
5462
|
+
move$1(point, -x, -y);
|
|
5463
|
+
return point;
|
|
5464
|
+
}
|
|
5398
5465
|
getInnerPoint(world, relative, distance, change) {
|
|
5399
5466
|
const point = change ? world : {};
|
|
5400
5467
|
this.worldToInner(world, point, distance, relative);
|
|
5401
5468
|
return point;
|
|
5402
5469
|
}
|
|
5470
|
+
getInnerPointByBox(box, _relative, _distance, change) {
|
|
5471
|
+
const point = change ? box : Object.assign({}, box), { x, y } = this.boxBounds;
|
|
5472
|
+
move$1(point, x, y);
|
|
5473
|
+
return point;
|
|
5474
|
+
}
|
|
5403
5475
|
getInnerPointByLocal(local, _relative, distance, change) {
|
|
5404
5476
|
return this.getInnerPoint(local, this.parent, distance, change);
|
|
5405
5477
|
}
|
|
@@ -5411,20 +5483,23 @@ var LeaferUI = (function (exports) {
|
|
|
5411
5483
|
getLocalPointByInner(inner, _relative, distance, change) {
|
|
5412
5484
|
return this.getWorldPoint(inner, this.parent, distance, change);
|
|
5413
5485
|
}
|
|
5486
|
+
getPagePoint(world, relative, distance, change) {
|
|
5487
|
+
const layer = this.leafer ? this.leafer.zoomLayer : this;
|
|
5488
|
+
return layer.getInnerPoint(world, relative, distance, change);
|
|
5489
|
+
}
|
|
5414
5490
|
getWorldPoint(inner, relative, distance, change) {
|
|
5415
5491
|
const point = change ? inner : {};
|
|
5416
5492
|
this.innerToWorld(inner, point, distance, relative);
|
|
5417
5493
|
return point;
|
|
5418
5494
|
}
|
|
5495
|
+
getWorldPointByBox(box, relative, distance, change) {
|
|
5496
|
+
return this.getWorldPoint(this.getInnerPointByBox(box, null, null, change), relative, distance, true);
|
|
5497
|
+
}
|
|
5419
5498
|
getWorldPointByLocal(local, relative, distance, change) {
|
|
5420
5499
|
const point = change ? local : {};
|
|
5421
5500
|
this.localToWorld(local, point, distance, relative);
|
|
5422
5501
|
return point;
|
|
5423
5502
|
}
|
|
5424
|
-
getPagePoint(world, relative, distance, change) {
|
|
5425
|
-
const layer = this.leafer ? this.leafer.zoomLayer : this;
|
|
5426
|
-
return layer.getInnerPoint(world, relative, distance, change);
|
|
5427
|
-
}
|
|
5428
5503
|
getWorldPointByPage(page, relative, distance, change) {
|
|
5429
5504
|
const layer = this.leafer ? this.leafer.zoomLayer : this;
|
|
5430
5505
|
return layer.getWorldPoint(page, relative, distance, change);
|
|
@@ -5493,6 +5568,17 @@ var LeaferUI = (function (exports) {
|
|
|
5493
5568
|
__drawRenderPath(_canvas) { }
|
|
5494
5569
|
__updatePath() { }
|
|
5495
5570
|
__updateRenderPath() { }
|
|
5571
|
+
getMotionPathData() {
|
|
5572
|
+
return needPlugin('path');
|
|
5573
|
+
}
|
|
5574
|
+
getMotionPoint(_motionDistance) {
|
|
5575
|
+
return needPlugin('path');
|
|
5576
|
+
}
|
|
5577
|
+
getMotionTotal() {
|
|
5578
|
+
return 0;
|
|
5579
|
+
}
|
|
5580
|
+
__updateMotionPath() { }
|
|
5581
|
+
__runAnimation(_type, _complete) { }
|
|
5496
5582
|
__updateSortChildren() { }
|
|
5497
5583
|
add(_child, _index) { }
|
|
5498
5584
|
remove(_child, destroy) {
|
|
@@ -5518,6 +5604,10 @@ var LeaferUI = (function (exports) {
|
|
|
5518
5604
|
fn = boundsType;
|
|
5519
5605
|
fn(defaultValue)(this.prototype, attrName);
|
|
5520
5606
|
}
|
|
5607
|
+
__emitLifeEvent(type) {
|
|
5608
|
+
if (this.hasEvent(type))
|
|
5609
|
+
this.emitEvent(new ChildEvent(type, this, this.parent));
|
|
5610
|
+
}
|
|
5521
5611
|
destroy() {
|
|
5522
5612
|
if (!this.destroyed) {
|
|
5523
5613
|
const { parent } = this;
|
|
@@ -5525,11 +5615,10 @@ var LeaferUI = (function (exports) {
|
|
|
5525
5615
|
this.remove();
|
|
5526
5616
|
if (this.children)
|
|
5527
5617
|
this.removeAll(true);
|
|
5528
|
-
|
|
5529
|
-
this.emitEvent(new ChildEvent(ChildEvent.DESTROY, this, parent));
|
|
5618
|
+
this.__emitLifeEvent(ChildEvent.DESTROY);
|
|
5530
5619
|
this.__.destroy();
|
|
5531
5620
|
this.__layout.destroy();
|
|
5532
|
-
this.
|
|
5621
|
+
this.destroyEventer();
|
|
5533
5622
|
this.destroyed = true;
|
|
5534
5623
|
}
|
|
5535
5624
|
}
|
|
@@ -5595,8 +5684,8 @@ var LeaferUI = (function (exports) {
|
|
|
5595
5684
|
this.__.__childBranchNumber = (this.__.__childBranchNumber || 0) + 1;
|
|
5596
5685
|
child.__layout.boxChanged || child.__layout.boxChange();
|
|
5597
5686
|
child.__layout.matrixChanged || child.__layout.matrixChange();
|
|
5598
|
-
if (child.
|
|
5599
|
-
|
|
5687
|
+
if (child.__bubbleMap)
|
|
5688
|
+
child.__emitLifeEvent(ChildEvent.ADD);
|
|
5600
5689
|
if (this.leafer) {
|
|
5601
5690
|
child.__bindLeafer(this.leafer);
|
|
5602
5691
|
if (this.leafer.created)
|
|
@@ -5609,16 +5698,10 @@ var LeaferUI = (function (exports) {
|
|
|
5609
5698
|
}
|
|
5610
5699
|
remove(child, destroy) {
|
|
5611
5700
|
if (child) {
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
this.__.__childBranchNumber = (this.__.__childBranchNumber || 1) - 1;
|
|
5617
|
-
this.__preRemove();
|
|
5618
|
-
this.__realRemoveChild(child);
|
|
5619
|
-
if (destroy)
|
|
5620
|
-
child.destroy();
|
|
5621
|
-
}
|
|
5701
|
+
if (child.animationOut)
|
|
5702
|
+
child.__runAnimation('out', () => this.__remove(child, destroy));
|
|
5703
|
+
else
|
|
5704
|
+
this.__remove(child, destroy);
|
|
5622
5705
|
}
|
|
5623
5706
|
else if (child === undefined) {
|
|
5624
5707
|
super.remove(null, destroy);
|
|
@@ -5640,6 +5723,18 @@ var LeaferUI = (function (exports) {
|
|
|
5640
5723
|
clear() {
|
|
5641
5724
|
this.removeAll(true);
|
|
5642
5725
|
}
|
|
5726
|
+
__remove(child, destroy) {
|
|
5727
|
+
const index = this.children.indexOf(child);
|
|
5728
|
+
if (index > -1) {
|
|
5729
|
+
this.children.splice(index, 1);
|
|
5730
|
+
if (child.isBranch)
|
|
5731
|
+
this.__.__childBranchNumber = (this.__.__childBranchNumber || 1) - 1;
|
|
5732
|
+
this.__preRemove();
|
|
5733
|
+
this.__realRemoveChild(child);
|
|
5734
|
+
if (destroy)
|
|
5735
|
+
child.destroy();
|
|
5736
|
+
}
|
|
5737
|
+
}
|
|
5643
5738
|
__preRemove() {
|
|
5644
5739
|
if (this.__hasMask)
|
|
5645
5740
|
this.__updateMask();
|
|
@@ -5649,6 +5744,7 @@ var LeaferUI = (function (exports) {
|
|
|
5649
5744
|
this.__layout.affectChildrenSort && this.__layout.childrenSortChange();
|
|
5650
5745
|
}
|
|
5651
5746
|
__realRemoveChild(child) {
|
|
5747
|
+
child.__emitLifeEvent(ChildEvent.REMOVE);
|
|
5652
5748
|
child.parent = null;
|
|
5653
5749
|
if (this.leafer) {
|
|
5654
5750
|
child.__bindLeafer(null);
|
|
@@ -5661,8 +5757,6 @@ var LeaferUI = (function (exports) {
|
|
|
5661
5757
|
}
|
|
5662
5758
|
__emitChildEvent(type, child) {
|
|
5663
5759
|
const event = new ChildEvent(type, child, this);
|
|
5664
|
-
if (child.hasEvent(type))
|
|
5665
|
-
child.emitEvent(event);
|
|
5666
5760
|
if (this.hasEvent(type) && !this.isLeafer)
|
|
5667
5761
|
this.emitEvent(event);
|
|
5668
5762
|
this.leafer.emitEvent(event);
|
|
@@ -5825,8 +5919,7 @@ var LeaferUI = (function (exports) {
|
|
|
5825
5919
|
}
|
|
5826
5920
|
}
|
|
5827
5921
|
|
|
5828
|
-
const version = "1.0.
|
|
5829
|
-
const inviteCode = {};
|
|
5922
|
+
const version = "1.0.4";
|
|
5830
5923
|
|
|
5831
5924
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
5832
5925
|
get allowBackgroundColor() { return true; }
|
|
@@ -6053,9 +6146,13 @@ var LeaferUI = (function (exports) {
|
|
|
6053
6146
|
});
|
|
6054
6147
|
}
|
|
6055
6148
|
function updateChange(updateList) {
|
|
6149
|
+
let layout;
|
|
6056
6150
|
updateList.list.forEach(leaf => {
|
|
6057
|
-
|
|
6151
|
+
layout = leaf.__layout;
|
|
6152
|
+
if (layout.opacityChanged)
|
|
6058
6153
|
updateAllWorldOpacity(leaf);
|
|
6154
|
+
if (layout.stateStyleChanged)
|
|
6155
|
+
setTimeout(() => layout.stateStyleChanged && leaf.updateState());
|
|
6059
6156
|
leaf.__updateChange();
|
|
6060
6157
|
});
|
|
6061
6158
|
}
|
|
@@ -6421,7 +6518,6 @@ var LeaferUI = (function (exports) {
|
|
|
6421
6518
|
Platform.requestRender(() => {
|
|
6422
6519
|
this.FPS = Math.min(60, Math.ceil(1000 / (Date.now() - startTime)));
|
|
6423
6520
|
if (this.running) {
|
|
6424
|
-
this.target.emit(AnimateEvent.FRAME);
|
|
6425
6521
|
if (this.changed && this.canvas.view)
|
|
6426
6522
|
this.render();
|
|
6427
6523
|
this.target.emit(RenderEvent.NEXT);
|
|
@@ -6766,36 +6862,6 @@ var LeaferUI = (function (exports) {
|
|
|
6766
6862
|
});
|
|
6767
6863
|
Platform.layout = Layouter.fullLayout;
|
|
6768
6864
|
|
|
6769
|
-
const TextConvert = {};
|
|
6770
|
-
const ColorConvert = {};
|
|
6771
|
-
const PathArrow = {};
|
|
6772
|
-
const Paint = {};
|
|
6773
|
-
const PaintImage = {};
|
|
6774
|
-
const PaintGradient = {};
|
|
6775
|
-
const Effect = {};
|
|
6776
|
-
const Export = {};
|
|
6777
|
-
const State = {};
|
|
6778
|
-
|
|
6779
|
-
function stateType(defaultValue) {
|
|
6780
|
-
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
6781
|
-
set(value) {
|
|
6782
|
-
this.__setAttr(key, value);
|
|
6783
|
-
this.waitLeafer(() => { if (State.setStyle)
|
|
6784
|
-
State.setStyle(this, key + 'Style', value); });
|
|
6785
|
-
}
|
|
6786
|
-
}));
|
|
6787
|
-
}
|
|
6788
|
-
function arrowType(defaultValue) {
|
|
6789
|
-
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
6790
|
-
set(value) {
|
|
6791
|
-
if (this.__setAttr(key, value)) {
|
|
6792
|
-
const data = this.__;
|
|
6793
|
-
data.__useArrow = data.startArrow !== 'none' || data.endArrow !== 'none';
|
|
6794
|
-
doStrokeType(this);
|
|
6795
|
-
}
|
|
6796
|
-
}
|
|
6797
|
-
}));
|
|
6798
|
-
}
|
|
6799
6865
|
function effectType(defaultValue) {
|
|
6800
6866
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
6801
6867
|
set(value) {
|
|
@@ -6830,10 +6896,33 @@ var LeaferUI = (function (exports) {
|
|
|
6830
6896
|
};
|
|
6831
6897
|
}
|
|
6832
6898
|
|
|
6899
|
+
const TextConvert = {};
|
|
6900
|
+
const ColorConvert = {};
|
|
6901
|
+
const PathArrow = {};
|
|
6902
|
+
const Paint = {};
|
|
6903
|
+
const PaintImage = {};
|
|
6904
|
+
const PaintGradient = {};
|
|
6905
|
+
const Effect = {};
|
|
6906
|
+
const Export = {};
|
|
6907
|
+
const State = {
|
|
6908
|
+
setStyleName(_leaf, _styleName, _value) { return needPlugin('state'); },
|
|
6909
|
+
set(_leaf, _stateName) { return needPlugin('state'); }
|
|
6910
|
+
};
|
|
6911
|
+
const Transition = {
|
|
6912
|
+
list: {},
|
|
6913
|
+
register(attrName, fn) {
|
|
6914
|
+
Transition.list[attrName] = fn;
|
|
6915
|
+
},
|
|
6916
|
+
get(attrName) {
|
|
6917
|
+
return Transition.list[attrName];
|
|
6918
|
+
}
|
|
6919
|
+
};
|
|
6920
|
+
|
|
6833
6921
|
const { parse } = PathConvert;
|
|
6834
6922
|
const emptyPaint = {};
|
|
6835
6923
|
const debug$4 = Debug.get('UIData');
|
|
6836
6924
|
class UIData extends LeafData {
|
|
6925
|
+
get scale() { const { scaleX, scaleY } = this; return scaleX !== scaleY ? { x: scaleX, y: scaleY } : scaleX; }
|
|
6837
6926
|
get __strokeWidth() {
|
|
6838
6927
|
const { strokeWidth, strokeWidthFixed } = this;
|
|
6839
6928
|
if (strokeWidthFixed) {
|
|
@@ -6852,9 +6941,10 @@ var LeaferUI = (function (exports) {
|
|
|
6852
6941
|
get __autoSide() { return !this._width || !this._height; }
|
|
6853
6942
|
get __autoSize() { return !this._width && !this._height; }
|
|
6854
6943
|
setVisible(value) {
|
|
6855
|
-
if (this.__leaf.leafer)
|
|
6856
|
-
this.__leaf.leafer.watcher.hasVisible = true;
|
|
6857
6944
|
this._visible = value;
|
|
6945
|
+
const { leafer } = this.__leaf;
|
|
6946
|
+
if (leafer)
|
|
6947
|
+
leafer.watcher.hasVisible = true;
|
|
6858
6948
|
}
|
|
6859
6949
|
setWidth(value) {
|
|
6860
6950
|
if (value < 0) {
|
|
@@ -7045,7 +7135,7 @@ var LeaferUI = (function (exports) {
|
|
|
7045
7135
|
__setImageFill(value) {
|
|
7046
7136
|
if (this.__leaf.image)
|
|
7047
7137
|
this.__leaf.image = null;
|
|
7048
|
-
this.fill = value ? { type: 'image', mode: '
|
|
7138
|
+
this.fill = value ? { type: 'image', mode: 'stretch', url: value } : undefined;
|
|
7049
7139
|
}
|
|
7050
7140
|
__getData() {
|
|
7051
7141
|
const data = super.__getData();
|
|
@@ -7235,19 +7325,8 @@ var LeaferUI = (function (exports) {
|
|
|
7235
7325
|
exports.UI = UI_1 = class UI extends exports.Leaf {
|
|
7236
7326
|
get app() { return this.leafer && this.leafer.app; }
|
|
7237
7327
|
get isFrame() { return false; }
|
|
7238
|
-
set scale(value) {
|
|
7239
|
-
|
|
7240
|
-
this.scaleX = this.scaleY = value;
|
|
7241
|
-
}
|
|
7242
|
-
else {
|
|
7243
|
-
this.scaleX = value.x;
|
|
7244
|
-
this.scaleY = value.y;
|
|
7245
|
-
}
|
|
7246
|
-
}
|
|
7247
|
-
get scale() {
|
|
7248
|
-
const { scaleX, scaleY } = this;
|
|
7249
|
-
return scaleX !== scaleY ? { x: scaleX, y: scaleY } : scaleX;
|
|
7250
|
-
}
|
|
7328
|
+
set scale(value) { MathHelper.assignScale(this, value); }
|
|
7329
|
+
get scale() { return this.__.scale; }
|
|
7251
7330
|
get pen() {
|
|
7252
7331
|
const { path } = this.__;
|
|
7253
7332
|
pen.set(this.path = path || []);
|
|
@@ -7262,8 +7341,15 @@ var LeaferUI = (function (exports) {
|
|
|
7262
7341
|
super(data);
|
|
7263
7342
|
}
|
|
7264
7343
|
reset(_data) { }
|
|
7265
|
-
set(data) {
|
|
7266
|
-
|
|
7344
|
+
set(data, isTemp) {
|
|
7345
|
+
if (isTemp) {
|
|
7346
|
+
this.lockNormalStyle = true;
|
|
7347
|
+
Object.assign(this, data);
|
|
7348
|
+
this.lockNormalStyle = false;
|
|
7349
|
+
}
|
|
7350
|
+
else {
|
|
7351
|
+
Object.assign(this, data);
|
|
7352
|
+
}
|
|
7267
7353
|
}
|
|
7268
7354
|
get(name) {
|
|
7269
7355
|
return typeof name === 'string' ? this.__.__getInput(name) : this.__.__getInputData(name);
|
|
@@ -7326,11 +7412,18 @@ var LeaferUI = (function (exports) {
|
|
|
7326
7412
|
drawer.rect(x, y, width, height);
|
|
7327
7413
|
}
|
|
7328
7414
|
}
|
|
7415
|
+
animate(_keyframe, _options, _type, _isTemp) {
|
|
7416
|
+
return needPlugin('animate');
|
|
7417
|
+
}
|
|
7418
|
+
killAnimate(_type) { }
|
|
7329
7419
|
export(filename, options) {
|
|
7330
7420
|
return Export.export(this, filename, options);
|
|
7331
7421
|
}
|
|
7332
|
-
clone() {
|
|
7333
|
-
|
|
7422
|
+
clone(data) {
|
|
7423
|
+
const json = this.toJSON();
|
|
7424
|
+
if (data)
|
|
7425
|
+
Object.assign(json, data);
|
|
7426
|
+
return UI_1.one(json);
|
|
7334
7427
|
}
|
|
7335
7428
|
static one(data, x, y, width, height) {
|
|
7336
7429
|
return UICreator.get(data.tag || this.prototype.__tag, data, x, y, width, height);
|
|
@@ -7346,6 +7439,8 @@ var LeaferUI = (function (exports) {
|
|
|
7346
7439
|
static setEditInner(_editorName) { }
|
|
7347
7440
|
destroy() {
|
|
7348
7441
|
this.fill = this.stroke = null;
|
|
7442
|
+
if (this.__animate)
|
|
7443
|
+
this.killAnimate();
|
|
7349
7444
|
super.destroy();
|
|
7350
7445
|
}
|
|
7351
7446
|
};
|
|
@@ -7373,12 +7468,6 @@ var LeaferUI = (function (exports) {
|
|
|
7373
7468
|
__decorate([
|
|
7374
7469
|
visibleType(true)
|
|
7375
7470
|
], exports.UI.prototype, "visible", void 0);
|
|
7376
|
-
__decorate([
|
|
7377
|
-
stateType(false)
|
|
7378
|
-
], exports.UI.prototype, "selected", void 0);
|
|
7379
|
-
__decorate([
|
|
7380
|
-
stateType(false)
|
|
7381
|
-
], exports.UI.prototype, "disabled", void 0);
|
|
7382
7471
|
__decorate([
|
|
7383
7472
|
surfaceType(false)
|
|
7384
7473
|
], exports.UI.prototype, "locked", void 0);
|
|
@@ -7451,45 +7540,9 @@ var LeaferUI = (function (exports) {
|
|
|
7451
7540
|
__decorate([
|
|
7452
7541
|
pathType(true)
|
|
7453
7542
|
], exports.UI.prototype, "closed", void 0);
|
|
7454
|
-
__decorate([
|
|
7455
|
-
autoLayoutType(false)
|
|
7456
|
-
], exports.UI.prototype, "flow", void 0);
|
|
7457
7543
|
__decorate([
|
|
7458
7544
|
boundsType(0)
|
|
7459
7545
|
], exports.UI.prototype, "padding", void 0);
|
|
7460
|
-
__decorate([
|
|
7461
|
-
boundsType(0)
|
|
7462
|
-
], exports.UI.prototype, "gap", void 0);
|
|
7463
|
-
__decorate([
|
|
7464
|
-
boundsType('top-left')
|
|
7465
|
-
], exports.UI.prototype, "flowAlign", void 0);
|
|
7466
|
-
__decorate([
|
|
7467
|
-
boundsType(false)
|
|
7468
|
-
], exports.UI.prototype, "flowWrap", void 0);
|
|
7469
|
-
__decorate([
|
|
7470
|
-
boundsType('box')
|
|
7471
|
-
], exports.UI.prototype, "itemBox", void 0);
|
|
7472
|
-
__decorate([
|
|
7473
|
-
boundsType(true)
|
|
7474
|
-
], exports.UI.prototype, "inFlow", void 0);
|
|
7475
|
-
__decorate([
|
|
7476
|
-
boundsType()
|
|
7477
|
-
], exports.UI.prototype, "autoWidth", void 0);
|
|
7478
|
-
__decorate([
|
|
7479
|
-
boundsType()
|
|
7480
|
-
], exports.UI.prototype, "autoHeight", void 0);
|
|
7481
|
-
__decorate([
|
|
7482
|
-
boundsType()
|
|
7483
|
-
], exports.UI.prototype, "lockRatio", void 0);
|
|
7484
|
-
__decorate([
|
|
7485
|
-
boundsType()
|
|
7486
|
-
], exports.UI.prototype, "autoBox", void 0);
|
|
7487
|
-
__decorate([
|
|
7488
|
-
boundsType()
|
|
7489
|
-
], exports.UI.prototype, "widthRange", void 0);
|
|
7490
|
-
__decorate([
|
|
7491
|
-
boundsType()
|
|
7492
|
-
], exports.UI.prototype, "heightRange", void 0);
|
|
7493
7546
|
__decorate([
|
|
7494
7547
|
dataType(false)
|
|
7495
7548
|
], exports.UI.prototype, "draggable", void 0);
|
|
@@ -7553,12 +7606,6 @@ var LeaferUI = (function (exports) {
|
|
|
7553
7606
|
__decorate([
|
|
7554
7607
|
strokeType(10)
|
|
7555
7608
|
], exports.UI.prototype, "miterLimit", void 0);
|
|
7556
|
-
__decorate([
|
|
7557
|
-
arrowType('none')
|
|
7558
|
-
], exports.UI.prototype, "startArrow", void 0);
|
|
7559
|
-
__decorate([
|
|
7560
|
-
arrowType('none')
|
|
7561
|
-
], exports.UI.prototype, "endArrow", void 0);
|
|
7562
7609
|
__decorate([
|
|
7563
7610
|
pathType(0)
|
|
7564
7611
|
], exports.UI.prototype, "cornerRadius", void 0);
|
|
@@ -7580,24 +7627,6 @@ var LeaferUI = (function (exports) {
|
|
|
7580
7627
|
__decorate([
|
|
7581
7628
|
effectType()
|
|
7582
7629
|
], exports.UI.prototype, "grayscale", void 0);
|
|
7583
|
-
__decorate([
|
|
7584
|
-
dataType()
|
|
7585
|
-
], exports.UI.prototype, "normalStyle", void 0);
|
|
7586
|
-
__decorate([
|
|
7587
|
-
dataType()
|
|
7588
|
-
], exports.UI.prototype, "hoverStyle", void 0);
|
|
7589
|
-
__decorate([
|
|
7590
|
-
dataType()
|
|
7591
|
-
], exports.UI.prototype, "pressStyle", void 0);
|
|
7592
|
-
__decorate([
|
|
7593
|
-
dataType()
|
|
7594
|
-
], exports.UI.prototype, "focusStyle", void 0);
|
|
7595
|
-
__decorate([
|
|
7596
|
-
dataType()
|
|
7597
|
-
], exports.UI.prototype, "selectedStyle", void 0);
|
|
7598
|
-
__decorate([
|
|
7599
|
-
dataType()
|
|
7600
|
-
], exports.UI.prototype, "disabledStyle", void 0);
|
|
7601
7630
|
__decorate([
|
|
7602
7631
|
dataType({})
|
|
7603
7632
|
], exports.UI.prototype, "data", void 0);
|
|
@@ -7624,7 +7653,7 @@ var LeaferUI = (function (exports) {
|
|
|
7624
7653
|
if (!this.children)
|
|
7625
7654
|
this.children = [];
|
|
7626
7655
|
}
|
|
7627
|
-
set(data) {
|
|
7656
|
+
set(data, isTemp) {
|
|
7628
7657
|
if (data.children) {
|
|
7629
7658
|
const { children } = data;
|
|
7630
7659
|
delete data.children;
|
|
@@ -7634,7 +7663,7 @@ var LeaferUI = (function (exports) {
|
|
|
7634
7663
|
else {
|
|
7635
7664
|
this.clear();
|
|
7636
7665
|
}
|
|
7637
|
-
super.set(data);
|
|
7666
|
+
super.set(data, isTemp);
|
|
7638
7667
|
let child;
|
|
7639
7668
|
children.forEach(childData => {
|
|
7640
7669
|
child = childData.__ ? childData : UICreator.get(childData.tag, childData);
|
|
@@ -7643,7 +7672,7 @@ var LeaferUI = (function (exports) {
|
|
|
7643
7672
|
data.children = children;
|
|
7644
7673
|
}
|
|
7645
7674
|
else {
|
|
7646
|
-
super.set(data);
|
|
7675
|
+
super.set(data, isTemp);
|
|
7647
7676
|
}
|
|
7648
7677
|
}
|
|
7649
7678
|
toJSON(options) {
|
|
@@ -7970,7 +7999,7 @@ var LeaferUI = (function (exports) {
|
|
|
7970
7999
|
}
|
|
7971
8000
|
}
|
|
7972
8001
|
zoom(_zoomType, _padding, _fixedScale) {
|
|
7973
|
-
return
|
|
8002
|
+
return needPlugin('view');
|
|
7974
8003
|
}
|
|
7975
8004
|
getValidMove(moveX, moveY) { return { x: moveX, y: moveY }; }
|
|
7976
8005
|
getValidScale(changeScale) { return changeScale; }
|
|
@@ -8493,19 +8522,18 @@ var LeaferUI = (function (exports) {
|
|
|
8493
8522
|
this.paint();
|
|
8494
8523
|
}
|
|
8495
8524
|
paint() {
|
|
8496
|
-
this.
|
|
8525
|
+
this.forceRender();
|
|
8497
8526
|
}
|
|
8498
8527
|
__drawAfterFill(canvas, _options) {
|
|
8499
|
-
const
|
|
8500
|
-
|
|
8501
|
-
if (this.__.cornerRadius || this.pathInputed) {
|
|
8528
|
+
const { width, height, cornerRadius } = this.__, { view } = this.canvas;
|
|
8529
|
+
if (cornerRadius || this.pathInputed) {
|
|
8502
8530
|
canvas.save();
|
|
8503
8531
|
canvas.clip();
|
|
8504
|
-
canvas.drawImage(
|
|
8532
|
+
canvas.drawImage(view, 0, 0, view.width, view.height, 0, 0, width, height);
|
|
8505
8533
|
canvas.restore();
|
|
8506
8534
|
}
|
|
8507
8535
|
else {
|
|
8508
|
-
canvas.drawImage(
|
|
8536
|
+
canvas.drawImage(view, 0, 0, view.width, view.height, 0, 0, width, height);
|
|
8509
8537
|
}
|
|
8510
8538
|
}
|
|
8511
8539
|
__updateSize() {
|
|
@@ -8948,21 +8976,29 @@ var LeaferUI = (function (exports) {
|
|
|
8948
8976
|
constructor(params) {
|
|
8949
8977
|
super(params.type);
|
|
8950
8978
|
this.bubbles = true;
|
|
8979
|
+
this.getInner = this.getInnerPoint;
|
|
8980
|
+
this.getLocal = this.getLocalPoint;
|
|
8981
|
+
this.getPage = this.getPagePoint;
|
|
8951
8982
|
Object.assign(this, params);
|
|
8952
8983
|
}
|
|
8953
|
-
|
|
8954
|
-
|
|
8984
|
+
getBoxPoint(relative) {
|
|
8985
|
+
if (!relative)
|
|
8986
|
+
relative = this.current;
|
|
8987
|
+
return relative.getBoxPoint(this);
|
|
8955
8988
|
}
|
|
8956
|
-
|
|
8989
|
+
getInnerPoint(relative) {
|
|
8957
8990
|
if (!relative)
|
|
8958
8991
|
relative = this.current;
|
|
8959
8992
|
return relative.getInnerPoint(this);
|
|
8960
8993
|
}
|
|
8961
|
-
|
|
8994
|
+
getLocalPoint(relative) {
|
|
8962
8995
|
if (!relative)
|
|
8963
8996
|
relative = this.current;
|
|
8964
8997
|
return relative.getLocalPoint(this);
|
|
8965
8998
|
}
|
|
8999
|
+
getPagePoint() {
|
|
9000
|
+
return this.current.getPagePoint(this);
|
|
9001
|
+
}
|
|
8966
9002
|
static changeName(oldName, newName) {
|
|
8967
9003
|
EventCreator.changeName(oldName, newName);
|
|
8968
9004
|
}
|
|
@@ -9070,7 +9106,7 @@ var LeaferUI = (function (exports) {
|
|
|
9070
9106
|
}
|
|
9071
9107
|
getPageBounds() {
|
|
9072
9108
|
const total = this.getPageTotal();
|
|
9073
|
-
const start = this.
|
|
9109
|
+
const start = this.getPagePoint();
|
|
9074
9110
|
const bounds = {};
|
|
9075
9111
|
BoundsHelper.set(bounds, start.x - total.x, start.y - total.y, total.x, total.y);
|
|
9076
9112
|
BoundsHelper.unsign(bounds);
|
|
@@ -9654,7 +9690,7 @@ var LeaferUI = (function (exports) {
|
|
|
9654
9690
|
if (leaf.destroyed)
|
|
9655
9691
|
return false;
|
|
9656
9692
|
if (leaf.__.hitSelf && !exclude(leaf, excludePath)) {
|
|
9657
|
-
if (State.updateEventStyle)
|
|
9693
|
+
if (State.updateEventStyle && !capture)
|
|
9658
9694
|
State.updateEventStyle(leaf, type);
|
|
9659
9695
|
if (leaf.hasEvent(type, capture)) {
|
|
9660
9696
|
data.phase = capture ? 1 : ((leaf === data.target) ? 2 : 3);
|
|
@@ -9759,7 +9795,7 @@ var LeaferUI = (function (exports) {
|
|
|
9759
9795
|
this.tapWait();
|
|
9760
9796
|
this.longPressWait(data);
|
|
9761
9797
|
}
|
|
9762
|
-
this.
|
|
9798
|
+
this.waitRightTap = PointerButton.right(data);
|
|
9763
9799
|
this.dragger.setDragData(data);
|
|
9764
9800
|
if (!this.isHoldRightKey)
|
|
9765
9801
|
this.updateCursor(data);
|
|
@@ -9787,7 +9823,7 @@ var LeaferUI = (function (exports) {
|
|
|
9787
9823
|
if (canDrag) {
|
|
9788
9824
|
if (this.waitTap)
|
|
9789
9825
|
this.pointerWaitCancel();
|
|
9790
|
-
this.
|
|
9826
|
+
this.waitRightTap = false;
|
|
9791
9827
|
}
|
|
9792
9828
|
this.dragger.checkDrag(data, canDrag);
|
|
9793
9829
|
}
|
|
@@ -9841,10 +9877,15 @@ var LeaferUI = (function (exports) {
|
|
|
9841
9877
|
menu(data) {
|
|
9842
9878
|
this.findPath(data);
|
|
9843
9879
|
this.emit(exports.PointerEvent.MENU, data);
|
|
9880
|
+
this.waitMenuTap = true;
|
|
9881
|
+
if (!this.downData && this.waitRightTap)
|
|
9882
|
+
this.menuTap(data);
|
|
9844
9883
|
}
|
|
9845
9884
|
menuTap(data) {
|
|
9846
|
-
if (this.waitMenuTap)
|
|
9885
|
+
if (this.waitRightTap && this.waitMenuTap) {
|
|
9847
9886
|
this.emit(exports.PointerEvent.MENU_TAP, data);
|
|
9887
|
+
this.waitRightTap = this.waitMenuTap = false;
|
|
9888
|
+
}
|
|
9848
9889
|
}
|
|
9849
9890
|
move(data) {
|
|
9850
9891
|
this.transformer.move(data);
|
|
@@ -10688,6 +10729,8 @@ var LeaferUI = (function (exports) {
|
|
|
10688
10729
|
let { width, height } = image;
|
|
10689
10730
|
if (paint.padding)
|
|
10690
10731
|
box = tempBox.set(box).shrink(paint.padding);
|
|
10732
|
+
if (paint.mode === 'strench')
|
|
10733
|
+
paint.mode = 'stretch';
|
|
10691
10734
|
const { opacity, mode, align, offset, scale, size, rotation, repeat } = paint;
|
|
10692
10735
|
const sameBox = box.width === width && box.height === height;
|
|
10693
10736
|
const data = { mode };
|
|
@@ -10716,7 +10759,7 @@ var LeaferUI = (function (exports) {
|
|
|
10716
10759
|
if (offset)
|
|
10717
10760
|
x += offset.x, y += offset.y;
|
|
10718
10761
|
switch (mode) {
|
|
10719
|
-
case '
|
|
10762
|
+
case 'stretch':
|
|
10720
10763
|
if (!sameBox)
|
|
10721
10764
|
width = box.width, height = box.height;
|
|
10722
10765
|
break;
|
|
@@ -10743,7 +10786,7 @@ var LeaferUI = (function (exports) {
|
|
|
10743
10786
|
translate(data.transform, box.x, box.y);
|
|
10744
10787
|
}
|
|
10745
10788
|
}
|
|
10746
|
-
if (scaleX && mode !== '
|
|
10789
|
+
if (scaleX && mode !== 'stretch') {
|
|
10747
10790
|
data.scaleX = scaleX;
|
|
10748
10791
|
data.scaleY = scaleY;
|
|
10749
10792
|
}
|
|
@@ -10847,7 +10890,7 @@ var LeaferUI = (function (exports) {
|
|
|
10847
10890
|
const { ceil, abs: abs$1 } = Math;
|
|
10848
10891
|
function createPattern(ui, paint, pixelRatio) {
|
|
10849
10892
|
let { scaleX, scaleY } = ImageManager.patternLocked ? ui.__world : ui.__nowWorld;
|
|
10850
|
-
const id = scaleX + '-' + scaleY;
|
|
10893
|
+
const id = scaleX + '-' + scaleY + '-' + pixelRatio;
|
|
10851
10894
|
if (paint.patternId !== id && !ui.destroyed) {
|
|
10852
10895
|
scaleX = abs$1(scaleX);
|
|
10853
10896
|
scaleY = abs$1(scaleY);
|
|
@@ -10909,7 +10952,8 @@ var LeaferUI = (function (exports) {
|
|
|
10909
10952
|
const { abs } = Math;
|
|
10910
10953
|
function checkImage(ui, canvas, paint, allowPaint) {
|
|
10911
10954
|
const { scaleX, scaleY } = ImageManager.patternLocked ? ui.__world : ui.__nowWorld;
|
|
10912
|
-
|
|
10955
|
+
const { pixelRatio } = canvas;
|
|
10956
|
+
if (!paint.data || (paint.patternId === scaleX + '-' + scaleY + '-' + pixelRatio && !Export.running)) {
|
|
10913
10957
|
return false;
|
|
10914
10958
|
}
|
|
10915
10959
|
else {
|
|
@@ -10917,8 +10961,8 @@ var LeaferUI = (function (exports) {
|
|
|
10917
10961
|
if (allowPaint) {
|
|
10918
10962
|
if (!data.repeat) {
|
|
10919
10963
|
let { width, height } = data;
|
|
10920
|
-
width *= abs(scaleX) *
|
|
10921
|
-
height *= abs(scaleY) *
|
|
10964
|
+
width *= abs(scaleX) * pixelRatio;
|
|
10965
|
+
height *= abs(scaleY) * pixelRatio;
|
|
10922
10966
|
if (data.scaleX) {
|
|
10923
10967
|
width *= data.scaleX;
|
|
10924
10968
|
height *= data.scaleY;
|
|
@@ -10944,14 +10988,14 @@ var LeaferUI = (function (exports) {
|
|
|
10944
10988
|
}
|
|
10945
10989
|
else {
|
|
10946
10990
|
if (!paint.style || paint.sync || Export.running) {
|
|
10947
|
-
createPattern(ui, paint,
|
|
10991
|
+
createPattern(ui, paint, pixelRatio);
|
|
10948
10992
|
}
|
|
10949
10993
|
else {
|
|
10950
10994
|
if (!paint.patternTask) {
|
|
10951
10995
|
paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, void 0, void 0, function* () {
|
|
10952
10996
|
paint.patternTask = null;
|
|
10953
10997
|
if (canvas.bounds.hit(ui.__nowWorld))
|
|
10954
|
-
createPattern(ui, paint,
|
|
10998
|
+
createPattern(ui, paint, pixelRatio);
|
|
10955
10999
|
ui.forceUpdate('surface');
|
|
10956
11000
|
}), 300);
|
|
10957
11001
|
}
|
|
@@ -11015,14 +11059,16 @@ var LeaferUI = (function (exports) {
|
|
|
11015
11059
|
return data;
|
|
11016
11060
|
}
|
|
11017
11061
|
function applyStops(gradient, stops, opacity) {
|
|
11018
|
-
|
|
11019
|
-
|
|
11020
|
-
|
|
11021
|
-
|
|
11022
|
-
|
|
11023
|
-
|
|
11024
|
-
|
|
11025
|
-
|
|
11062
|
+
if (stops) {
|
|
11063
|
+
let stop;
|
|
11064
|
+
for (let i = 0, len = stops.length; i < len; i++) {
|
|
11065
|
+
stop = stops[i];
|
|
11066
|
+
if (typeof stop === 'string') {
|
|
11067
|
+
gradient.addColorStop(i / (len - 1), ColorConvert.string(stop, opacity));
|
|
11068
|
+
}
|
|
11069
|
+
else {
|
|
11070
|
+
gradient.addColorStop(stop.offset, ColorConvert.string(stop.color, opacity));
|
|
11071
|
+
}
|
|
11026
11072
|
}
|
|
11027
11073
|
}
|
|
11028
11074
|
}
|
|
@@ -11778,10 +11824,15 @@ var LeaferUI = (function (exports) {
|
|
|
11778
11824
|
};
|
|
11779
11825
|
|
|
11780
11826
|
function string(color, opacity) {
|
|
11781
|
-
|
|
11782
|
-
|
|
11827
|
+
const doOpacity = typeof opacity === 'number' && opacity !== 1;
|
|
11828
|
+
if (typeof color === 'string') {
|
|
11829
|
+
if (doOpacity && ColorConvert.object)
|
|
11830
|
+
color = ColorConvert.object(color);
|
|
11831
|
+
else
|
|
11832
|
+
return color;
|
|
11833
|
+
}
|
|
11783
11834
|
let a = color.a === undefined ? 1 : color.a;
|
|
11784
|
-
if (
|
|
11835
|
+
if (doOpacity)
|
|
11785
11836
|
a *= opacity;
|
|
11786
11837
|
const rgb = color.r + ',' + color.g + ',' + color.b;
|
|
11787
11838
|
return a === 1 ? 'rgb(' + rgb + ')' : 'rgba(' + rgb + ',' + a + ')';
|
|
@@ -11994,7 +12045,6 @@ var LeaferUI = (function (exports) {
|
|
|
11994
12045
|
useCanvas();
|
|
11995
12046
|
|
|
11996
12047
|
exports.AlignHelper = AlignHelper;
|
|
11997
|
-
exports.AnimateEvent = AnimateEvent;
|
|
11998
12048
|
exports.AroundHelper = AroundHelper;
|
|
11999
12049
|
exports.AutoBounds = AutoBounds;
|
|
12000
12050
|
exports.BezierHelper = BezierHelper;
|
|
@@ -12016,6 +12066,7 @@ var LeaferUI = (function (exports) {
|
|
|
12016
12066
|
exports.EllipseHelper = EllipseHelper;
|
|
12017
12067
|
exports.Event = Event;
|
|
12018
12068
|
exports.EventCreator = EventCreator;
|
|
12069
|
+
exports.Eventer = Eventer;
|
|
12019
12070
|
exports.Export = Export;
|
|
12020
12071
|
exports.FileHelper = FileHelper;
|
|
12021
12072
|
exports.FrameData = FrameData;
|
|
@@ -12096,6 +12147,7 @@ var LeaferUI = (function (exports) {
|
|
|
12096
12147
|
exports.TaskProcessor = TaskProcessor;
|
|
12097
12148
|
exports.TextConvert = TextConvert;
|
|
12098
12149
|
exports.TextData = TextData;
|
|
12150
|
+
exports.Transition = Transition;
|
|
12099
12151
|
exports.TwoPointBoundsHelper = TwoPointBoundsHelper;
|
|
12100
12152
|
exports.UIBounds = UIBounds;
|
|
12101
12153
|
exports.UICreator = UICreator;
|
|
@@ -12109,7 +12161,6 @@ var LeaferUI = (function (exports) {
|
|
|
12109
12161
|
exports.addInteractionWindow = addInteractionWindow;
|
|
12110
12162
|
exports.affectRenderBoundsType = affectRenderBoundsType;
|
|
12111
12163
|
exports.affectStrokeBoundsType = affectStrokeBoundsType;
|
|
12112
|
-
exports.arrowType = arrowType;
|
|
12113
12164
|
exports.attr = attr;
|
|
12114
12165
|
exports.autoLayoutType = autoLayoutType;
|
|
12115
12166
|
exports.boundsType = boundsType;
|
|
@@ -12132,10 +12183,11 @@ var LeaferUI = (function (exports) {
|
|
|
12132
12183
|
exports.getMatrixData = getMatrixData;
|
|
12133
12184
|
exports.getPointData = getPointData;
|
|
12134
12185
|
exports.hitType = hitType;
|
|
12135
|
-
exports.
|
|
12186
|
+
exports.isNull = isNull;
|
|
12136
12187
|
exports.layoutProcessor = layoutProcessor;
|
|
12137
12188
|
exports.maskType = maskType;
|
|
12138
12189
|
exports.naturalBoundsType = naturalBoundsType;
|
|
12190
|
+
exports.needPlugin = needPlugin;
|
|
12139
12191
|
exports.opacityType = opacityType;
|
|
12140
12192
|
exports.pathInputType = pathInputType;
|
|
12141
12193
|
exports.pathType = pathType;
|
|
@@ -12149,7 +12201,6 @@ var LeaferUI = (function (exports) {
|
|
|
12149
12201
|
exports.rotationType = rotationType;
|
|
12150
12202
|
exports.scaleType = scaleType;
|
|
12151
12203
|
exports.sortType = sortType;
|
|
12152
|
-
exports.stateType = stateType;
|
|
12153
12204
|
exports.strokeType = strokeType;
|
|
12154
12205
|
exports.surfaceType = surfaceType;
|
|
12155
12206
|
exports.tempBounds = tempBounds$1;
|