@visactor/vchart-extension 1.13.5-alpha.0 → 1.13.5-alpha.10
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/build/index.js +158 -153
- package/build/index.min.js +2 -2
- package/cjs/charts/ranking-list/constant.js +4 -13
- package/cjs/charts/ranking-list/constant.js.map +1 -1
- package/cjs/charts/ranking-list/interface.d.ts +4 -12
- package/cjs/charts/ranking-list/interface.js.map +1 -1
- package/cjs/charts/ranking-list/ranking-list-transformer.d.ts +204 -179
- package/cjs/charts/ranking-list/ranking-list-transformer.js +99 -96
- package/cjs/charts/ranking-list/ranking-list-transformer.js.map +1 -1
- package/cjs/charts/ranking-list/ranking-list.js +1 -1
- package/cjs/charts/ranking-list/ranking-list.js.map +1 -1
- package/esm/charts/ranking-list/constant.js +4 -13
- package/esm/charts/ranking-list/constant.js.map +1 -1
- package/esm/charts/ranking-list/interface.d.ts +4 -12
- package/esm/charts/ranking-list/interface.js.map +1 -1
- package/esm/charts/ranking-list/ranking-list-transformer.d.ts +204 -179
- package/esm/charts/ranking-list/ranking-list-transformer.js +100 -97
- package/esm/charts/ranking-list/ranking-list-transformer.js.map +1 -1
- package/esm/charts/ranking-list/ranking-list.js +1 -1
- package/esm/charts/ranking-list/ranking-list.js.map +1 -1
- package/package.json +10 -10
package/build/index.js
CHANGED
|
@@ -391,20 +391,11 @@
|
|
|
391
391
|
},
|
|
392
392
|
pageSize: 5,
|
|
393
393
|
scrollSize: 1,
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
duration:
|
|
394
|
+
animation: {
|
|
395
|
+
type: 'both',
|
|
396
|
+
interval: 4000,
|
|
397
|
+
duration: 2000,
|
|
398
398
|
easing: 'linear'
|
|
399
|
-
},
|
|
400
|
-
animationUpdate: {
|
|
401
|
-
enable: true,
|
|
402
|
-
type: 'grow',
|
|
403
|
-
duration: 1000,
|
|
404
|
-
easing: 'linear'
|
|
405
|
-
},
|
|
406
|
-
animationNormal: {
|
|
407
|
-
interval: 1000
|
|
408
399
|
}
|
|
409
400
|
};
|
|
410
401
|
|
|
@@ -474,8 +465,7 @@
|
|
|
474
465
|
super(...arguments);
|
|
475
466
|
this.formatMap = {};
|
|
476
467
|
this.paginateDataArr = (spec) => {
|
|
477
|
-
const { scrollSize = 1, pageSize = 5 } = spec;
|
|
478
|
-
const arr = this.originalData;
|
|
468
|
+
const { data: arr, scrollSize = 1, pageSize = 5 } = spec;
|
|
479
469
|
const result = {};
|
|
480
470
|
let pageOrder = 0;
|
|
481
471
|
for (let i = 0; i < arr.length; i += scrollSize) {
|
|
@@ -515,8 +505,8 @@
|
|
|
515
505
|
data: [
|
|
516
506
|
{
|
|
517
507
|
id: 'datas',
|
|
518
|
-
values: pagerData[order].map(d => {
|
|
519
|
-
return Object.assign(Object.assign({}, d), { [DATA_KEY]:
|
|
508
|
+
values: pagerData[order].map((d, i) => {
|
|
509
|
+
return Object.assign(Object.assign({}, d), { [DATA_KEY]: order + '_' + i + '_' + new Date().getTime() });
|
|
520
510
|
})
|
|
521
511
|
},
|
|
522
512
|
{
|
|
@@ -530,11 +520,48 @@
|
|
|
530
520
|
]
|
|
531
521
|
});
|
|
532
522
|
});
|
|
523
|
+
if (result.length === 1) {
|
|
524
|
+
result.push({
|
|
525
|
+
data: [
|
|
526
|
+
{
|
|
527
|
+
id: 'datas',
|
|
528
|
+
values: pagerData['page1'].map((d, i) => {
|
|
529
|
+
return Object.assign(Object.assign({}, d), { [DATA_KEY]: 'page2' + '_' + i + '_' + new Date().getTime() });
|
|
530
|
+
})
|
|
531
|
+
},
|
|
532
|
+
{
|
|
533
|
+
id: 'order',
|
|
534
|
+
values: [
|
|
535
|
+
{
|
|
536
|
+
order: 'page2'
|
|
537
|
+
}
|
|
538
|
+
]
|
|
539
|
+
}
|
|
540
|
+
]
|
|
541
|
+
});
|
|
542
|
+
}
|
|
533
543
|
return result;
|
|
534
544
|
};
|
|
535
545
|
}
|
|
546
|
+
isSpecValid(spec) {
|
|
547
|
+
var _a, _b, _c, _d;
|
|
548
|
+
const { xField, yField, data } = spec;
|
|
549
|
+
if (!xField || !yField) {
|
|
550
|
+
(_b = (_a = this._option).onError) === null || _b === void 0 ? void 0 : _b.call(_a, 'Missing Required Config: `xField`, `yField` ');
|
|
551
|
+
return false;
|
|
552
|
+
}
|
|
553
|
+
if (!data || data.length === 0) {
|
|
554
|
+
(_d = (_c = this._option).onError) === null || _d === void 0 ? void 0 : _d.call(_c, 'Data is required');
|
|
555
|
+
return false;
|
|
556
|
+
}
|
|
557
|
+
return true;
|
|
558
|
+
}
|
|
536
559
|
transformSpec(spec) {
|
|
560
|
+
var _a;
|
|
537
561
|
super.transformSpec(spec);
|
|
562
|
+
if (!this.isSpecValid(spec)) {
|
|
563
|
+
return;
|
|
564
|
+
}
|
|
538
565
|
this.normalizeSpec(spec);
|
|
539
566
|
this.upgradeTextMeasure(spec);
|
|
540
567
|
this.upgradeFormatMap(spec);
|
|
@@ -551,6 +578,7 @@
|
|
|
551
578
|
this.generateValueLabel(spec)
|
|
552
579
|
];
|
|
553
580
|
this.transformPaddingSpec(spec);
|
|
581
|
+
(_a = spec.customTransformSpec) === null || _a === void 0 ? void 0 : _a.call(spec, spec);
|
|
554
582
|
super.transformSpec(spec);
|
|
555
583
|
}
|
|
556
584
|
normalizeSpec(spec) {
|
|
@@ -587,9 +615,8 @@
|
|
|
587
615
|
processData(spec) {
|
|
588
616
|
var _a;
|
|
589
617
|
if (!((_a = spec.data[0]) === null || _a === void 0 ? void 0 : _a.values)) {
|
|
590
|
-
this.originalData = spec.data;
|
|
591
|
-
this.originalSpec = vutils.cloneDeep(spec);
|
|
592
618
|
this.dataSpecs = this.processRankingData(spec);
|
|
619
|
+
this.originalData = spec.data;
|
|
593
620
|
spec.data = this.dataSpecs[0].data;
|
|
594
621
|
}
|
|
595
622
|
}
|
|
@@ -615,13 +642,12 @@
|
|
|
615
642
|
];
|
|
616
643
|
}
|
|
617
644
|
transformAnimationSpec(spec) {
|
|
618
|
-
|
|
619
|
-
if (spec.
|
|
620
|
-
spec.player = Object.assign(Object.assign({}, spec.player), { specs: this.dataSpecs, auto: true, visible: false, interval:
|
|
621
|
-
spec.animationExit = this.getAnimationExit(
|
|
622
|
-
spec.animationAppear = this.
|
|
623
|
-
spec.animationEnter = this.getAnimationEnter(
|
|
624
|
-
spec.animationUpdate = this.getAnimationUpdate(this.originalSpec);
|
|
645
|
+
const totalDuration = spec.animation.duration;
|
|
646
|
+
if (spec.animation) {
|
|
647
|
+
spec.player = Object.assign(Object.assign({}, spec.player), { specs: this.dataSpecs, auto: true, visible: false, interval: spec.animation.interval + spec.animation.duration / 2, loop: true });
|
|
648
|
+
spec.animationExit = this.getAnimationExit(spec, totalDuration);
|
|
649
|
+
spec.animationAppear = this.getAnimationEnter(spec, 'rect', totalDuration);
|
|
650
|
+
spec.animationEnter = this.getAnimationEnter(spec, 'rect', totalDuration);
|
|
625
651
|
}
|
|
626
652
|
}
|
|
627
653
|
transformAxesSpec(spec) {
|
|
@@ -631,8 +657,7 @@
|
|
|
631
657
|
orient: 'left',
|
|
632
658
|
type: 'band',
|
|
633
659
|
visible: false,
|
|
634
|
-
inverse: true
|
|
635
|
-
paddingOuter: 0.5
|
|
660
|
+
inverse: true
|
|
636
661
|
},
|
|
637
662
|
{
|
|
638
663
|
orient: 'bottom',
|
|
@@ -646,6 +671,7 @@
|
|
|
646
671
|
}
|
|
647
672
|
generateBarBackground(spec) {
|
|
648
673
|
var _a;
|
|
674
|
+
const totalDuration = spec.animation.duration;
|
|
649
675
|
return {
|
|
650
676
|
type: spec.barBackground.type,
|
|
651
677
|
dataId: 'data',
|
|
@@ -663,15 +689,15 @@
|
|
|
663
689
|
}
|
|
664
690
|
return spec.barBackground.style.visible;
|
|
665
691
|
} }),
|
|
666
|
-
animation:
|
|
667
|
-
animationEnter: this.getAnimationEnter(
|
|
668
|
-
animationExit: this.getAnimationExit(
|
|
669
|
-
animationAppear: this.
|
|
670
|
-
animationUpdate: this.getAnimationUpdate(this.originalSpec)
|
|
692
|
+
animation: Boolean(spec.animation),
|
|
693
|
+
animationEnter: this.getAnimationEnter(spec, 'barBack', totalDuration),
|
|
694
|
+
animationExit: this.getAnimationExit(spec, totalDuration),
|
|
695
|
+
animationAppear: this.getAnimationEnter(spec, 'barBack', totalDuration)
|
|
671
696
|
};
|
|
672
697
|
}
|
|
673
698
|
generateDecorateHaloIcons(spec) {
|
|
674
699
|
var _a;
|
|
700
|
+
const totalDuration = spec.animation.duration;
|
|
675
701
|
return (_a = spec.decorateHaloIcons) === null || _a === void 0 ? void 0 : _a.map((decorateHaloIcon) => {
|
|
676
702
|
return {
|
|
677
703
|
type: 'symbol',
|
|
@@ -692,15 +718,15 @@
|
|
|
692
718
|
}
|
|
693
719
|
return decorateHaloIcon.style.visible;
|
|
694
720
|
} }),
|
|
695
|
-
animation:
|
|
696
|
-
animationEnter: this.getAnimationEnter(
|
|
697
|
-
animationExit: this.getAnimationExit(
|
|
698
|
-
animationAppear: this.
|
|
699
|
-
animationUpdate: this.getAnimationUpdate(this.originalSpec)
|
|
721
|
+
animation: Boolean(spec.animation),
|
|
722
|
+
animationEnter: this.getAnimationEnter(spec, 'symbol', totalDuration),
|
|
723
|
+
animationExit: this.getAnimationExit(spec, totalDuration),
|
|
724
|
+
animationAppear: this.getAnimationEnter(spec, 'symbol', totalDuration)
|
|
700
725
|
};
|
|
701
726
|
});
|
|
702
727
|
}
|
|
703
728
|
generateRankingIcon(spec) {
|
|
729
|
+
const totalDuration = spec.animation.duration;
|
|
704
730
|
return {
|
|
705
731
|
type: 'symbol',
|
|
706
732
|
dataId: 'data',
|
|
@@ -734,15 +760,15 @@
|
|
|
734
760
|
}
|
|
735
761
|
return spec.rankingIcon.style.visible;
|
|
736
762
|
} }),
|
|
737
|
-
animation:
|
|
738
|
-
animationEnter: this.getAnimationEnter(
|
|
739
|
-
animationExit: this.getAnimationExit(
|
|
740
|
-
animationAppear: this.
|
|
741
|
-
animationUpdate: this.getAnimationUpdate(this.originalSpec)
|
|
763
|
+
animation: Boolean(spec.animation),
|
|
764
|
+
animationEnter: this.getAnimationEnter(spec, 'text', totalDuration),
|
|
765
|
+
animationExit: this.getAnimationExit(spec, totalDuration),
|
|
766
|
+
animationAppear: this.getAnimationEnter(spec, 'text', totalDuration)
|
|
742
767
|
};
|
|
743
768
|
}
|
|
744
769
|
generateNameLabel(spec) {
|
|
745
770
|
var _a;
|
|
771
|
+
const totalDuration = spec.animation.duration;
|
|
746
772
|
return {
|
|
747
773
|
type: 'text',
|
|
748
774
|
dataId: 'data',
|
|
@@ -768,15 +794,15 @@
|
|
|
768
794
|
}
|
|
769
795
|
return spec.nameLabel.style.visible;
|
|
770
796
|
} }),
|
|
771
|
-
animation:
|
|
772
|
-
animationEnter: this.getAnimationEnter(
|
|
773
|
-
animationExit: this.getAnimationExit(
|
|
774
|
-
animationAppear: this.
|
|
775
|
-
animationUpdate: this.getAnimationUpdate(this.originalSpec)
|
|
797
|
+
animation: Boolean(spec.animation),
|
|
798
|
+
animationEnter: this.getAnimationEnter(spec, 'text', totalDuration),
|
|
799
|
+
animationExit: this.getAnimationExit(spec, totalDuration),
|
|
800
|
+
animationAppear: this.getAnimationEnter(spec, 'text', totalDuration)
|
|
776
801
|
};
|
|
777
802
|
}
|
|
778
803
|
generateOrderLabel(spec) {
|
|
779
804
|
var _a;
|
|
805
|
+
const totalDuration = spec.animation.duration;
|
|
780
806
|
return {
|
|
781
807
|
type: 'text',
|
|
782
808
|
dataId: 'data',
|
|
@@ -803,21 +829,24 @@
|
|
|
803
829
|
}
|
|
804
830
|
return spec.orderLabel.style.visible;
|
|
805
831
|
} }),
|
|
806
|
-
animation:
|
|
807
|
-
animationEnter: this.getAnimationEnter(
|
|
808
|
-
animationExit: this.getAnimationExit(
|
|
809
|
-
animationAppear: this.
|
|
810
|
-
animationUpdate: this.getAnimationUpdate(this.originalSpec)
|
|
832
|
+
animation: Boolean(spec.animation),
|
|
833
|
+
animationEnter: this.getAnimationEnter(spec, 'text', totalDuration),
|
|
834
|
+
animationExit: this.getAnimationExit(spec, totalDuration),
|
|
835
|
+
animationAppear: this.getAnimationEnter(spec, 'text', totalDuration)
|
|
811
836
|
};
|
|
812
837
|
}
|
|
813
838
|
generateValueLabel(spec) {
|
|
814
|
-
|
|
839
|
+
const totalDuration = spec.animation.duration;
|
|
815
840
|
return {
|
|
816
841
|
type: 'text',
|
|
817
842
|
dataId: 'data',
|
|
818
843
|
visible: true,
|
|
819
844
|
dataKey: DATA_KEY,
|
|
820
|
-
state:
|
|
845
|
+
state: {
|
|
846
|
+
blur: {
|
|
847
|
+
opacity: 0.2
|
|
848
|
+
}
|
|
849
|
+
},
|
|
821
850
|
style: Object.assign(Object.assign({ text: (datum) => this.formatDatum(spec.xField, datum), x: (datum, ctx) => {
|
|
822
851
|
if (spec.labelLayout === 'bothEnd') {
|
|
823
852
|
return (ctx.getRegion().getLayoutRect().width +
|
|
@@ -838,11 +867,10 @@
|
|
|
838
867
|
}
|
|
839
868
|
return spec.valueLabel.style.visible;
|
|
840
869
|
} }),
|
|
841
|
-
animation:
|
|
842
|
-
animationEnter: this.getAnimationEnter(
|
|
843
|
-
animationExit: this.getAnimationExit(
|
|
844
|
-
animationAppear: this.
|
|
845
|
-
animationUpdate: this.getAnimationUpdate(this.originalSpec)
|
|
870
|
+
animation: Boolean(spec.animation),
|
|
871
|
+
animationEnter: this.getAnimationEnter(spec, 'text', totalDuration),
|
|
872
|
+
animationExit: this.getAnimationExit(spec, totalDuration),
|
|
873
|
+
animationAppear: this.getAnimationEnter(spec, 'text', totalDuration)
|
|
846
874
|
};
|
|
847
875
|
}
|
|
848
876
|
transformPaddingSpec(spec) {
|
|
@@ -880,62 +908,50 @@
|
|
|
880
908
|
getLabelWidth(padding, width) {
|
|
881
909
|
return width + padding;
|
|
882
910
|
}
|
|
883
|
-
getAnimationExit(spec) {
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
return false;
|
|
911
|
+
getAnimationExit(spec, duration) {
|
|
912
|
+
if (spec.animation.type === 'grow') {
|
|
913
|
+
return {};
|
|
887
914
|
}
|
|
888
915
|
return {
|
|
889
916
|
type: 'moveOut',
|
|
890
917
|
options: {
|
|
891
918
|
direction: 'y',
|
|
892
919
|
orient: 'negative',
|
|
893
|
-
point: (datum, element) => {
|
|
920
|
+
point: (datum, element, opt) => {
|
|
894
921
|
const channelAttr = element.getGraphicAttribute('y');
|
|
895
|
-
const barSpace = spec.height /
|
|
896
|
-
return { y: channelAttr -
|
|
922
|
+
const barSpace = (spec.height / spec.pageSize - spec.bar.height) / 2;
|
|
923
|
+
return { y: channelAttr - opt.height + barSpace };
|
|
897
924
|
}
|
|
898
925
|
},
|
|
899
|
-
duration:
|
|
900
|
-
easing:
|
|
926
|
+
duration: spec.animation.type === 'both' ? duration / 2 : duration,
|
|
927
|
+
easing: spec.animation.easing
|
|
901
928
|
};
|
|
902
929
|
}
|
|
903
|
-
getAnimationEnter(spec) {
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
if (((_a = spec.animationAppear) === null || _a === void 0 ? void 0 : _a.enable) === false) {
|
|
926
|
-
return false;
|
|
927
|
-
}
|
|
928
|
-
if (markType === 'rect') {
|
|
929
|
-
return {
|
|
930
|
-
type: 'growWidthIn',
|
|
931
|
-
oneByOne: false,
|
|
932
|
-
duration: (_c = (_b = spec.animationAppear) === null || _b === void 0 ? void 0 : _b.duration) !== null && _c !== void 0 ? _c : 1000,
|
|
933
|
-
easing: (_e = (_d = spec.animationAppear) === null || _d === void 0 ? void 0 : _d.easing) !== null && _e !== void 0 ? _e : 'linear',
|
|
934
|
-
options: {}
|
|
935
|
-
};
|
|
930
|
+
getAnimationEnter(spec, markType, totalDuration) {
|
|
931
|
+
const { animation } = spec;
|
|
932
|
+
const { type: animationType, easing } = animation;
|
|
933
|
+
const scrollDuration = animationType === 'both' ? totalDuration / 2 : totalDuration;
|
|
934
|
+
const growDuration = animationType === 'grow' ? totalDuration : totalDuration / 2;
|
|
935
|
+
const result = [];
|
|
936
|
+
if (animationType === 'scroll' || animationType === 'both') {
|
|
937
|
+
result.push({
|
|
938
|
+
type: 'moveIn',
|
|
939
|
+
options: {
|
|
940
|
+
direction: 'y',
|
|
941
|
+
orient: 'negative',
|
|
942
|
+
excludeChannels: ['y'],
|
|
943
|
+
point: (datum, element, opt) => {
|
|
944
|
+
const channelAttr = element.getGraphicAttribute('y');
|
|
945
|
+
const barSpace = (spec.height / spec.pageSize - spec.bar.height) / 2;
|
|
946
|
+
return { y: channelAttr + opt.height - barSpace };
|
|
947
|
+
}
|
|
948
|
+
},
|
|
949
|
+
duration: scrollDuration,
|
|
950
|
+
easing
|
|
951
|
+
});
|
|
936
952
|
}
|
|
937
|
-
|
|
938
|
-
|
|
953
|
+
if ((animationType === 'grow' || animationType === 'both') && markType !== 'text' && markType !== 'barBack') {
|
|
954
|
+
result.push({
|
|
939
955
|
channel: {
|
|
940
956
|
x: {
|
|
941
957
|
from: 0,
|
|
@@ -944,32 +960,12 @@
|
|
|
944
960
|
}
|
|
945
961
|
}
|
|
946
962
|
},
|
|
947
|
-
duration:
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
else {
|
|
952
|
-
return {
|
|
953
|
-
channel: {
|
|
954
|
-
opacity: {
|
|
955
|
-
from: 0,
|
|
956
|
-
to: 1
|
|
957
|
-
}
|
|
958
|
-
},
|
|
959
|
-
duration: (_l = (_k = spec.animationAppear) === null || _k === void 0 ? void 0 : _k.duration) !== null && _l !== void 0 ? _l : 1000,
|
|
960
|
-
easing: (_o = (_m = spec.animationAppear) === null || _m === void 0 ? void 0 : _m.easing) !== null && _o !== void 0 ? _o : 'linear'
|
|
961
|
-
};
|
|
962
|
-
}
|
|
963
|
-
}
|
|
964
|
-
getAnimationUpdate(spec) {
|
|
965
|
-
var _a, _b, _c, _d;
|
|
966
|
-
if (spec.animationUpdate.enable === false) {
|
|
967
|
-
return false;
|
|
963
|
+
duration: growDuration,
|
|
964
|
+
delay: animationType === 'both' ? scrollDuration : 0,
|
|
965
|
+
easing
|
|
966
|
+
});
|
|
968
967
|
}
|
|
969
|
-
return
|
|
970
|
-
duration: (_b = (_a = spec.animationUpdate) === null || _a === void 0 ? void 0 : _a.duration) !== null && _b !== void 0 ? _b : 1000,
|
|
971
|
-
easing: (_d = (_c = spec.animationUpdate) === null || _c === void 0 ? void 0 : _c.easing) !== null && _d !== void 0 ? _d : 'linear'
|
|
972
|
-
};
|
|
968
|
+
return result;
|
|
973
969
|
}
|
|
974
970
|
}
|
|
975
971
|
|
|
@@ -992,7 +988,7 @@
|
|
|
992
988
|
(_b = (_a = this._option).onError) === null || _b === void 0 ? void 0 : _b.call(_a, 'Missing Required Config: `xField`, `yField` ');
|
|
993
989
|
return false;
|
|
994
990
|
}
|
|
995
|
-
if (!data) {
|
|
991
|
+
if (!data || data.length === 0) {
|
|
996
992
|
(_d = (_c = this._option).onError) === null || _d === void 0 ? void 0 : _d.call(_c, 'Data is required');
|
|
997
993
|
return false;
|
|
998
994
|
}
|
|
@@ -2908,7 +2904,7 @@
|
|
|
2908
2904
|
default:
|
|
2909
2905
|
if (this._t <= 0) this.context.lineTo(this._x, y, !1 !== this._lastDefined && !1 !== p.defined, this.lastPoint), this.context.lineTo(x, y, !1 !== this._lastDefined && !1 !== p.defined, p);else {
|
|
2910
2906
|
const x1 = this._x * (1 - this._t) + x * this._t;
|
|
2911
|
-
|
|
2907
|
+
this.context.lineTo(x1, this._y, !1 !== this._lastDefined && !1 !== p.defined, this.lastPoint), this.context.lineTo(x1, y, !1 !== this._lastDefined && !1 !== p.defined, p);
|
|
2912
2908
|
}
|
|
2913
2909
|
}
|
|
2914
2910
|
this._lastDefined = p.defined, this._x = x, this._y = y, this.lastPoint = p;
|
|
@@ -4498,7 +4494,7 @@
|
|
|
4498
4494
|
let id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Generator.GenAutoIncrementId();
|
|
4499
4495
|
let timeline = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultTimeline;
|
|
4500
4496
|
let slience = arguments.length > 2 ? arguments[2] : undefined;
|
|
4501
|
-
this.id = id, this.timeline = timeline
|
|
4497
|
+
this.id = id, this.timeline = timeline, this.status = AnimateStatus.INITIAL, this.tailAnimate = new SubAnimate(this), this.subAnimates = [this.tailAnimate], this.timeScale = 1, this.rawPosition = -1, this._startTime = 0, this._duringTime = 0, this.timeline.addAnimate(this), this.slience = slience;
|
|
4502
4498
|
}
|
|
4503
4499
|
setTimeline(timeline) {
|
|
4504
4500
|
timeline !== this.timeline && (this.timeline.removeAnimate(this, !1), timeline.addAnimate(this));
|
|
@@ -5032,7 +5028,7 @@
|
|
|
5032
5028
|
}
|
|
5033
5029
|
static GetFile(url, type) {
|
|
5034
5030
|
let data = ResourceLoader.cache.get(url);
|
|
5035
|
-
return data ? "fail" === data.loadState ? Promise.reject() : "
|
|
5031
|
+
return data ? "init" === data.loadState || "fail" === data.loadState ? Promise.reject() : "loading" === data.loadState ? data.dataPromise.then(data => data.data) : Promise.resolve(data.data) : (data = {
|
|
5036
5032
|
type: type,
|
|
5037
5033
|
loadState: "init"
|
|
5038
5034
|
}, ResourceLoader.cache.set(url, data), "arrayBuffer" === type ? data.dataPromise = application.global.loadArrayBuffer(url) : "blob" === type ? data.dataPromise = application.global.loadBlob(url) : "json" === type && (data.dataPromise = application.global.loadJson(url)), data.dataPromise.then(data => data.data));
|
|
@@ -7124,7 +7120,7 @@
|
|
|
7124
7120
|
this._draw(line, lineAttribute, !1, drawContext, params);
|
|
7125
7121
|
}
|
|
7126
7122
|
drawSegmentItem(context, cache, fill, stroke, fillOpacity, strokeOpacity, attribute, defaultAttribute, clipRange, clipRangeByDimension, offsetX, offsetY, line, fillCb, strokeCb) {
|
|
7127
|
-
var _a;
|
|
7123
|
+
var _a, _b, _c, _d, _e;
|
|
7128
7124
|
if (!cache) return;
|
|
7129
7125
|
context.beginPath();
|
|
7130
7126
|
const z = null !== (_a = this.z) && void 0 !== _a ? _a : 0;
|
|
@@ -7137,7 +7133,27 @@
|
|
|
7137
7133
|
x: originX = 0,
|
|
7138
7134
|
x: originY = 0
|
|
7139
7135
|
} = attribute;
|
|
7140
|
-
|
|
7136
|
+
!1 !== fill && (fillCb ? fillCb(context, attribute, defaultAttribute) : fillOpacity && (context.setCommonStyle(line, attribute, originX - offsetX, originY - offsetY, defaultAttribute), context.fill())), !1 !== stroke && (strokeCb ? strokeCb(context, attribute, defaultAttribute) : strokeOpacity && (context.setStrokeStyle(line, attribute, originX - offsetX, originY - offsetY, defaultAttribute), context.stroke()));
|
|
7137
|
+
let {
|
|
7138
|
+
connectedType: connectedType,
|
|
7139
|
+
connectedX: connectedX,
|
|
7140
|
+
connectedY: connectedY,
|
|
7141
|
+
connectedStyle: connectedStyle
|
|
7142
|
+
} = attribute;
|
|
7143
|
+
if (vutils.isArray(defaultAttribute) ? (connectedType = null !== (_b = null != connectedType ? connectedType : defaultAttribute[0].connectedType) && void 0 !== _b ? _b : defaultAttribute[1].connectedType, connectedX = null !== (_c = null != connectedX ? connectedX : defaultAttribute[0].connectedX) && void 0 !== _c ? _c : defaultAttribute[1].connectedX, connectedY = null !== (_d = null != connectedY ? connectedY : defaultAttribute[0].connectedY) && void 0 !== _d ? _d : defaultAttribute[1].connectedY, connectedStyle = null !== (_e = null != connectedStyle ? connectedStyle : defaultAttribute[0].connectedStyle) && void 0 !== _e ? _e : defaultAttribute[1].connectedStyle) : (connectedType = null != connectedType ? connectedType : defaultAttribute.connectedType, connectedX = null != connectedX ? connectedX : defaultAttribute.connectedX, connectedY = null != connectedY ? connectedY : defaultAttribute.connectedY, connectedStyle = null != connectedStyle ? connectedStyle : defaultAttribute.connectedStyle), "connect" !== connectedType && "zero" !== connectedType && (connectedType = "none"), "none" !== connectedType) {
|
|
7144
|
+
context.beginPath(), drawSegments(context.camera ? context : context.nativeContext, cache, clipRange, clipRangeByDimension, {
|
|
7145
|
+
offsetX: offsetX,
|
|
7146
|
+
offsetY: offsetY,
|
|
7147
|
+
offsetZ: z,
|
|
7148
|
+
drawConnect: !0,
|
|
7149
|
+
mode: connectedType,
|
|
7150
|
+
zeroX: connectedX,
|
|
7151
|
+
zeroY: connectedY
|
|
7152
|
+
});
|
|
7153
|
+
const da = [];
|
|
7154
|
+
vutils.isArray(defaultAttribute) ? defaultAttribute.forEach(i => da.push(i)) : da.push(defaultAttribute), da.push(attribute), !1 !== fill && (fillCb ? fillCb(context, attribute, defaultAttribute) : fillOpacity && (context.setCommonStyle(line, connectedStyle, originX - offsetX, originY - offsetY, da), context.fill())), !1 !== stroke && (strokeCb ? strokeCb(context, attribute, defaultAttribute) : strokeOpacity && (context.setStrokeStyle(line, connectedStyle, originX - offsetX, originY - offsetY, da), context.stroke()));
|
|
7155
|
+
}
|
|
7156
|
+
return !1;
|
|
7141
7157
|
}
|
|
7142
7158
|
drawLinearLineHighPerformance(line, context, fill, stroke, fillOpacity, strokeOpacity, offsetX, offsetY, lineAttribute, drawContext, params, fillCb, strokeCb) {
|
|
7143
7159
|
var _a;
|
|
@@ -7169,8 +7185,7 @@
|
|
|
7169
7185
|
segments: segments,
|
|
7170
7186
|
points: points,
|
|
7171
7187
|
closePath: closePath,
|
|
7172
|
-
curveTension = lineAttribute.curveTension
|
|
7173
|
-
connectedType = lineAttribute.connectedType
|
|
7188
|
+
curveTension = lineAttribute.curveTension
|
|
7174
7189
|
} = line.attribute;
|
|
7175
7190
|
if (!this.valid(line, lineAttribute, fillCb, strokeCb)) return;
|
|
7176
7191
|
let {
|
|
@@ -7182,9 +7197,6 @@
|
|
|
7182
7197
|
clipRangeByDimension = lineAttribute.clipRangeByDimension
|
|
7183
7198
|
} = line.attribute;
|
|
7184
7199
|
if (1 === clipRange && !segments && !points.some(p => !1 === p.defined) && "linear" === curveType) return this.drawLinearLineHighPerformance(line, context, !!fill, !!stroke, fillOpacity, strokeOpacity, x, y, lineAttribute, drawContext, params, fillCb, strokeCb);
|
|
7185
|
-
function parsePoint(points, connectedType) {
|
|
7186
|
-
return "none" === connectedType ? points : points.filter(p => !1 !== p.defined);
|
|
7187
|
-
}
|
|
7188
7200
|
if (line.shouldUpdateShape()) {
|
|
7189
7201
|
const {
|
|
7190
7202
|
points: points,
|
|
@@ -7206,7 +7218,7 @@
|
|
|
7206
7218
|
y: lastSeg.endY,
|
|
7207
7219
|
defined: lastSeg.curves[lastSeg.curves.length - 1].defined
|
|
7208
7220
|
} : index > 1 && (startPoint.x = lastSeg.endX, startPoint.y = lastSeg.endY, startPoint.defined = lastSeg.curves[lastSeg.curves.length - 1].defined);
|
|
7209
|
-
const data = calcLineCache(
|
|
7221
|
+
const data = calcLineCache(seg.points, curveType, {
|
|
7210
7222
|
startPoint: startPoint,
|
|
7211
7223
|
curveTension: curveTension
|
|
7212
7224
|
});
|
|
@@ -7225,7 +7237,7 @@
|
|
|
7225
7237
|
}
|
|
7226
7238
|
} else {
|
|
7227
7239
|
if (!points || !points.length) return line.cache = null, void line.clearUpdateShapeTag();
|
|
7228
|
-
line.cache = calcLineCache(
|
|
7240
|
+
line.cache = calcLineCache(_points, curveType, {
|
|
7229
7241
|
curveTension: curveTension
|
|
7230
7242
|
});
|
|
7231
7243
|
}
|
|
@@ -8645,7 +8657,7 @@
|
|
|
8645
8657
|
} = attribute,
|
|
8646
8658
|
b = aabbBounds;
|
|
8647
8659
|
return points.forEach(p => {
|
|
8648
|
-
!1 === p.defined && "connect" !== connectedType || b.add(p.x, p.y);
|
|
8660
|
+
!1 === p.defined && "zero" !== connectedType && "connect" !== connectedType || b.add(p.x, p.y);
|
|
8649
8661
|
}), b;
|
|
8650
8662
|
}
|
|
8651
8663
|
updateLineAABBBoundsBySegments(attribute, lineTheme, aabbBounds, graphic) {
|
|
@@ -8656,7 +8668,7 @@
|
|
|
8656
8668
|
b = aabbBounds;
|
|
8657
8669
|
return segments.forEach(s => {
|
|
8658
8670
|
s.points.forEach(p => {
|
|
8659
|
-
!1 === p.defined && "connect" !== connectedType || b.add(p.x, p.y);
|
|
8671
|
+
!1 === p.defined && "zero" !== connectedType && "connect" !== connectedType || b.add(p.x, p.y);
|
|
8660
8672
|
});
|
|
8661
8673
|
}), b;
|
|
8662
8674
|
}
|
|
@@ -9036,17 +9048,10 @@
|
|
|
9036
9048
|
this.render(), this.bindEvents();
|
|
9037
9049
|
});
|
|
9038
9050
|
}
|
|
9039
|
-
setAttribute(key, value, forceUpdateTag
|
|
9040
|
-
const params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate({
|
|
9041
|
-
[key]: value
|
|
9042
|
-
}, this.attribute, key, context);
|
|
9043
|
-
if (params) return this._setAttributes(params, forceUpdateTag);
|
|
9051
|
+
setAttribute(key, value, forceUpdateTag) {
|
|
9044
9052
|
vutils.isPlainObject(this.attribute[key]) && vutils.isPlainObject(value) && !vutils.isFunction(this.attribute[key]) && !vutils.isFunction(value) ? vutils.merge(this.attribute[key], value) : this.attribute[key] = value, GROUP_ATTRIBUTES.includes(key) || this.render(), this.valid = this.isValid(), this.updateShapeAndBoundsTagSetted() || !forceUpdateTag && !this.needUpdateTag(key) ? this.addUpdateBoundTag() : this.addUpdateShapeAndBoundsTag(), this.addUpdatePositionTag(), this.onAttributeUpdate();
|
|
9045
9053
|
}
|
|
9046
|
-
setAttributes(params, forceUpdateTag
|
|
9047
|
-
return params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params, this._setAttributes(params, forceUpdateTag);
|
|
9048
|
-
}
|
|
9049
|
-
_setAttributes(params, forceUpdateTag) {
|
|
9054
|
+
setAttributes(params, forceUpdateTag) {
|
|
9050
9055
|
const keys = Object.keys(params);
|
|
9051
9056
|
this._mergeAttributes(params, keys), keys.every(key => GROUP_ATTRIBUTES.includes(key)) || this.render(), this.valid = this.isValid(), this.updateShapeAndBoundsTagSetted() || !forceUpdateTag && !this.needUpdateTags(keys) ? this.addUpdateBoundTag() : this.addUpdateShapeAndBoundsTag(), this.addUpdatePositionTag(), this.onAttributeUpdate();
|
|
9052
9057
|
}
|