@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.module.js
CHANGED
|
@@ -119,11 +119,18 @@ const MathHelper = {
|
|
|
119
119
|
scaleData.scaleX = (typeof size === 'number' ? size : size.width) / originSize.width;
|
|
120
120
|
scaleData.scaleY = (typeof size === 'number' ? size : size.height) / originSize.height;
|
|
121
121
|
}
|
|
122
|
-
else if (scale)
|
|
123
|
-
scaleData
|
|
124
|
-
scaleData.scaleY = typeof scale === 'number' ? scale : scale.y;
|
|
125
|
-
}
|
|
122
|
+
else if (scale)
|
|
123
|
+
MathHelper.assignScale(scaleData, scale);
|
|
126
124
|
return scaleData;
|
|
125
|
+
},
|
|
126
|
+
assignScale(scaleData, scale) {
|
|
127
|
+
if (typeof scale === 'number') {
|
|
128
|
+
scaleData.scaleX = scaleData.scaleY = scale;
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
scaleData.scaleX = scale.x;
|
|
132
|
+
scaleData.scaleY = scale.y;
|
|
133
|
+
}
|
|
127
134
|
}
|
|
128
135
|
};
|
|
129
136
|
const OneRadian = PI$4 / 180;
|
|
@@ -1255,7 +1262,6 @@ const AroundHelper = {
|
|
|
1255
1262
|
tempPoint: {},
|
|
1256
1263
|
get: get$4,
|
|
1257
1264
|
toPoint(around, bounds, to, onlySize, pointBounds) {
|
|
1258
|
-
to || (to = {});
|
|
1259
1265
|
const point = get$4(around);
|
|
1260
1266
|
to.x = point.x;
|
|
1261
1267
|
to.y = point.y;
|
|
@@ -1390,6 +1396,10 @@ const Run = {
|
|
|
1390
1396
|
};
|
|
1391
1397
|
const R = Run;
|
|
1392
1398
|
|
|
1399
|
+
function needPlugin(name) {
|
|
1400
|
+
console.error('need plugin: @leafer-in/' + name);
|
|
1401
|
+
}
|
|
1402
|
+
|
|
1393
1403
|
const debug$e = Debug.get('UICreator');
|
|
1394
1404
|
const UICreator = {
|
|
1395
1405
|
list: {},
|
|
@@ -1652,6 +1662,9 @@ var Answer;
|
|
|
1652
1662
|
Answer[Answer["YesAndSkip"] = 3] = "YesAndSkip";
|
|
1653
1663
|
})(Answer || (Answer = {}));
|
|
1654
1664
|
const emptyData = {};
|
|
1665
|
+
function isNull(value) {
|
|
1666
|
+
return value === undefined || value === null;
|
|
1667
|
+
}
|
|
1655
1668
|
|
|
1656
1669
|
/******************************************************************************
|
|
1657
1670
|
Copyright (c) Microsoft Corporation.
|
|
@@ -2417,7 +2430,7 @@ const BezierHelper = {
|
|
|
2417
2430
|
let startY = y = rotationSin * radiusX * startCos + rotationCos * radiusY * startSin;
|
|
2418
2431
|
let fromX = cx + x, fromY = cy + y;
|
|
2419
2432
|
if (data)
|
|
2420
|
-
data.push(L$6, fromX, fromY);
|
|
2433
|
+
data.push(data.length ? L$6 : M$5, fromX, fromY);
|
|
2421
2434
|
if (setPointBounds)
|
|
2422
2435
|
setPoint$2(setPointBounds, fromX, fromY);
|
|
2423
2436
|
if (setStartPoint)
|
|
@@ -3086,8 +3099,7 @@ const PathBounds = {
|
|
|
3086
3099
|
toTwoPointBounds(data, setPointBounds) {
|
|
3087
3100
|
if (!data || !data.length)
|
|
3088
3101
|
return setPoint$1(setPointBounds, 0, 0);
|
|
3089
|
-
let command;
|
|
3090
|
-
let i = 0, x = 0, y = 0, x1, y1, toX, toY;
|
|
3102
|
+
let i = 0, x = 0, y = 0, x1, y1, toX, toY, command;
|
|
3091
3103
|
const len = data.length;
|
|
3092
3104
|
while (i < len) {
|
|
3093
3105
|
command = data[i];
|
|
@@ -3743,7 +3755,7 @@ function autoLayoutType(defaultValue) {
|
|
|
3743
3755
|
set(value) {
|
|
3744
3756
|
if (this.__setAttr(key, value)) {
|
|
3745
3757
|
this.__layout.matrixChanged || this.__layout.matrixChange();
|
|
3746
|
-
this.__hasAutoLayout = !!
|
|
3758
|
+
this.__hasAutoLayout = !!(this.origin || this.around || this.flow);
|
|
3747
3759
|
if (!this.__local)
|
|
3748
3760
|
this.__layout.createLocal();
|
|
3749
3761
|
}
|
|
@@ -3836,14 +3848,25 @@ function visibleType(defaultValue) {
|
|
|
3836
3848
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3837
3849
|
set(value) {
|
|
3838
3850
|
const oldValue = this.visible;
|
|
3839
|
-
if (
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3851
|
+
if (oldValue === true && value === 0) {
|
|
3852
|
+
if (this.animationOut)
|
|
3853
|
+
return this.__runAnimation('out', () => doVisible(this, key, value, oldValue));
|
|
3854
|
+
}
|
|
3855
|
+
else if (oldValue === 0 && value === true) {
|
|
3856
|
+
if (this.animation)
|
|
3857
|
+
this.__runAnimation('in');
|
|
3843
3858
|
}
|
|
3859
|
+
doVisible(this, key, value, oldValue);
|
|
3844
3860
|
}
|
|
3845
3861
|
}));
|
|
3846
3862
|
}
|
|
3863
|
+
function doVisible(leaf, key, value, oldValue) {
|
|
3864
|
+
if (leaf.__setAttr(key, value)) {
|
|
3865
|
+
leaf.__layout.opacityChanged || leaf.__layout.opacityChange();
|
|
3866
|
+
if (oldValue === 0 || value === 0)
|
|
3867
|
+
doBoundsType(leaf);
|
|
3868
|
+
}
|
|
3869
|
+
}
|
|
3847
3870
|
function sortType(defaultValue) {
|
|
3848
3871
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3849
3872
|
set(value) {
|
|
@@ -3927,7 +3950,16 @@ function defineDataProcessor(target, key, defaultValue) {
|
|
|
3927
3950
|
if (defaultValue === undefined) {
|
|
3928
3951
|
property.get = function () { return this[computedKey]; };
|
|
3929
3952
|
}
|
|
3930
|
-
else if (
|
|
3953
|
+
else if (typeof defaultValue === 'object') {
|
|
3954
|
+
const { clone } = DataHelper;
|
|
3955
|
+
property.get = function () {
|
|
3956
|
+
let v = this[computedKey];
|
|
3957
|
+
if (v === undefined)
|
|
3958
|
+
this[computedKey] = v = clone(defaultValue);
|
|
3959
|
+
return v;
|
|
3960
|
+
};
|
|
3961
|
+
}
|
|
3962
|
+
if (key === 'width') {
|
|
3931
3963
|
property.get = function () {
|
|
3932
3964
|
const v = this[computedKey];
|
|
3933
3965
|
if (v === undefined) {
|
|
@@ -4451,15 +4483,16 @@ class LeafLayout {
|
|
|
4451
4483
|
}
|
|
4452
4484
|
getLayoutBounds(type, relative = 'world', unscale) {
|
|
4453
4485
|
const { leaf } = this;
|
|
4454
|
-
let point, matrix, bounds = this.getInnerBounds(type);
|
|
4486
|
+
let point, matrix, layoutBounds, bounds = this.getInnerBounds(type);
|
|
4455
4487
|
switch (relative) {
|
|
4456
4488
|
case 'world':
|
|
4457
4489
|
point = leaf.getWorldPoint(bounds);
|
|
4458
4490
|
matrix = leaf.__world;
|
|
4459
4491
|
break;
|
|
4460
4492
|
case 'local':
|
|
4493
|
+
const { scaleX, scaleY, rotation, skewX, skewY } = leaf.__;
|
|
4494
|
+
layoutBounds = { scaleX, scaleY, rotation, skewX, skewY };
|
|
4461
4495
|
point = leaf.getLocalPointByInner(bounds);
|
|
4462
|
-
matrix = leaf.__localMatrix;
|
|
4463
4496
|
break;
|
|
4464
4497
|
case 'inner':
|
|
4465
4498
|
point = bounds;
|
|
@@ -4471,7 +4504,8 @@ class LeafLayout {
|
|
|
4471
4504
|
point = leaf.getWorldPoint(bounds, relative);
|
|
4472
4505
|
matrix = getRelativeWorld$1(leaf, relative, true);
|
|
4473
4506
|
}
|
|
4474
|
-
|
|
4507
|
+
if (!layoutBounds)
|
|
4508
|
+
layoutBounds = MatrixHelper.getLayout(matrix);
|
|
4475
4509
|
copy$6(layoutBounds, bounds);
|
|
4476
4510
|
PointHelper.copy(layoutBounds, point);
|
|
4477
4511
|
if (unscale) {
|
|
@@ -4594,144 +4628,6 @@ class LeafLayout {
|
|
|
4594
4628
|
destroy() { }
|
|
4595
4629
|
}
|
|
4596
4630
|
|
|
4597
|
-
const empty = {};
|
|
4598
|
-
const LeafEventer = {
|
|
4599
|
-
on(type, listener, options) {
|
|
4600
|
-
let capture, once;
|
|
4601
|
-
if (options) {
|
|
4602
|
-
if (options === 'once') {
|
|
4603
|
-
once = true;
|
|
4604
|
-
}
|
|
4605
|
-
else if (typeof options === 'boolean') {
|
|
4606
|
-
capture = options;
|
|
4607
|
-
}
|
|
4608
|
-
else {
|
|
4609
|
-
capture = options.capture;
|
|
4610
|
-
once = options.once;
|
|
4611
|
-
}
|
|
4612
|
-
}
|
|
4613
|
-
let events;
|
|
4614
|
-
const map = __getListenerMap(this, capture, true);
|
|
4615
|
-
const typeList = typeof type === 'string' ? type.split(' ') : type;
|
|
4616
|
-
const item = once ? { listener, once } : { listener };
|
|
4617
|
-
typeList.forEach(type => {
|
|
4618
|
-
if (type) {
|
|
4619
|
-
events = map[type];
|
|
4620
|
-
if (events) {
|
|
4621
|
-
if (events.findIndex(item => item.listener === listener) === -1)
|
|
4622
|
-
events.push(item);
|
|
4623
|
-
}
|
|
4624
|
-
else {
|
|
4625
|
-
map[type] = [item];
|
|
4626
|
-
}
|
|
4627
|
-
}
|
|
4628
|
-
});
|
|
4629
|
-
},
|
|
4630
|
-
off(type, listener, options) {
|
|
4631
|
-
if (type) {
|
|
4632
|
-
const typeList = typeof type === 'string' ? type.split(' ') : type;
|
|
4633
|
-
if (listener) {
|
|
4634
|
-
let capture;
|
|
4635
|
-
if (options)
|
|
4636
|
-
capture = typeof options === 'boolean' ? options : (options === 'once' ? false : options.capture);
|
|
4637
|
-
let events, index;
|
|
4638
|
-
const map = __getListenerMap(this, capture);
|
|
4639
|
-
typeList.forEach(type => {
|
|
4640
|
-
if (type) {
|
|
4641
|
-
events = map[type];
|
|
4642
|
-
if (events) {
|
|
4643
|
-
index = events.findIndex(item => item.listener === listener);
|
|
4644
|
-
if (index > -1)
|
|
4645
|
-
events.splice(index, 1);
|
|
4646
|
-
if (!events.length)
|
|
4647
|
-
delete map[type];
|
|
4648
|
-
}
|
|
4649
|
-
}
|
|
4650
|
-
});
|
|
4651
|
-
}
|
|
4652
|
-
else {
|
|
4653
|
-
const { __bubbleMap: b, __captureMap: c } = this;
|
|
4654
|
-
typeList.forEach(type => {
|
|
4655
|
-
if (b)
|
|
4656
|
-
delete b[type];
|
|
4657
|
-
if (c)
|
|
4658
|
-
delete c[type];
|
|
4659
|
-
});
|
|
4660
|
-
}
|
|
4661
|
-
}
|
|
4662
|
-
else {
|
|
4663
|
-
this.__bubbleMap = this.__captureMap = undefined;
|
|
4664
|
-
}
|
|
4665
|
-
},
|
|
4666
|
-
on_(type, listener, bind, options) {
|
|
4667
|
-
if (bind)
|
|
4668
|
-
listener = listener.bind(bind);
|
|
4669
|
-
this.on(type, listener, options);
|
|
4670
|
-
return { type, current: this, listener, options };
|
|
4671
|
-
},
|
|
4672
|
-
off_(id) {
|
|
4673
|
-
if (!id)
|
|
4674
|
-
return;
|
|
4675
|
-
const list = id instanceof Array ? id : [id];
|
|
4676
|
-
list.forEach(item => item.current.off(item.type, item.listener, item.options));
|
|
4677
|
-
list.length = 0;
|
|
4678
|
-
},
|
|
4679
|
-
once(type, listener, capture) {
|
|
4680
|
-
this.on(type, listener, { once: true, capture });
|
|
4681
|
-
},
|
|
4682
|
-
emit(type, event, capture) {
|
|
4683
|
-
if (!event && EventCreator.has(type))
|
|
4684
|
-
event = EventCreator.get(type, { type, target: this, current: this });
|
|
4685
|
-
const map = __getListenerMap(this, capture);
|
|
4686
|
-
const list = map[type];
|
|
4687
|
-
if (list) {
|
|
4688
|
-
let item;
|
|
4689
|
-
for (let i = 0, len = list.length; i < len; i++) {
|
|
4690
|
-
item = list[i];
|
|
4691
|
-
item.listener(event);
|
|
4692
|
-
if (item.once) {
|
|
4693
|
-
this.off(type, item.listener, capture);
|
|
4694
|
-
i--, len--;
|
|
4695
|
-
}
|
|
4696
|
-
if (event && event.isStopNow)
|
|
4697
|
-
break;
|
|
4698
|
-
}
|
|
4699
|
-
}
|
|
4700
|
-
this.syncEventer && this.syncEventer.emitEvent(event, capture);
|
|
4701
|
-
},
|
|
4702
|
-
emitEvent(event, capture) {
|
|
4703
|
-
event.current = this;
|
|
4704
|
-
this.emit(event.type, event, capture);
|
|
4705
|
-
},
|
|
4706
|
-
hasEvent(type, capture) {
|
|
4707
|
-
if (this.syncEventer && this.syncEventer.hasEvent(type, capture))
|
|
4708
|
-
return true;
|
|
4709
|
-
const { __bubbleMap: b, __captureMap: c } = this;
|
|
4710
|
-
const hasB = b && b[type], hasC = c && c[type];
|
|
4711
|
-
return !!(capture === undefined ? (hasB || hasC) : (capture ? hasC : hasB));
|
|
4712
|
-
},
|
|
4713
|
-
};
|
|
4714
|
-
function __getListenerMap(eventer, capture, create) {
|
|
4715
|
-
if (capture) {
|
|
4716
|
-
const { __captureMap: c } = eventer;
|
|
4717
|
-
if (c) {
|
|
4718
|
-
return c;
|
|
4719
|
-
}
|
|
4720
|
-
else {
|
|
4721
|
-
return create ? eventer.__captureMap = {} : empty;
|
|
4722
|
-
}
|
|
4723
|
-
}
|
|
4724
|
-
else {
|
|
4725
|
-
const { __bubbleMap: b } = eventer;
|
|
4726
|
-
if (b) {
|
|
4727
|
-
return b;
|
|
4728
|
-
}
|
|
4729
|
-
else {
|
|
4730
|
-
return create ? eventer.__bubbleMap = {} : empty;
|
|
4731
|
-
}
|
|
4732
|
-
}
|
|
4733
|
-
}
|
|
4734
|
-
|
|
4735
4631
|
class Event {
|
|
4736
4632
|
constructor(type, target) {
|
|
4737
4633
|
this.bubbles = false;
|
|
@@ -4766,7 +4662,10 @@ class ChildEvent extends Event {
|
|
|
4766
4662
|
}
|
|
4767
4663
|
ChildEvent.ADD = 'child.add';
|
|
4768
4664
|
ChildEvent.REMOVE = 'child.remove';
|
|
4769
|
-
ChildEvent.
|
|
4665
|
+
ChildEvent.CREATED = 'created';
|
|
4666
|
+
ChildEvent.MOUNTED = 'mounted';
|
|
4667
|
+
ChildEvent.UNMOUNTED = 'unmounted';
|
|
4668
|
+
ChildEvent.DESTROY = 'destroy';
|
|
4770
4669
|
|
|
4771
4670
|
class PropertyEvent extends Event {
|
|
4772
4671
|
constructor(type, target, attrName, oldValue, newValue) {
|
|
@@ -4844,10 +4743,6 @@ LayoutEvent.AFTER = 'layout.after';
|
|
|
4844
4743
|
LayoutEvent.AGAIN = 'layout.again';
|
|
4845
4744
|
LayoutEvent.END = 'layout.end';
|
|
4846
4745
|
|
|
4847
|
-
class AnimateEvent extends Event {
|
|
4848
|
-
}
|
|
4849
|
-
AnimateEvent.FRAME = 'animate.frame';
|
|
4850
|
-
|
|
4851
4746
|
class RenderEvent extends Event {
|
|
4852
4747
|
constructor(type, times, bounds, options) {
|
|
4853
4748
|
super(type);
|
|
@@ -4880,6 +4775,157 @@ LeaferEvent.STOP = 'leafer.stop';
|
|
|
4880
4775
|
LeaferEvent.RESTART = 'leafer.restart';
|
|
4881
4776
|
LeaferEvent.END = 'leafer.end';
|
|
4882
4777
|
|
|
4778
|
+
const empty = {};
|
|
4779
|
+
class Eventer {
|
|
4780
|
+
set event(map) { this.on(map); }
|
|
4781
|
+
on(type, listener, options) {
|
|
4782
|
+
if (!listener) {
|
|
4783
|
+
let event, map = type;
|
|
4784
|
+
for (let key in map)
|
|
4785
|
+
event = map[key], event instanceof Array ? this.on(key, event[0], event[1]) : this.on(key, event);
|
|
4786
|
+
return;
|
|
4787
|
+
}
|
|
4788
|
+
let capture, once;
|
|
4789
|
+
if (options) {
|
|
4790
|
+
if (options === 'once') {
|
|
4791
|
+
once = true;
|
|
4792
|
+
}
|
|
4793
|
+
else if (typeof options === 'boolean') {
|
|
4794
|
+
capture = options;
|
|
4795
|
+
}
|
|
4796
|
+
else {
|
|
4797
|
+
capture = options.capture;
|
|
4798
|
+
once = options.once;
|
|
4799
|
+
}
|
|
4800
|
+
}
|
|
4801
|
+
let events;
|
|
4802
|
+
const map = __getListenerMap(this, capture, true);
|
|
4803
|
+
const typeList = typeof type === 'string' ? type.split(' ') : type;
|
|
4804
|
+
const item = once ? { listener, once } : { listener };
|
|
4805
|
+
typeList.forEach(type => {
|
|
4806
|
+
if (type) {
|
|
4807
|
+
events = map[type];
|
|
4808
|
+
if (events) {
|
|
4809
|
+
if (events.findIndex(item => item.listener === listener) === -1)
|
|
4810
|
+
events.push(item);
|
|
4811
|
+
}
|
|
4812
|
+
else {
|
|
4813
|
+
map[type] = [item];
|
|
4814
|
+
}
|
|
4815
|
+
}
|
|
4816
|
+
});
|
|
4817
|
+
}
|
|
4818
|
+
off(type, listener, options) {
|
|
4819
|
+
if (type) {
|
|
4820
|
+
const typeList = typeof type === 'string' ? type.split(' ') : type;
|
|
4821
|
+
if (listener) {
|
|
4822
|
+
let capture;
|
|
4823
|
+
if (options)
|
|
4824
|
+
capture = typeof options === 'boolean' ? options : (options === 'once' ? false : options.capture);
|
|
4825
|
+
let events, index;
|
|
4826
|
+
const map = __getListenerMap(this, capture);
|
|
4827
|
+
typeList.forEach(type => {
|
|
4828
|
+
if (type) {
|
|
4829
|
+
events = map[type];
|
|
4830
|
+
if (events) {
|
|
4831
|
+
index = events.findIndex(item => item.listener === listener);
|
|
4832
|
+
if (index > -1)
|
|
4833
|
+
events.splice(index, 1);
|
|
4834
|
+
if (!events.length)
|
|
4835
|
+
delete map[type];
|
|
4836
|
+
}
|
|
4837
|
+
}
|
|
4838
|
+
});
|
|
4839
|
+
}
|
|
4840
|
+
else {
|
|
4841
|
+
const { __bubbleMap: b, __captureMap: c } = this;
|
|
4842
|
+
typeList.forEach(type => {
|
|
4843
|
+
if (b)
|
|
4844
|
+
delete b[type];
|
|
4845
|
+
if (c)
|
|
4846
|
+
delete c[type];
|
|
4847
|
+
});
|
|
4848
|
+
}
|
|
4849
|
+
}
|
|
4850
|
+
else {
|
|
4851
|
+
this.__bubbleMap = this.__captureMap = undefined;
|
|
4852
|
+
}
|
|
4853
|
+
}
|
|
4854
|
+
on_(type, listener, bind, options) {
|
|
4855
|
+
if (bind)
|
|
4856
|
+
listener = listener.bind(bind);
|
|
4857
|
+
this.on(type, listener, options);
|
|
4858
|
+
return { type, current: this, listener, options };
|
|
4859
|
+
}
|
|
4860
|
+
off_(id) {
|
|
4861
|
+
if (!id)
|
|
4862
|
+
return;
|
|
4863
|
+
const list = id instanceof Array ? id : [id];
|
|
4864
|
+
list.forEach(item => item.current.off(item.type, item.listener, item.options));
|
|
4865
|
+
list.length = 0;
|
|
4866
|
+
}
|
|
4867
|
+
once(type, listener, capture) {
|
|
4868
|
+
this.on(type, listener, { once: true, capture });
|
|
4869
|
+
}
|
|
4870
|
+
emit(type, event, capture) {
|
|
4871
|
+
if (!event && EventCreator.has(type))
|
|
4872
|
+
event = EventCreator.get(type, { type, target: this, current: this });
|
|
4873
|
+
const map = __getListenerMap(this, capture);
|
|
4874
|
+
const list = map[type];
|
|
4875
|
+
if (list) {
|
|
4876
|
+
let item;
|
|
4877
|
+
for (let i = 0, len = list.length; i < len; i++) {
|
|
4878
|
+
item = list[i];
|
|
4879
|
+
item.listener(event);
|
|
4880
|
+
if (item.once) {
|
|
4881
|
+
this.off(type, item.listener, capture);
|
|
4882
|
+
i--, len--;
|
|
4883
|
+
}
|
|
4884
|
+
if (event && event.isStopNow)
|
|
4885
|
+
break;
|
|
4886
|
+
}
|
|
4887
|
+
}
|
|
4888
|
+
this.syncEventer && this.syncEventer.emitEvent(event, capture);
|
|
4889
|
+
}
|
|
4890
|
+
emitEvent(event, capture) {
|
|
4891
|
+
event.current = this;
|
|
4892
|
+
this.emit(event.type, event, capture);
|
|
4893
|
+
}
|
|
4894
|
+
hasEvent(type, capture) {
|
|
4895
|
+
if (this.syncEventer && this.syncEventer.hasEvent(type, capture))
|
|
4896
|
+
return true;
|
|
4897
|
+
const { __bubbleMap: b, __captureMap: c } = this;
|
|
4898
|
+
const hasB = b && b[type], hasC = c && c[type];
|
|
4899
|
+
return !!(capture === undefined ? (hasB || hasC) : (capture ? hasC : hasB));
|
|
4900
|
+
}
|
|
4901
|
+
destroy() {
|
|
4902
|
+
this.__captureMap = this.__bubbleMap = this.syncEventer = null;
|
|
4903
|
+
}
|
|
4904
|
+
}
|
|
4905
|
+
function __getListenerMap(eventer, capture, create) {
|
|
4906
|
+
if (capture) {
|
|
4907
|
+
const { __captureMap: c } = eventer;
|
|
4908
|
+
if (c) {
|
|
4909
|
+
return c;
|
|
4910
|
+
}
|
|
4911
|
+
else {
|
|
4912
|
+
return create ? eventer.__captureMap = {} : empty;
|
|
4913
|
+
}
|
|
4914
|
+
}
|
|
4915
|
+
else {
|
|
4916
|
+
const { __bubbleMap: b } = eventer;
|
|
4917
|
+
if (b) {
|
|
4918
|
+
return b;
|
|
4919
|
+
}
|
|
4920
|
+
else {
|
|
4921
|
+
return create ? eventer.__bubbleMap = {} : empty;
|
|
4922
|
+
}
|
|
4923
|
+
}
|
|
4924
|
+
}
|
|
4925
|
+
|
|
4926
|
+
const { on, on_, off, off_, once, emit: emit$2, emitEvent: emitEvent$1, hasEvent, destroy } = Eventer.prototype;
|
|
4927
|
+
const LeafEventer = { on, on_, off, off_, once, emit: emit$2, emitEvent: emitEvent$1, hasEvent, destroyEventer: destroy };
|
|
4928
|
+
|
|
4883
4929
|
const { isFinite } = Number;
|
|
4884
4930
|
const debug$7 = Debug.get('setAttr');
|
|
4885
4931
|
const LeafDataProxy = {
|
|
@@ -4891,9 +4937,7 @@ const LeafDataProxy = {
|
|
|
4891
4937
|
newValue = undefined;
|
|
4892
4938
|
}
|
|
4893
4939
|
if (typeof newValue === 'object' || oldValue !== newValue) {
|
|
4894
|
-
this.
|
|
4895
|
-
if (this.__proxyData)
|
|
4896
|
-
this.setProxyAttr(name, newValue);
|
|
4940
|
+
this.__realSetAttr(name, newValue);
|
|
4897
4941
|
const { CHANGE } = PropertyEvent;
|
|
4898
4942
|
const event = new PropertyEvent(CHANGE, this, name, oldValue, newValue);
|
|
4899
4943
|
if (this.isLeafer) {
|
|
@@ -4911,12 +4955,18 @@ const LeafDataProxy = {
|
|
|
4911
4955
|
}
|
|
4912
4956
|
}
|
|
4913
4957
|
else {
|
|
4914
|
-
this.
|
|
4915
|
-
if (this.__proxyData)
|
|
4916
|
-
this.setProxyAttr(name, newValue);
|
|
4958
|
+
this.__realSetAttr(name, newValue);
|
|
4917
4959
|
return true;
|
|
4918
4960
|
}
|
|
4919
4961
|
},
|
|
4962
|
+
__realSetAttr(name, newValue) {
|
|
4963
|
+
const data = this.__;
|
|
4964
|
+
data[name] = newValue;
|
|
4965
|
+
if (this.__proxyData)
|
|
4966
|
+
this.setProxyAttr(name, newValue);
|
|
4967
|
+
if (data.normalStyle)
|
|
4968
|
+
this.lockNormalStyle || data.normalStyle[name] === undefined || (data.normalStyle[name] = newValue);
|
|
4969
|
+
},
|
|
4920
4970
|
__getAttr(name) {
|
|
4921
4971
|
if (this.__proxyData)
|
|
4922
4972
|
return this.getProxyAttr(name);
|
|
@@ -5019,6 +5069,8 @@ const LeafBounds = {
|
|
|
5019
5069
|
layout.boundsChanged = false;
|
|
5020
5070
|
},
|
|
5021
5071
|
__updateLocalBoxBounds() {
|
|
5072
|
+
if (this.__hasMotionPath)
|
|
5073
|
+
this.__updateMotionPath();
|
|
5022
5074
|
if (this.__hasAutoLayout)
|
|
5023
5075
|
this.__updateAutoLayout();
|
|
5024
5076
|
toOuterOf$1(this.__layout.boxBounds, this.__local, this.__local);
|
|
@@ -5171,7 +5223,7 @@ const BranchRender = {
|
|
|
5171
5223
|
const { LEAF, create } = IncrementId;
|
|
5172
5224
|
const { toInnerPoint, toOuterPoint, multiplyParent } = MatrixHelper;
|
|
5173
5225
|
const { toOuterOf } = BoundsHelper;
|
|
5174
|
-
const { copy: copy$4 } = PointHelper;
|
|
5226
|
+
const { copy: copy$4, move: move$1 } = PointHelper;
|
|
5175
5227
|
const { moveLocal, zoomOfLocal, rotateOfLocal, skewOfLocal, moveWorld, zoomOfWorld, rotateOfWorld, skewOfWorld, transform, transformWorld, setTransform, getFlipTransform, getLocalOrigin, getRelativeWorld, drop } = LeafHelper;
|
|
5176
5228
|
let Leaf = class Leaf {
|
|
5177
5229
|
get tag() { return this.__tag; }
|
|
@@ -5198,13 +5250,16 @@ let Leaf = class Leaf {
|
|
|
5198
5250
|
get __ignoreHitWorld() { return (this.__hasMask || this.__hasEraser) && this.__.hitChildren; }
|
|
5199
5251
|
get __inLazyBounds() { const { leafer } = this; return leafer && leafer.created && leafer.lazyBounds.hit(this.__world); }
|
|
5200
5252
|
get pathInputed() { return this.__.__pathInputed; }
|
|
5201
|
-
set event(map) {
|
|
5202
|
-
event = map[key], event instanceof Array ? this.on(key, event[0], event[1]) : this.on(key, event); }
|
|
5253
|
+
set event(map) { this.on(map); }
|
|
5203
5254
|
constructor(data) {
|
|
5204
5255
|
this.innerId = create(LEAF);
|
|
5205
5256
|
this.reset(data);
|
|
5257
|
+
if (this.__bubbleMap)
|
|
5258
|
+
this.__emitLifeEvent(ChildEvent.CREATED);
|
|
5206
5259
|
}
|
|
5207
5260
|
reset(data) {
|
|
5261
|
+
if (this.leafer)
|
|
5262
|
+
this.leafer.forceRender(this.__world);
|
|
5208
5263
|
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 };
|
|
5209
5264
|
if (data !== null)
|
|
5210
5265
|
this.__local = { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0, x: 0, y: 0, width: 0, height: 0 };
|
|
@@ -5226,12 +5281,12 @@ let Leaf = class Leaf {
|
|
|
5226
5281
|
waitParent(item, bind) {
|
|
5227
5282
|
if (bind)
|
|
5228
5283
|
item = item.bind(bind);
|
|
5229
|
-
this.parent ? item() :
|
|
5284
|
+
this.parent ? item() : this.on(ChildEvent.ADD, item, 'once');
|
|
5230
5285
|
}
|
|
5231
5286
|
waitLeafer(item, bind) {
|
|
5232
5287
|
if (bind)
|
|
5233
5288
|
item = item.bind(bind);
|
|
5234
|
-
this.leafer ? item() :
|
|
5289
|
+
this.leafer ? item() : this.on(ChildEvent.MOUNTED, item, 'once');
|
|
5235
5290
|
}
|
|
5236
5291
|
nextRender(item, bind, off) {
|
|
5237
5292
|
this.leafer ? this.leafer.nextRender(item, bind, off) : this.waitLeafer(() => this.leafer.nextRender(item, bind, off));
|
|
@@ -5240,18 +5295,21 @@ let Leaf = class Leaf {
|
|
|
5240
5295
|
this.nextRender(item, null, 'off');
|
|
5241
5296
|
}
|
|
5242
5297
|
__bindLeafer(leafer) {
|
|
5243
|
-
if (this.isLeafer)
|
|
5244
|
-
|
|
5245
|
-
leafer = this;
|
|
5246
|
-
}
|
|
5298
|
+
if (this.isLeafer && leafer !== null)
|
|
5299
|
+
leafer = this;
|
|
5247
5300
|
if (this.leafer && !leafer)
|
|
5248
5301
|
this.leafer.leafs--;
|
|
5249
5302
|
this.leafer = leafer;
|
|
5250
5303
|
if (leafer) {
|
|
5251
5304
|
leafer.leafs++;
|
|
5252
5305
|
this.__level = this.parent ? this.parent.__level + 1 : 1;
|
|
5253
|
-
if (this.
|
|
5254
|
-
|
|
5306
|
+
if (this.animation)
|
|
5307
|
+
this.__runAnimation('in');
|
|
5308
|
+
if (this.__bubbleMap)
|
|
5309
|
+
this.__emitLifeEvent(ChildEvent.MOUNTED);
|
|
5310
|
+
}
|
|
5311
|
+
else {
|
|
5312
|
+
this.__emitLifeEvent(ChildEvent.UNMOUNTED);
|
|
5255
5313
|
}
|
|
5256
5314
|
if (this.isBranch) {
|
|
5257
5315
|
const { children } = this;
|
|
@@ -5260,7 +5318,7 @@ let Leaf = class Leaf {
|
|
|
5260
5318
|
}
|
|
5261
5319
|
}
|
|
5262
5320
|
}
|
|
5263
|
-
set(_data) { }
|
|
5321
|
+
set(_data, _isTemp) { }
|
|
5264
5322
|
get(_name) { return undefined; }
|
|
5265
5323
|
setAttr(name, value) { this[name] = value; }
|
|
5266
5324
|
getAttr(name) { return this[name]; }
|
|
@@ -5285,6 +5343,7 @@ let Leaf = class Leaf {
|
|
|
5285
5343
|
findOne(_condition, _options) { return undefined; }
|
|
5286
5344
|
findId(_id) { return undefined; }
|
|
5287
5345
|
focus(_value) { }
|
|
5346
|
+
updateState() { }
|
|
5288
5347
|
updateLayout() {
|
|
5289
5348
|
this.__layout.update();
|
|
5290
5349
|
}
|
|
@@ -5392,11 +5451,24 @@ let Leaf = class Leaf {
|
|
|
5392
5451
|
if (relative)
|
|
5393
5452
|
relative.worldToInner(to ? to : inner, null, distance);
|
|
5394
5453
|
}
|
|
5454
|
+
getBoxPoint(world, relative, distance, change) {
|
|
5455
|
+
return this.getBoxPointByInner(this.getInnerPoint(world, relative, distance, change), null, null, true);
|
|
5456
|
+
}
|
|
5457
|
+
getBoxPointByInner(inner, _relative, _distance, change) {
|
|
5458
|
+
const point = change ? inner : Object.assign({}, inner), { x, y } = this.boxBounds;
|
|
5459
|
+
move$1(point, -x, -y);
|
|
5460
|
+
return point;
|
|
5461
|
+
}
|
|
5395
5462
|
getInnerPoint(world, relative, distance, change) {
|
|
5396
5463
|
const point = change ? world : {};
|
|
5397
5464
|
this.worldToInner(world, point, distance, relative);
|
|
5398
5465
|
return point;
|
|
5399
5466
|
}
|
|
5467
|
+
getInnerPointByBox(box, _relative, _distance, change) {
|
|
5468
|
+
const point = change ? box : Object.assign({}, box), { x, y } = this.boxBounds;
|
|
5469
|
+
move$1(point, x, y);
|
|
5470
|
+
return point;
|
|
5471
|
+
}
|
|
5400
5472
|
getInnerPointByLocal(local, _relative, distance, change) {
|
|
5401
5473
|
return this.getInnerPoint(local, this.parent, distance, change);
|
|
5402
5474
|
}
|
|
@@ -5408,20 +5480,23 @@ let Leaf = class Leaf {
|
|
|
5408
5480
|
getLocalPointByInner(inner, _relative, distance, change) {
|
|
5409
5481
|
return this.getWorldPoint(inner, this.parent, distance, change);
|
|
5410
5482
|
}
|
|
5483
|
+
getPagePoint(world, relative, distance, change) {
|
|
5484
|
+
const layer = this.leafer ? this.leafer.zoomLayer : this;
|
|
5485
|
+
return layer.getInnerPoint(world, relative, distance, change);
|
|
5486
|
+
}
|
|
5411
5487
|
getWorldPoint(inner, relative, distance, change) {
|
|
5412
5488
|
const point = change ? inner : {};
|
|
5413
5489
|
this.innerToWorld(inner, point, distance, relative);
|
|
5414
5490
|
return point;
|
|
5415
5491
|
}
|
|
5492
|
+
getWorldPointByBox(box, relative, distance, change) {
|
|
5493
|
+
return this.getWorldPoint(this.getInnerPointByBox(box, null, null, change), relative, distance, true);
|
|
5494
|
+
}
|
|
5416
5495
|
getWorldPointByLocal(local, relative, distance, change) {
|
|
5417
5496
|
const point = change ? local : {};
|
|
5418
5497
|
this.localToWorld(local, point, distance, relative);
|
|
5419
5498
|
return point;
|
|
5420
5499
|
}
|
|
5421
|
-
getPagePoint(world, relative, distance, change) {
|
|
5422
|
-
const layer = this.leafer ? this.leafer.zoomLayer : this;
|
|
5423
|
-
return layer.getInnerPoint(world, relative, distance, change);
|
|
5424
|
-
}
|
|
5425
5500
|
getWorldPointByPage(page, relative, distance, change) {
|
|
5426
5501
|
const layer = this.leafer ? this.leafer.zoomLayer : this;
|
|
5427
5502
|
return layer.getWorldPoint(page, relative, distance, change);
|
|
@@ -5490,6 +5565,17 @@ let Leaf = class Leaf {
|
|
|
5490
5565
|
__drawRenderPath(_canvas) { }
|
|
5491
5566
|
__updatePath() { }
|
|
5492
5567
|
__updateRenderPath() { }
|
|
5568
|
+
getMotionPathData() {
|
|
5569
|
+
return needPlugin('path');
|
|
5570
|
+
}
|
|
5571
|
+
getMotionPoint(_motionDistance) {
|
|
5572
|
+
return needPlugin('path');
|
|
5573
|
+
}
|
|
5574
|
+
getMotionTotal() {
|
|
5575
|
+
return 0;
|
|
5576
|
+
}
|
|
5577
|
+
__updateMotionPath() { }
|
|
5578
|
+
__runAnimation(_type, _complete) { }
|
|
5493
5579
|
__updateSortChildren() { }
|
|
5494
5580
|
add(_child, _index) { }
|
|
5495
5581
|
remove(_child, destroy) {
|
|
@@ -5515,6 +5601,10 @@ let Leaf = class Leaf {
|
|
|
5515
5601
|
fn = boundsType;
|
|
5516
5602
|
fn(defaultValue)(this.prototype, attrName);
|
|
5517
5603
|
}
|
|
5604
|
+
__emitLifeEvent(type) {
|
|
5605
|
+
if (this.hasEvent(type))
|
|
5606
|
+
this.emitEvent(new ChildEvent(type, this, this.parent));
|
|
5607
|
+
}
|
|
5518
5608
|
destroy() {
|
|
5519
5609
|
if (!this.destroyed) {
|
|
5520
5610
|
const { parent } = this;
|
|
@@ -5522,11 +5612,10 @@ let Leaf = class Leaf {
|
|
|
5522
5612
|
this.remove();
|
|
5523
5613
|
if (this.children)
|
|
5524
5614
|
this.removeAll(true);
|
|
5525
|
-
|
|
5526
|
-
this.emitEvent(new ChildEvent(ChildEvent.DESTROY, this, parent));
|
|
5615
|
+
this.__emitLifeEvent(ChildEvent.DESTROY);
|
|
5527
5616
|
this.__.destroy();
|
|
5528
5617
|
this.__layout.destroy();
|
|
5529
|
-
this.
|
|
5618
|
+
this.destroyEventer();
|
|
5530
5619
|
this.destroyed = true;
|
|
5531
5620
|
}
|
|
5532
5621
|
}
|
|
@@ -5592,8 +5681,8 @@ let Branch = class Branch extends Leaf {
|
|
|
5592
5681
|
this.__.__childBranchNumber = (this.__.__childBranchNumber || 0) + 1;
|
|
5593
5682
|
child.__layout.boxChanged || child.__layout.boxChange();
|
|
5594
5683
|
child.__layout.matrixChanged || child.__layout.matrixChange();
|
|
5595
|
-
if (child.
|
|
5596
|
-
|
|
5684
|
+
if (child.__bubbleMap)
|
|
5685
|
+
child.__emitLifeEvent(ChildEvent.ADD);
|
|
5597
5686
|
if (this.leafer) {
|
|
5598
5687
|
child.__bindLeafer(this.leafer);
|
|
5599
5688
|
if (this.leafer.created)
|
|
@@ -5606,16 +5695,10 @@ let Branch = class Branch extends Leaf {
|
|
|
5606
5695
|
}
|
|
5607
5696
|
remove(child, destroy) {
|
|
5608
5697
|
if (child) {
|
|
5609
|
-
|
|
5610
|
-
|
|
5611
|
-
|
|
5612
|
-
|
|
5613
|
-
this.__.__childBranchNumber = (this.__.__childBranchNumber || 1) - 1;
|
|
5614
|
-
this.__preRemove();
|
|
5615
|
-
this.__realRemoveChild(child);
|
|
5616
|
-
if (destroy)
|
|
5617
|
-
child.destroy();
|
|
5618
|
-
}
|
|
5698
|
+
if (child.animationOut)
|
|
5699
|
+
child.__runAnimation('out', () => this.__remove(child, destroy));
|
|
5700
|
+
else
|
|
5701
|
+
this.__remove(child, destroy);
|
|
5619
5702
|
}
|
|
5620
5703
|
else if (child === undefined) {
|
|
5621
5704
|
super.remove(null, destroy);
|
|
@@ -5637,6 +5720,18 @@ let Branch = class Branch extends Leaf {
|
|
|
5637
5720
|
clear() {
|
|
5638
5721
|
this.removeAll(true);
|
|
5639
5722
|
}
|
|
5723
|
+
__remove(child, destroy) {
|
|
5724
|
+
const index = this.children.indexOf(child);
|
|
5725
|
+
if (index > -1) {
|
|
5726
|
+
this.children.splice(index, 1);
|
|
5727
|
+
if (child.isBranch)
|
|
5728
|
+
this.__.__childBranchNumber = (this.__.__childBranchNumber || 1) - 1;
|
|
5729
|
+
this.__preRemove();
|
|
5730
|
+
this.__realRemoveChild(child);
|
|
5731
|
+
if (destroy)
|
|
5732
|
+
child.destroy();
|
|
5733
|
+
}
|
|
5734
|
+
}
|
|
5640
5735
|
__preRemove() {
|
|
5641
5736
|
if (this.__hasMask)
|
|
5642
5737
|
this.__updateMask();
|
|
@@ -5646,6 +5741,7 @@ let Branch = class Branch extends Leaf {
|
|
|
5646
5741
|
this.__layout.affectChildrenSort && this.__layout.childrenSortChange();
|
|
5647
5742
|
}
|
|
5648
5743
|
__realRemoveChild(child) {
|
|
5744
|
+
child.__emitLifeEvent(ChildEvent.REMOVE);
|
|
5649
5745
|
child.parent = null;
|
|
5650
5746
|
if (this.leafer) {
|
|
5651
5747
|
child.__bindLeafer(null);
|
|
@@ -5658,8 +5754,6 @@ let Branch = class Branch extends Leaf {
|
|
|
5658
5754
|
}
|
|
5659
5755
|
__emitChildEvent(type, child) {
|
|
5660
5756
|
const event = new ChildEvent(type, child, this);
|
|
5661
|
-
if (child.hasEvent(type))
|
|
5662
|
-
child.emitEvent(event);
|
|
5663
5757
|
if (this.hasEvent(type) && !this.isLeafer)
|
|
5664
5758
|
this.emitEvent(event);
|
|
5665
5759
|
this.leafer.emitEvent(event);
|
|
@@ -5822,8 +5916,7 @@ class LeafLevelList {
|
|
|
5822
5916
|
}
|
|
5823
5917
|
}
|
|
5824
5918
|
|
|
5825
|
-
const version = "1.0.
|
|
5826
|
-
const inviteCode = {};
|
|
5919
|
+
const version = "1.0.4";
|
|
5827
5920
|
|
|
5828
5921
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
5829
5922
|
get allowBackgroundColor() { return true; }
|
|
@@ -6050,9 +6143,13 @@ function updateBounds(boundsList) {
|
|
|
6050
6143
|
});
|
|
6051
6144
|
}
|
|
6052
6145
|
function updateChange(updateList) {
|
|
6146
|
+
let layout;
|
|
6053
6147
|
updateList.list.forEach(leaf => {
|
|
6054
|
-
|
|
6148
|
+
layout = leaf.__layout;
|
|
6149
|
+
if (layout.opacityChanged)
|
|
6055
6150
|
updateAllWorldOpacity(leaf);
|
|
6151
|
+
if (layout.stateStyleChanged)
|
|
6152
|
+
setTimeout(() => layout.stateStyleChanged && leaf.updateState());
|
|
6056
6153
|
leaf.__updateChange();
|
|
6057
6154
|
});
|
|
6058
6155
|
}
|
|
@@ -6418,7 +6515,6 @@ class Renderer {
|
|
|
6418
6515
|
Platform.requestRender(() => {
|
|
6419
6516
|
this.FPS = Math.min(60, Math.ceil(1000 / (Date.now() - startTime)));
|
|
6420
6517
|
if (this.running) {
|
|
6421
|
-
this.target.emit(AnimateEvent.FRAME);
|
|
6422
6518
|
if (this.changed && this.canvas.view)
|
|
6423
6519
|
this.render();
|
|
6424
6520
|
this.target.emit(RenderEvent.NEXT);
|
|
@@ -6763,36 +6859,6 @@ Object.assign(Creator, {
|
|
|
6763
6859
|
});
|
|
6764
6860
|
Platform.layout = Layouter.fullLayout;
|
|
6765
6861
|
|
|
6766
|
-
const TextConvert = {};
|
|
6767
|
-
const ColorConvert = {};
|
|
6768
|
-
const PathArrow = {};
|
|
6769
|
-
const Paint = {};
|
|
6770
|
-
const PaintImage = {};
|
|
6771
|
-
const PaintGradient = {};
|
|
6772
|
-
const Effect = {};
|
|
6773
|
-
const Export = {};
|
|
6774
|
-
const State = {};
|
|
6775
|
-
|
|
6776
|
-
function stateType(defaultValue) {
|
|
6777
|
-
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
6778
|
-
set(value) {
|
|
6779
|
-
this.__setAttr(key, value);
|
|
6780
|
-
this.waitLeafer(() => { if (State.setStyle)
|
|
6781
|
-
State.setStyle(this, key + 'Style', value); });
|
|
6782
|
-
}
|
|
6783
|
-
}));
|
|
6784
|
-
}
|
|
6785
|
-
function arrowType(defaultValue) {
|
|
6786
|
-
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
6787
|
-
set(value) {
|
|
6788
|
-
if (this.__setAttr(key, value)) {
|
|
6789
|
-
const data = this.__;
|
|
6790
|
-
data.__useArrow = data.startArrow !== 'none' || data.endArrow !== 'none';
|
|
6791
|
-
doStrokeType(this);
|
|
6792
|
-
}
|
|
6793
|
-
}
|
|
6794
|
-
}));
|
|
6795
|
-
}
|
|
6796
6862
|
function effectType(defaultValue) {
|
|
6797
6863
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
6798
6864
|
set(value) {
|
|
@@ -6827,10 +6893,33 @@ function zoomLayerType() {
|
|
|
6827
6893
|
};
|
|
6828
6894
|
}
|
|
6829
6895
|
|
|
6896
|
+
const TextConvert = {};
|
|
6897
|
+
const ColorConvert = {};
|
|
6898
|
+
const PathArrow = {};
|
|
6899
|
+
const Paint = {};
|
|
6900
|
+
const PaintImage = {};
|
|
6901
|
+
const PaintGradient = {};
|
|
6902
|
+
const Effect = {};
|
|
6903
|
+
const Export = {};
|
|
6904
|
+
const State = {
|
|
6905
|
+
setStyleName(_leaf, _styleName, _value) { return needPlugin('state'); },
|
|
6906
|
+
set(_leaf, _stateName) { return needPlugin('state'); }
|
|
6907
|
+
};
|
|
6908
|
+
const Transition = {
|
|
6909
|
+
list: {},
|
|
6910
|
+
register(attrName, fn) {
|
|
6911
|
+
Transition.list[attrName] = fn;
|
|
6912
|
+
},
|
|
6913
|
+
get(attrName) {
|
|
6914
|
+
return Transition.list[attrName];
|
|
6915
|
+
}
|
|
6916
|
+
};
|
|
6917
|
+
|
|
6830
6918
|
const { parse } = PathConvert;
|
|
6831
6919
|
const emptyPaint = {};
|
|
6832
6920
|
const debug$4 = Debug.get('UIData');
|
|
6833
6921
|
class UIData extends LeafData {
|
|
6922
|
+
get scale() { const { scaleX, scaleY } = this; return scaleX !== scaleY ? { x: scaleX, y: scaleY } : scaleX; }
|
|
6834
6923
|
get __strokeWidth() {
|
|
6835
6924
|
const { strokeWidth, strokeWidthFixed } = this;
|
|
6836
6925
|
if (strokeWidthFixed) {
|
|
@@ -6849,9 +6938,10 @@ class UIData extends LeafData {
|
|
|
6849
6938
|
get __autoSide() { return !this._width || !this._height; }
|
|
6850
6939
|
get __autoSize() { return !this._width && !this._height; }
|
|
6851
6940
|
setVisible(value) {
|
|
6852
|
-
if (this.__leaf.leafer)
|
|
6853
|
-
this.__leaf.leafer.watcher.hasVisible = true;
|
|
6854
6941
|
this._visible = value;
|
|
6942
|
+
const { leafer } = this.__leaf;
|
|
6943
|
+
if (leafer)
|
|
6944
|
+
leafer.watcher.hasVisible = true;
|
|
6855
6945
|
}
|
|
6856
6946
|
setWidth(value) {
|
|
6857
6947
|
if (value < 0) {
|
|
@@ -7042,7 +7132,7 @@ class ImageData extends RectData {
|
|
|
7042
7132
|
__setImageFill(value) {
|
|
7043
7133
|
if (this.__leaf.image)
|
|
7044
7134
|
this.__leaf.image = null;
|
|
7045
|
-
this.fill = value ? { type: 'image', mode: '
|
|
7135
|
+
this.fill = value ? { type: 'image', mode: 'stretch', url: value } : undefined;
|
|
7046
7136
|
}
|
|
7047
7137
|
__getData() {
|
|
7048
7138
|
const data = super.__getData();
|
|
@@ -7232,19 +7322,8 @@ var UI_1;
|
|
|
7232
7322
|
let UI = UI_1 = class UI extends Leaf {
|
|
7233
7323
|
get app() { return this.leafer && this.leafer.app; }
|
|
7234
7324
|
get isFrame() { return false; }
|
|
7235
|
-
set scale(value) {
|
|
7236
|
-
|
|
7237
|
-
this.scaleX = this.scaleY = value;
|
|
7238
|
-
}
|
|
7239
|
-
else {
|
|
7240
|
-
this.scaleX = value.x;
|
|
7241
|
-
this.scaleY = value.y;
|
|
7242
|
-
}
|
|
7243
|
-
}
|
|
7244
|
-
get scale() {
|
|
7245
|
-
const { scaleX, scaleY } = this;
|
|
7246
|
-
return scaleX !== scaleY ? { x: scaleX, y: scaleY } : scaleX;
|
|
7247
|
-
}
|
|
7325
|
+
set scale(value) { MathHelper.assignScale(this, value); }
|
|
7326
|
+
get scale() { return this.__.scale; }
|
|
7248
7327
|
get pen() {
|
|
7249
7328
|
const { path } = this.__;
|
|
7250
7329
|
pen.set(this.path = path || []);
|
|
@@ -7259,8 +7338,15 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
7259
7338
|
super(data);
|
|
7260
7339
|
}
|
|
7261
7340
|
reset(_data) { }
|
|
7262
|
-
set(data) {
|
|
7263
|
-
|
|
7341
|
+
set(data, isTemp) {
|
|
7342
|
+
if (isTemp) {
|
|
7343
|
+
this.lockNormalStyle = true;
|
|
7344
|
+
Object.assign(this, data);
|
|
7345
|
+
this.lockNormalStyle = false;
|
|
7346
|
+
}
|
|
7347
|
+
else {
|
|
7348
|
+
Object.assign(this, data);
|
|
7349
|
+
}
|
|
7264
7350
|
}
|
|
7265
7351
|
get(name) {
|
|
7266
7352
|
return typeof name === 'string' ? this.__.__getInput(name) : this.__.__getInputData(name);
|
|
@@ -7323,11 +7409,18 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
7323
7409
|
drawer.rect(x, y, width, height);
|
|
7324
7410
|
}
|
|
7325
7411
|
}
|
|
7412
|
+
animate(_keyframe, _options, _type, _isTemp) {
|
|
7413
|
+
return needPlugin('animate');
|
|
7414
|
+
}
|
|
7415
|
+
killAnimate(_type) { }
|
|
7326
7416
|
export(filename, options) {
|
|
7327
7417
|
return Export.export(this, filename, options);
|
|
7328
7418
|
}
|
|
7329
|
-
clone() {
|
|
7330
|
-
|
|
7419
|
+
clone(data) {
|
|
7420
|
+
const json = this.toJSON();
|
|
7421
|
+
if (data)
|
|
7422
|
+
Object.assign(json, data);
|
|
7423
|
+
return UI_1.one(json);
|
|
7331
7424
|
}
|
|
7332
7425
|
static one(data, x, y, width, height) {
|
|
7333
7426
|
return UICreator.get(data.tag || this.prototype.__tag, data, x, y, width, height);
|
|
@@ -7343,6 +7436,8 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
7343
7436
|
static setEditInner(_editorName) { }
|
|
7344
7437
|
destroy() {
|
|
7345
7438
|
this.fill = this.stroke = null;
|
|
7439
|
+
if (this.__animate)
|
|
7440
|
+
this.killAnimate();
|
|
7346
7441
|
super.destroy();
|
|
7347
7442
|
}
|
|
7348
7443
|
};
|
|
@@ -7370,12 +7465,6 @@ __decorate([
|
|
|
7370
7465
|
__decorate([
|
|
7371
7466
|
visibleType(true)
|
|
7372
7467
|
], UI.prototype, "visible", void 0);
|
|
7373
|
-
__decorate([
|
|
7374
|
-
stateType(false)
|
|
7375
|
-
], UI.prototype, "selected", void 0);
|
|
7376
|
-
__decorate([
|
|
7377
|
-
stateType(false)
|
|
7378
|
-
], UI.prototype, "disabled", void 0);
|
|
7379
7468
|
__decorate([
|
|
7380
7469
|
surfaceType(false)
|
|
7381
7470
|
], UI.prototype, "locked", void 0);
|
|
@@ -7448,45 +7537,9 @@ __decorate([
|
|
|
7448
7537
|
__decorate([
|
|
7449
7538
|
pathType(true)
|
|
7450
7539
|
], UI.prototype, "closed", void 0);
|
|
7451
|
-
__decorate([
|
|
7452
|
-
autoLayoutType(false)
|
|
7453
|
-
], UI.prototype, "flow", void 0);
|
|
7454
7540
|
__decorate([
|
|
7455
7541
|
boundsType(0)
|
|
7456
7542
|
], UI.prototype, "padding", void 0);
|
|
7457
|
-
__decorate([
|
|
7458
|
-
boundsType(0)
|
|
7459
|
-
], UI.prototype, "gap", void 0);
|
|
7460
|
-
__decorate([
|
|
7461
|
-
boundsType('top-left')
|
|
7462
|
-
], UI.prototype, "flowAlign", void 0);
|
|
7463
|
-
__decorate([
|
|
7464
|
-
boundsType(false)
|
|
7465
|
-
], UI.prototype, "flowWrap", void 0);
|
|
7466
|
-
__decorate([
|
|
7467
|
-
boundsType('box')
|
|
7468
|
-
], UI.prototype, "itemBox", void 0);
|
|
7469
|
-
__decorate([
|
|
7470
|
-
boundsType(true)
|
|
7471
|
-
], UI.prototype, "inFlow", void 0);
|
|
7472
|
-
__decorate([
|
|
7473
|
-
boundsType()
|
|
7474
|
-
], UI.prototype, "autoWidth", void 0);
|
|
7475
|
-
__decorate([
|
|
7476
|
-
boundsType()
|
|
7477
|
-
], UI.prototype, "autoHeight", void 0);
|
|
7478
|
-
__decorate([
|
|
7479
|
-
boundsType()
|
|
7480
|
-
], UI.prototype, "lockRatio", void 0);
|
|
7481
|
-
__decorate([
|
|
7482
|
-
boundsType()
|
|
7483
|
-
], UI.prototype, "autoBox", void 0);
|
|
7484
|
-
__decorate([
|
|
7485
|
-
boundsType()
|
|
7486
|
-
], UI.prototype, "widthRange", void 0);
|
|
7487
|
-
__decorate([
|
|
7488
|
-
boundsType()
|
|
7489
|
-
], UI.prototype, "heightRange", void 0);
|
|
7490
7543
|
__decorate([
|
|
7491
7544
|
dataType(false)
|
|
7492
7545
|
], UI.prototype, "draggable", void 0);
|
|
@@ -7550,12 +7603,6 @@ __decorate([
|
|
|
7550
7603
|
__decorate([
|
|
7551
7604
|
strokeType(10)
|
|
7552
7605
|
], UI.prototype, "miterLimit", void 0);
|
|
7553
|
-
__decorate([
|
|
7554
|
-
arrowType('none')
|
|
7555
|
-
], UI.prototype, "startArrow", void 0);
|
|
7556
|
-
__decorate([
|
|
7557
|
-
arrowType('none')
|
|
7558
|
-
], UI.prototype, "endArrow", void 0);
|
|
7559
7606
|
__decorate([
|
|
7560
7607
|
pathType(0)
|
|
7561
7608
|
], UI.prototype, "cornerRadius", void 0);
|
|
@@ -7577,24 +7624,6 @@ __decorate([
|
|
|
7577
7624
|
__decorate([
|
|
7578
7625
|
effectType()
|
|
7579
7626
|
], UI.prototype, "grayscale", void 0);
|
|
7580
|
-
__decorate([
|
|
7581
|
-
dataType()
|
|
7582
|
-
], UI.prototype, "normalStyle", void 0);
|
|
7583
|
-
__decorate([
|
|
7584
|
-
dataType()
|
|
7585
|
-
], UI.prototype, "hoverStyle", void 0);
|
|
7586
|
-
__decorate([
|
|
7587
|
-
dataType()
|
|
7588
|
-
], UI.prototype, "pressStyle", void 0);
|
|
7589
|
-
__decorate([
|
|
7590
|
-
dataType()
|
|
7591
|
-
], UI.prototype, "focusStyle", void 0);
|
|
7592
|
-
__decorate([
|
|
7593
|
-
dataType()
|
|
7594
|
-
], UI.prototype, "selectedStyle", void 0);
|
|
7595
|
-
__decorate([
|
|
7596
|
-
dataType()
|
|
7597
|
-
], UI.prototype, "disabledStyle", void 0);
|
|
7598
7627
|
__decorate([
|
|
7599
7628
|
dataType({})
|
|
7600
7629
|
], UI.prototype, "data", void 0);
|
|
@@ -7621,7 +7650,7 @@ let Group = class Group extends UI {
|
|
|
7621
7650
|
if (!this.children)
|
|
7622
7651
|
this.children = [];
|
|
7623
7652
|
}
|
|
7624
|
-
set(data) {
|
|
7653
|
+
set(data, isTemp) {
|
|
7625
7654
|
if (data.children) {
|
|
7626
7655
|
const { children } = data;
|
|
7627
7656
|
delete data.children;
|
|
@@ -7631,7 +7660,7 @@ let Group = class Group extends UI {
|
|
|
7631
7660
|
else {
|
|
7632
7661
|
this.clear();
|
|
7633
7662
|
}
|
|
7634
|
-
super.set(data);
|
|
7663
|
+
super.set(data, isTemp);
|
|
7635
7664
|
let child;
|
|
7636
7665
|
children.forEach(childData => {
|
|
7637
7666
|
child = childData.__ ? childData : UICreator.get(childData.tag, childData);
|
|
@@ -7640,7 +7669,7 @@ let Group = class Group extends UI {
|
|
|
7640
7669
|
data.children = children;
|
|
7641
7670
|
}
|
|
7642
7671
|
else {
|
|
7643
|
-
super.set(data);
|
|
7672
|
+
super.set(data, isTemp);
|
|
7644
7673
|
}
|
|
7645
7674
|
}
|
|
7646
7675
|
toJSON(options) {
|
|
@@ -7967,7 +7996,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
7967
7996
|
}
|
|
7968
7997
|
}
|
|
7969
7998
|
zoom(_zoomType, _padding, _fixedScale) {
|
|
7970
|
-
return
|
|
7999
|
+
return needPlugin('view');
|
|
7971
8000
|
}
|
|
7972
8001
|
getValidMove(moveX, moveY) { return { x: moveX, y: moveY }; }
|
|
7973
8002
|
getValidScale(changeScale) { return changeScale; }
|
|
@@ -8490,19 +8519,18 @@ let Canvas = class Canvas extends Rect {
|
|
|
8490
8519
|
this.paint();
|
|
8491
8520
|
}
|
|
8492
8521
|
paint() {
|
|
8493
|
-
this.
|
|
8522
|
+
this.forceRender();
|
|
8494
8523
|
}
|
|
8495
8524
|
__drawAfterFill(canvas, _options) {
|
|
8496
|
-
const
|
|
8497
|
-
|
|
8498
|
-
if (this.__.cornerRadius || this.pathInputed) {
|
|
8525
|
+
const { width, height, cornerRadius } = this.__, { view } = this.canvas;
|
|
8526
|
+
if (cornerRadius || this.pathInputed) {
|
|
8499
8527
|
canvas.save();
|
|
8500
8528
|
canvas.clip();
|
|
8501
|
-
canvas.drawImage(
|
|
8529
|
+
canvas.drawImage(view, 0, 0, view.width, view.height, 0, 0, width, height);
|
|
8502
8530
|
canvas.restore();
|
|
8503
8531
|
}
|
|
8504
8532
|
else {
|
|
8505
|
-
canvas.drawImage(
|
|
8533
|
+
canvas.drawImage(view, 0, 0, view.width, view.height, 0, 0, width, height);
|
|
8506
8534
|
}
|
|
8507
8535
|
}
|
|
8508
8536
|
__updateSize() {
|
|
@@ -8945,21 +8973,29 @@ class UIEvent extends Event {
|
|
|
8945
8973
|
constructor(params) {
|
|
8946
8974
|
super(params.type);
|
|
8947
8975
|
this.bubbles = true;
|
|
8976
|
+
this.getInner = this.getInnerPoint;
|
|
8977
|
+
this.getLocal = this.getLocalPoint;
|
|
8978
|
+
this.getPage = this.getPagePoint;
|
|
8948
8979
|
Object.assign(this, params);
|
|
8949
8980
|
}
|
|
8950
|
-
|
|
8951
|
-
|
|
8981
|
+
getBoxPoint(relative) {
|
|
8982
|
+
if (!relative)
|
|
8983
|
+
relative = this.current;
|
|
8984
|
+
return relative.getBoxPoint(this);
|
|
8952
8985
|
}
|
|
8953
|
-
|
|
8986
|
+
getInnerPoint(relative) {
|
|
8954
8987
|
if (!relative)
|
|
8955
8988
|
relative = this.current;
|
|
8956
8989
|
return relative.getInnerPoint(this);
|
|
8957
8990
|
}
|
|
8958
|
-
|
|
8991
|
+
getLocalPoint(relative) {
|
|
8959
8992
|
if (!relative)
|
|
8960
8993
|
relative = this.current;
|
|
8961
8994
|
return relative.getLocalPoint(this);
|
|
8962
8995
|
}
|
|
8996
|
+
getPagePoint() {
|
|
8997
|
+
return this.current.getPagePoint(this);
|
|
8998
|
+
}
|
|
8963
8999
|
static changeName(oldName, newName) {
|
|
8964
9000
|
EventCreator.changeName(oldName, newName);
|
|
8965
9001
|
}
|
|
@@ -9067,7 +9103,7 @@ let DragEvent = class DragEvent extends PointerEvent {
|
|
|
9067
9103
|
}
|
|
9068
9104
|
getPageBounds() {
|
|
9069
9105
|
const total = this.getPageTotal();
|
|
9070
|
-
const start = this.
|
|
9106
|
+
const start = this.getPagePoint();
|
|
9071
9107
|
const bounds = {};
|
|
9072
9108
|
BoundsHelper.set(bounds, start.x - total.x, start.y - total.y, total.x, total.y);
|
|
9073
9109
|
BoundsHelper.unsign(bounds);
|
|
@@ -9651,7 +9687,7 @@ function emitEvent(leaf, type, data, capture, excludePath) {
|
|
|
9651
9687
|
if (leaf.destroyed)
|
|
9652
9688
|
return false;
|
|
9653
9689
|
if (leaf.__.hitSelf && !exclude(leaf, excludePath)) {
|
|
9654
|
-
if (State.updateEventStyle)
|
|
9690
|
+
if (State.updateEventStyle && !capture)
|
|
9655
9691
|
State.updateEventStyle(leaf, type);
|
|
9656
9692
|
if (leaf.hasEvent(type, capture)) {
|
|
9657
9693
|
data.phase = capture ? 1 : ((leaf === data.target) ? 2 : 3);
|
|
@@ -9756,7 +9792,7 @@ class InteractionBase {
|
|
|
9756
9792
|
this.tapWait();
|
|
9757
9793
|
this.longPressWait(data);
|
|
9758
9794
|
}
|
|
9759
|
-
this.
|
|
9795
|
+
this.waitRightTap = PointerButton.right(data);
|
|
9760
9796
|
this.dragger.setDragData(data);
|
|
9761
9797
|
if (!this.isHoldRightKey)
|
|
9762
9798
|
this.updateCursor(data);
|
|
@@ -9784,7 +9820,7 @@ class InteractionBase {
|
|
|
9784
9820
|
if (canDrag) {
|
|
9785
9821
|
if (this.waitTap)
|
|
9786
9822
|
this.pointerWaitCancel();
|
|
9787
|
-
this.
|
|
9823
|
+
this.waitRightTap = false;
|
|
9788
9824
|
}
|
|
9789
9825
|
this.dragger.checkDrag(data, canDrag);
|
|
9790
9826
|
}
|
|
@@ -9838,10 +9874,15 @@ class InteractionBase {
|
|
|
9838
9874
|
menu(data) {
|
|
9839
9875
|
this.findPath(data);
|
|
9840
9876
|
this.emit(PointerEvent.MENU, data);
|
|
9877
|
+
this.waitMenuTap = true;
|
|
9878
|
+
if (!this.downData && this.waitRightTap)
|
|
9879
|
+
this.menuTap(data);
|
|
9841
9880
|
}
|
|
9842
9881
|
menuTap(data) {
|
|
9843
|
-
if (this.waitMenuTap)
|
|
9882
|
+
if (this.waitRightTap && this.waitMenuTap) {
|
|
9844
9883
|
this.emit(PointerEvent.MENU_TAP, data);
|
|
9884
|
+
this.waitRightTap = this.waitMenuTap = false;
|
|
9885
|
+
}
|
|
9845
9886
|
}
|
|
9846
9887
|
move(data) {
|
|
9847
9888
|
this.transformer.move(data);
|
|
@@ -10685,6 +10726,8 @@ function getPatternData(paint, box, image) {
|
|
|
10685
10726
|
let { width, height } = image;
|
|
10686
10727
|
if (paint.padding)
|
|
10687
10728
|
box = tempBox.set(box).shrink(paint.padding);
|
|
10729
|
+
if (paint.mode === 'strench')
|
|
10730
|
+
paint.mode = 'stretch';
|
|
10688
10731
|
const { opacity, mode, align, offset, scale, size, rotation, repeat } = paint;
|
|
10689
10732
|
const sameBox = box.width === width && box.height === height;
|
|
10690
10733
|
const data = { mode };
|
|
@@ -10713,7 +10756,7 @@ function getPatternData(paint, box, image) {
|
|
|
10713
10756
|
if (offset)
|
|
10714
10757
|
x += offset.x, y += offset.y;
|
|
10715
10758
|
switch (mode) {
|
|
10716
|
-
case '
|
|
10759
|
+
case 'stretch':
|
|
10717
10760
|
if (!sameBox)
|
|
10718
10761
|
width = box.width, height = box.height;
|
|
10719
10762
|
break;
|
|
@@ -10740,7 +10783,7 @@ function getPatternData(paint, box, image) {
|
|
|
10740
10783
|
translate(data.transform, box.x, box.y);
|
|
10741
10784
|
}
|
|
10742
10785
|
}
|
|
10743
|
-
if (scaleX && mode !== '
|
|
10786
|
+
if (scaleX && mode !== 'stretch') {
|
|
10744
10787
|
data.scaleX = scaleX;
|
|
10745
10788
|
data.scaleY = scaleY;
|
|
10746
10789
|
}
|
|
@@ -10844,7 +10887,7 @@ const { get: get$1, scale, copy: copy$1 } = MatrixHelper;
|
|
|
10844
10887
|
const { ceil, abs: abs$1 } = Math;
|
|
10845
10888
|
function createPattern(ui, paint, pixelRatio) {
|
|
10846
10889
|
let { scaleX, scaleY } = ImageManager.patternLocked ? ui.__world : ui.__nowWorld;
|
|
10847
|
-
const id = scaleX + '-' + scaleY;
|
|
10890
|
+
const id = scaleX + '-' + scaleY + '-' + pixelRatio;
|
|
10848
10891
|
if (paint.patternId !== id && !ui.destroyed) {
|
|
10849
10892
|
scaleX = abs$1(scaleX);
|
|
10850
10893
|
scaleY = abs$1(scaleY);
|
|
@@ -10906,7 +10949,8 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
10906
10949
|
const { abs } = Math;
|
|
10907
10950
|
function checkImage(ui, canvas, paint, allowPaint) {
|
|
10908
10951
|
const { scaleX, scaleY } = ImageManager.patternLocked ? ui.__world : ui.__nowWorld;
|
|
10909
|
-
|
|
10952
|
+
const { pixelRatio } = canvas;
|
|
10953
|
+
if (!paint.data || (paint.patternId === scaleX + '-' + scaleY + '-' + pixelRatio && !Export.running)) {
|
|
10910
10954
|
return false;
|
|
10911
10955
|
}
|
|
10912
10956
|
else {
|
|
@@ -10914,8 +10958,8 @@ function checkImage(ui, canvas, paint, allowPaint) {
|
|
|
10914
10958
|
if (allowPaint) {
|
|
10915
10959
|
if (!data.repeat) {
|
|
10916
10960
|
let { width, height } = data;
|
|
10917
|
-
width *= abs(scaleX) *
|
|
10918
|
-
height *= abs(scaleY) *
|
|
10961
|
+
width *= abs(scaleX) * pixelRatio;
|
|
10962
|
+
height *= abs(scaleY) * pixelRatio;
|
|
10919
10963
|
if (data.scaleX) {
|
|
10920
10964
|
width *= data.scaleX;
|
|
10921
10965
|
height *= data.scaleY;
|
|
@@ -10941,14 +10985,14 @@ function checkImage(ui, canvas, paint, allowPaint) {
|
|
|
10941
10985
|
}
|
|
10942
10986
|
else {
|
|
10943
10987
|
if (!paint.style || paint.sync || Export.running) {
|
|
10944
|
-
createPattern(ui, paint,
|
|
10988
|
+
createPattern(ui, paint, pixelRatio);
|
|
10945
10989
|
}
|
|
10946
10990
|
else {
|
|
10947
10991
|
if (!paint.patternTask) {
|
|
10948
10992
|
paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, void 0, void 0, function* () {
|
|
10949
10993
|
paint.patternTask = null;
|
|
10950
10994
|
if (canvas.bounds.hit(ui.__nowWorld))
|
|
10951
|
-
createPattern(ui, paint,
|
|
10995
|
+
createPattern(ui, paint, pixelRatio);
|
|
10952
10996
|
ui.forceUpdate('surface');
|
|
10953
10997
|
}), 300);
|
|
10954
10998
|
}
|
|
@@ -11012,14 +11056,16 @@ function linearGradient(paint, box) {
|
|
|
11012
11056
|
return data;
|
|
11013
11057
|
}
|
|
11014
11058
|
function applyStops(gradient, stops, opacity) {
|
|
11015
|
-
|
|
11016
|
-
|
|
11017
|
-
|
|
11018
|
-
|
|
11019
|
-
|
|
11020
|
-
|
|
11021
|
-
|
|
11022
|
-
|
|
11059
|
+
if (stops) {
|
|
11060
|
+
let stop;
|
|
11061
|
+
for (let i = 0, len = stops.length; i < len; i++) {
|
|
11062
|
+
stop = stops[i];
|
|
11063
|
+
if (typeof stop === 'string') {
|
|
11064
|
+
gradient.addColorStop(i / (len - 1), ColorConvert.string(stop, opacity));
|
|
11065
|
+
}
|
|
11066
|
+
else {
|
|
11067
|
+
gradient.addColorStop(stop.offset, ColorConvert.string(stop.color, opacity));
|
|
11068
|
+
}
|
|
11023
11069
|
}
|
|
11024
11070
|
}
|
|
11025
11071
|
}
|
|
@@ -11775,10 +11821,15 @@ const TextConvertModule = {
|
|
|
11775
11821
|
};
|
|
11776
11822
|
|
|
11777
11823
|
function string(color, opacity) {
|
|
11778
|
-
|
|
11779
|
-
|
|
11824
|
+
const doOpacity = typeof opacity === 'number' && opacity !== 1;
|
|
11825
|
+
if (typeof color === 'string') {
|
|
11826
|
+
if (doOpacity && ColorConvert.object)
|
|
11827
|
+
color = ColorConvert.object(color);
|
|
11828
|
+
else
|
|
11829
|
+
return color;
|
|
11830
|
+
}
|
|
11780
11831
|
let a = color.a === undefined ? 1 : color.a;
|
|
11781
|
-
if (
|
|
11832
|
+
if (doOpacity)
|
|
11782
11833
|
a *= opacity;
|
|
11783
11834
|
const rgb = color.r + ',' + color.g + ',' + color.b;
|
|
11784
11835
|
return a === 1 ? 'rgb(' + rgb + ')' : 'rgba(' + rgb + ',' + a + ')';
|
|
@@ -11990,4 +12041,4 @@ Object.assign(Creator, {
|
|
|
11990
12041
|
});
|
|
11991
12042
|
useCanvas();
|
|
11992
12043
|
|
|
11993
|
-
export { AlignHelper,
|
|
12044
|
+
export { AlignHelper, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragEvent, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Frame, FrameData, Group, GroupData, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, LeaferTypeCreator, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, MyDragEvent, MyImage, MyPointerEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, ZoomEvent, addInteractionWindow, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isNull, layoutProcessor, maskType, naturalBoundsType, needPlugin, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix, tempPoint$3 as tempPoint, useCanvas, useModule, version, visibleType, zoomLayerType };
|