@visactor/vrender-core 0.16.17 → 0.16.18
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/cjs/animate/Ticker/default-ticker.js +2 -2
- package/cjs/animate/Ticker/default-ticker.js.map +1 -1
- package/cjs/animate/animate.js +1 -1
- package/cjs/animate/animate.js.map +1 -1
- package/cjs/animate/custom-animate.d.ts +12 -3
- package/cjs/animate/custom-animate.js +90 -1
- package/cjs/animate/custom-animate.js.map +1 -1
- package/cjs/core/contributions/textMeasure/AtextMeasure.d.ts +14 -2
- package/cjs/core/contributions/textMeasure/AtextMeasure.js +99 -13
- package/cjs/core/contributions/textMeasure/AtextMeasure.js.map +1 -1
- package/cjs/core/contributions/textMeasure/layout.d.ts +2 -2
- package/cjs/core/contributions/textMeasure/layout.js +4 -4
- package/cjs/core/contributions/textMeasure/layout.js.map +1 -1
- package/cjs/event/event-manager.js +14 -13
- package/cjs/event/event-manager.js.map +1 -1
- package/cjs/event/event-system.js +4 -4
- package/cjs/event/event-system.js.map +1 -1
- package/cjs/event/federated-event/base-event.d.ts +5 -6
- package/cjs/event/federated-event/base-event.js +14 -5
- package/cjs/event/federated-event/base-event.js.map +1 -1
- package/cjs/event/federated-event/mouse-event.d.ts +6 -6
- package/cjs/event/federated-event/mouse-event.js +17 -3
- package/cjs/event/federated-event/mouse-event.js.map +1 -1
- package/cjs/graphic/area.js +1 -0
- package/cjs/graphic/area.js.map +1 -1
- package/cjs/graphic/config.js +4 -3
- package/cjs/graphic/config.js.map +1 -1
- package/cjs/graphic/graphic-service/graphic-service.js +2 -2
- package/cjs/graphic/graphic-service/graphic-service.js.map +1 -1
- package/cjs/graphic/graphic.js +1 -0
- package/cjs/graphic/graphic.js.map +1 -1
- package/cjs/graphic/line.js +1 -0
- package/cjs/graphic/line.js.map +1 -1
- package/cjs/graphic/node-tree.js +1 -1
- package/cjs/graphic/node-tree.js.map +1 -1
- package/cjs/graphic/richtext.d.ts +3 -3
- package/cjs/graphic/richtext.js.map +1 -1
- package/cjs/graphic/text.js +8 -8
- package/cjs/graphic/text.js.map +1 -1
- package/cjs/graphic/theme.js +1 -1
- package/cjs/graphic/theme.js.map +1 -1
- package/cjs/interface/event.d.ts +14 -10
- package/cjs/interface/event.js.map +1 -1
- package/cjs/interface/graphic/text.d.ts +1 -0
- package/cjs/interface/graphic/text.js.map +1 -1
- package/cjs/interface/graphic.d.ts +1 -1
- package/cjs/interface/graphic.js.map +1 -1
- package/cjs/interface/text.d.ts +2 -2
- package/cjs/interface/text.js.map +1 -1
- package/cjs/render/contributions/render/contributions/base-contribution-render.d.ts +2 -0
- package/cjs/render/contributions/render/contributions/base-contribution-render.js +9 -2
- package/cjs/render/contributions/render/contributions/base-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/group-contribution-render.js +2 -2
- package/cjs/render/contributions/render/contributions/group-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/image-contribution-render.js +2 -3
- package/cjs/render/contributions/render/contributions/image-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/draw-contribution.js +6 -3
- package/cjs/render/contributions/render/draw-contribution.js.map +1 -1
- package/dist/index.js +381 -73
- package/dist/index.min.js +1 -1
- package/es/animate/Ticker/default-ticker.js +3 -1
- package/es/animate/Ticker/default-ticker.js.map +1 -1
- package/es/animate/animate.js +2 -2
- package/es/animate/animate.js.map +1 -1
- package/es/animate/custom-animate.d.ts +12 -3
- package/es/animate/custom-animate.js +94 -1
- package/es/animate/custom-animate.js.map +1 -1
- package/es/core/contributions/textMeasure/AtextMeasure.d.ts +14 -2
- package/es/core/contributions/textMeasure/AtextMeasure.js +99 -13
- package/es/core/contributions/textMeasure/AtextMeasure.js.map +1 -1
- package/es/core/contributions/textMeasure/layout.d.ts +2 -2
- package/es/core/contributions/textMeasure/layout.js +4 -4
- package/es/core/contributions/textMeasure/layout.js.map +1 -1
- package/es/event/event-manager.js +15 -14
- package/es/event/event-manager.js.map +1 -1
- package/es/event/event-system.js +4 -4
- package/es/event/event-system.js.map +1 -1
- package/es/event/federated-event/base-event.d.ts +5 -6
- package/es/event/federated-event/base-event.js +14 -5
- package/es/event/federated-event/base-event.js.map +1 -1
- package/es/event/federated-event/mouse-event.d.ts +6 -6
- package/es/event/federated-event/mouse-event.js +16 -4
- package/es/event/federated-event/mouse-event.js.map +1 -1
- package/es/graphic/area.js +1 -0
- package/es/graphic/area.js.map +1 -1
- package/es/graphic/config.js +5 -4
- package/es/graphic/config.js.map +1 -1
- package/es/graphic/graphic-service/graphic-service.js +2 -2
- package/es/graphic/graphic-service/graphic-service.js.map +1 -1
- package/es/graphic/graphic.js +1 -0
- package/es/graphic/graphic.js.map +1 -1
- package/es/graphic/line.js +1 -0
- package/es/graphic/line.js.map +1 -1
- package/es/graphic/node-tree.js +2 -2
- package/es/graphic/node-tree.js.map +1 -1
- package/es/graphic/richtext.d.ts +3 -3
- package/es/graphic/richtext.js.map +1 -1
- package/es/graphic/text.js +8 -8
- package/es/graphic/text.js.map +1 -1
- package/es/graphic/theme.js +2 -2
- package/es/graphic/theme.js.map +1 -1
- package/es/interface/event.d.ts +14 -10
- package/es/interface/event.js.map +1 -1
- package/es/interface/graphic/text.d.ts +1 -0
- package/es/interface/graphic/text.js.map +1 -1
- package/es/interface/graphic.d.ts +1 -1
- package/es/interface/graphic.js.map +1 -1
- package/es/interface/text.d.ts +2 -2
- package/es/interface/text.js.map +1 -1
- package/es/render/contributions/render/contributions/base-contribution-render.d.ts +2 -0
- package/es/render/contributions/render/contributions/base-contribution-render.js +9 -2
- package/es/render/contributions/render/contributions/base-contribution-render.js.map +1 -1
- package/es/render/contributions/render/contributions/group-contribution-render.js +2 -2
- package/es/render/contributions/render/contributions/group-contribution-render.js.map +1 -1
- package/es/render/contributions/render/contributions/image-contribution-render.js +2 -3
- package/es/render/contributions/render/contributions/image-contribution-render.js.map +1 -1
- package/es/render/contributions/render/draw-contribution.js +7 -4
- package/es/render/contributions/render/draw-contribution.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -4297,9 +4297,10 @@
|
|
|
4297
4297
|
verticalMode: 0,
|
|
4298
4298
|
whiteSpace: 'no-wrap',
|
|
4299
4299
|
heightLimit: Infinity,
|
|
4300
|
-
lineClamp: Infinity
|
|
4300
|
+
lineClamp: Infinity,
|
|
4301
|
+
suffixPosition: 'end'
|
|
4301
4302
|
};
|
|
4302
|
-
const DefaultStyle = Object.assign(Object.assign(Object.assign({ opacity: 1, background: null, texture: null, textureColor: 'black', textureSize: 10, texturePadding: 2, backgroundMode:
|
|
4303
|
+
const DefaultStyle = Object.assign(Object.assign(Object.assign({ opacity: 1, background: null, texture: null, textureColor: 'black', textureSize: 10, texturePadding: 2, backgroundMode: 'no-repeat', blur: 0, cursor: null, html: null }, DefaultFillStyle), DefaultStrokeStyle), DefaultLayout);
|
|
4303
4304
|
const DefaultConnectAttribute = {
|
|
4304
4305
|
connectedType: 'none',
|
|
4305
4306
|
connectedStyle: {},
|
|
@@ -4325,7 +4326,7 @@
|
|
|
4325
4326
|
const DefaultGlyphAttribute = Object.assign(Object.assign({}, DefaultAttribute), { path: '', width: 0, height: 0, cornerRadius: 0, clip: false });
|
|
4326
4327
|
const DefaultLineAttribute = Object.assign(Object.assign(Object.assign({}, DefaultAttribute), DefaultConnectAttribute), { points: [], segments: [], curveType: 'linear', clipRange: 1, clipRangeByDimension: 'default', closePath: false });
|
|
4327
4328
|
const DefaultPathAttribute = Object.assign(Object.assign({}, DefaultAttribute), { path: new CustomPath2D(), customPath: () => {
|
|
4328
|
-
|
|
4329
|
+
vutils.Logger.getInstance().warn('空函数');
|
|
4329
4330
|
} });
|
|
4330
4331
|
const DefaultPolygonAttribute = Object.assign(Object.assign({}, DefaultAttribute), { points: [], cornerRadius: 0, closePath: true });
|
|
4331
4332
|
const DefaultRectAttribute = Object.assign(Object.assign({}, DefaultAttribute), { width: 0, height: 0, strokeBoundsBuffer: 0, cornerRadius: 0 });
|
|
@@ -4566,7 +4567,7 @@
|
|
|
4566
4567
|
}
|
|
4567
4568
|
}
|
|
4568
4569
|
if (verticalList[i] && verticalList[i].text.length > 1) {
|
|
4569
|
-
const clipedData = this._clipText(verticalList[i].text, options, width - length, 0, verticalList[i].text.length - 1);
|
|
4570
|
+
const clipedData = this._clipText(verticalList[i].text, options, width - length, 0, verticalList[i].text.length - 1, 'end', false);
|
|
4570
4571
|
if (wordBreak && clipedData.str !== verticalList[i].text) {
|
|
4571
4572
|
let text = '';
|
|
4572
4573
|
let length = 0;
|
|
@@ -4604,7 +4605,7 @@
|
|
|
4604
4605
|
if (length > width) {
|
|
4605
4606
|
return { str: '', width: 0 };
|
|
4606
4607
|
}
|
|
4607
|
-
const data = this._clipText(text, options, width, 0, text.length - 1);
|
|
4608
|
+
const data = this._clipText(text, options, width, 0, text.length - 1, 'end', false);
|
|
4608
4609
|
if (wordBreak && data.str !== text) {
|
|
4609
4610
|
const index = testLetter(text, data.str.length);
|
|
4610
4611
|
if (index !== data.str.length) {
|
|
@@ -4614,7 +4615,23 @@
|
|
|
4614
4615
|
}
|
|
4615
4616
|
return data;
|
|
4616
4617
|
}
|
|
4617
|
-
_clipText(text, options, width, leftIdx, rightIdx) {
|
|
4618
|
+
_clipText(text, options, width, leftIdx, rightIdx, position, suffix) {
|
|
4619
|
+
let data;
|
|
4620
|
+
if (position === 'end') {
|
|
4621
|
+
data = this._clipTextEnd(text, options, width, leftIdx, rightIdx);
|
|
4622
|
+
suffix && (data.result = data.str + suffix);
|
|
4623
|
+
}
|
|
4624
|
+
else if (position === 'start') {
|
|
4625
|
+
data = this._clipTextStart(text, options, width, leftIdx, rightIdx);
|
|
4626
|
+
suffix && (data.result = suffix + data.str);
|
|
4627
|
+
}
|
|
4628
|
+
else if (position === 'middle') {
|
|
4629
|
+
const d = this._clipTextMiddle(text, options, width, '', '', 0, 0, 1);
|
|
4630
|
+
data = { str: 'none', width: d.width, result: d.left + suffix + d.right };
|
|
4631
|
+
}
|
|
4632
|
+
return data;
|
|
4633
|
+
}
|
|
4634
|
+
_clipTextEnd(text, options, width, leftIdx, rightIdx) {
|
|
4618
4635
|
const middleIdx = Math.floor((leftIdx + rightIdx) / 2);
|
|
4619
4636
|
const subText = text.substring(0, middleIdx + 1);
|
|
4620
4637
|
const strWidth = this.measureTextWidth(subText, options);
|
|
@@ -4628,7 +4645,7 @@
|
|
|
4628
4645
|
if (length <= width) {
|
|
4629
4646
|
return { str, width: length };
|
|
4630
4647
|
}
|
|
4631
|
-
return this.
|
|
4648
|
+
return this._clipTextEnd(text, options, width, leftIdx, middleIdx);
|
|
4632
4649
|
}
|
|
4633
4650
|
else if (strWidth < width) {
|
|
4634
4651
|
if (middleIdx >= text.length - 1) {
|
|
@@ -4639,11 +4656,53 @@
|
|
|
4639
4656
|
if (length >= width) {
|
|
4640
4657
|
return { str: subText, width: strWidth };
|
|
4641
4658
|
}
|
|
4642
|
-
return this.
|
|
4659
|
+
return this._clipTextEnd(text, options, width, middleIdx, rightIdx);
|
|
4660
|
+
}
|
|
4661
|
+
return { str: subText, width: strWidth };
|
|
4662
|
+
}
|
|
4663
|
+
_clipTextStart(text, options, width, leftIdx, rightIdx) {
|
|
4664
|
+
const middleIdx = Math.ceil((leftIdx + rightIdx) / 2);
|
|
4665
|
+
const subText = text.substring(middleIdx - 1, text.length - 1);
|
|
4666
|
+
const strWidth = this.measureTextWidth(subText, options);
|
|
4667
|
+
let length;
|
|
4668
|
+
if (strWidth > width) {
|
|
4669
|
+
if (subText.length <= 1) {
|
|
4670
|
+
return { str: '', width: 0 };
|
|
4671
|
+
}
|
|
4672
|
+
const str = text.substring(middleIdx, text.length - 1);
|
|
4673
|
+
length = this.measureTextWidth(str, options);
|
|
4674
|
+
if (length <= width) {
|
|
4675
|
+
return { str, width: length };
|
|
4676
|
+
}
|
|
4677
|
+
return this._clipTextStart(text, options, width, middleIdx, text.length - 1);
|
|
4678
|
+
}
|
|
4679
|
+
else if (strWidth < width) {
|
|
4680
|
+
if (middleIdx <= 0) {
|
|
4681
|
+
return { str: text, width: this.measureTextWidth(text, options) };
|
|
4682
|
+
}
|
|
4683
|
+
const str = text.substring(middleIdx - 2, text.length - 1);
|
|
4684
|
+
length = this.measureTextWidth(str, options);
|
|
4685
|
+
if (length >= width) {
|
|
4686
|
+
return { str: subText, width: strWidth };
|
|
4687
|
+
}
|
|
4688
|
+
return this._clipTextStart(text, options, width, leftIdx, middleIdx);
|
|
4643
4689
|
}
|
|
4644
4690
|
return { str: subText, width: strWidth };
|
|
4645
4691
|
}
|
|
4646
|
-
|
|
4692
|
+
_clipTextMiddle(text, options, width, left, right, leftW, rightW, buffer) {
|
|
4693
|
+
const subLeftText = text.substring(0, buffer);
|
|
4694
|
+
const strLeftWidth = this.measureTextWidth(subLeftText, options);
|
|
4695
|
+
if (strLeftWidth + rightW > width) {
|
|
4696
|
+
return { left, right, width: leftW + rightW };
|
|
4697
|
+
}
|
|
4698
|
+
const subRightText = text.substring(text.length - buffer, text.length);
|
|
4699
|
+
const strRightWidth = this.measureTextWidth(subRightText, options);
|
|
4700
|
+
if (strLeftWidth + strRightWidth > width) {
|
|
4701
|
+
return { left: subLeftText, right, width: strLeftWidth + rightW };
|
|
4702
|
+
}
|
|
4703
|
+
return this._clipTextMiddle(text, options, width, subLeftText, subRightText, strLeftWidth, strRightWidth, buffer + 1);
|
|
4704
|
+
}
|
|
4705
|
+
clipTextWithSuffixVertical(verticalList, options, width, suffix, wordBreak, suffixPosition) {
|
|
4647
4706
|
if (suffix === '') {
|
|
4648
4707
|
return this.clipTextVertical(verticalList, options, width, wordBreak);
|
|
4649
4708
|
}
|
|
@@ -4660,16 +4719,51 @@
|
|
|
4660
4719
|
return output;
|
|
4661
4720
|
}
|
|
4662
4721
|
width -= suffixWidth;
|
|
4663
|
-
|
|
4722
|
+
let out;
|
|
4723
|
+
if (suffixPosition === 'start') {
|
|
4724
|
+
const nextVerticalList = this.revertVerticalList(verticalList);
|
|
4725
|
+
out = this.clipTextVertical(nextVerticalList, options, width, wordBreak);
|
|
4726
|
+
const v = this.revertVerticalList(out.verticalList);
|
|
4727
|
+
v.unshift({
|
|
4728
|
+
text: suffix,
|
|
4729
|
+
direction: 1,
|
|
4730
|
+
width: suffixWidth
|
|
4731
|
+
});
|
|
4732
|
+
out.verticalList = v;
|
|
4733
|
+
}
|
|
4734
|
+
else if (suffixPosition === 'middle') {
|
|
4735
|
+
const leftOut = this.clipTextVertical(verticalList, options, width / 2, wordBreak);
|
|
4736
|
+
const nextVerticalList = this.revertVerticalList(verticalList);
|
|
4737
|
+
const rightOut = this.clipTextVertical(nextVerticalList, options, width / 2, wordBreak);
|
|
4738
|
+
leftOut.verticalList.push({
|
|
4739
|
+
text: suffix,
|
|
4740
|
+
direction: 1,
|
|
4741
|
+
width: suffixWidth
|
|
4742
|
+
});
|
|
4743
|
+
this.revertVerticalList(rightOut.verticalList).forEach(v => leftOut.verticalList.push(v));
|
|
4744
|
+
out = {
|
|
4745
|
+
verticalList: leftOut.verticalList,
|
|
4746
|
+
width: leftOut.width + rightOut.width
|
|
4747
|
+
};
|
|
4748
|
+
}
|
|
4749
|
+
else {
|
|
4750
|
+
out = this.clipTextVertical(verticalList, options, width, wordBreak);
|
|
4751
|
+
out.verticalList.push({
|
|
4752
|
+
text: suffix,
|
|
4753
|
+
direction: 1,
|
|
4754
|
+
width: suffixWidth
|
|
4755
|
+
});
|
|
4756
|
+
}
|
|
4664
4757
|
out.width += suffixWidth;
|
|
4665
|
-
out.verticalList.push({
|
|
4666
|
-
text: suffix,
|
|
4667
|
-
direction: 1,
|
|
4668
|
-
width: suffixWidth
|
|
4669
|
-
});
|
|
4670
4758
|
return out;
|
|
4671
4759
|
}
|
|
4672
|
-
|
|
4760
|
+
revertVerticalList(verticalList) {
|
|
4761
|
+
return verticalList.reverse().map(l => {
|
|
4762
|
+
const t = l.text.split('').reverse().join('');
|
|
4763
|
+
return Object.assign(Object.assign({}, l), { text: t });
|
|
4764
|
+
});
|
|
4765
|
+
}
|
|
4766
|
+
clipTextWithSuffix(text, options, width, suffix, wordBreak, position) {
|
|
4673
4767
|
if (suffix === '') {
|
|
4674
4768
|
return this.clipText(text, options, width, wordBreak);
|
|
4675
4769
|
}
|
|
@@ -4685,7 +4779,7 @@
|
|
|
4685
4779
|
return { str: '', width: 0 };
|
|
4686
4780
|
}
|
|
4687
4781
|
width -= suffixWidth;
|
|
4688
|
-
const data = this._clipText(text, options, width, 0, text.length - 1);
|
|
4782
|
+
const data = this._clipText(text, options, width, 0, text.length - 1, position, suffix);
|
|
4689
4783
|
if (wordBreak && data.str !== text) {
|
|
4690
4784
|
const index = testLetter(text, data.str.length);
|
|
4691
4785
|
if (index !== data.str.length) {
|
|
@@ -4693,7 +4787,7 @@
|
|
|
4693
4787
|
data.width = this.measureTextWidth(data.str, options);
|
|
4694
4788
|
}
|
|
4695
4789
|
}
|
|
4696
|
-
data.str
|
|
4790
|
+
data.str = data.result;
|
|
4697
4791
|
data.width += suffixWidth;
|
|
4698
4792
|
return data;
|
|
4699
4793
|
}
|
|
@@ -5701,7 +5795,7 @@
|
|
|
5701
5795
|
}
|
|
5702
5796
|
else {
|
|
5703
5797
|
this.combinedTheme = this._defaultTheme;
|
|
5704
|
-
|
|
5798
|
+
vutils.Logger.getInstance().warn('未知错误,走到不应该走的区域里');
|
|
5705
5799
|
}
|
|
5706
5800
|
this.dirty = false;
|
|
5707
5801
|
}
|
|
@@ -6005,7 +6099,7 @@
|
|
|
6005
6099
|
}
|
|
6006
6100
|
insertInto(newNode, idx) {
|
|
6007
6101
|
if (!this._ignoreWarn && this._nodeList) {
|
|
6008
|
-
|
|
6102
|
+
vutils.Logger.getInstance().warn('insertIntoKeepIdx和insertInto混用可能会存在错误');
|
|
6009
6103
|
}
|
|
6010
6104
|
if (idx >= this.childrenCount) {
|
|
6011
6105
|
return this.appendChild(newNode);
|
|
@@ -6412,10 +6506,22 @@
|
|
|
6412
6506
|
this.eventPhase = FederatedEvent.prototype.NONE;
|
|
6413
6507
|
this.propagationStopped = false;
|
|
6414
6508
|
this.propagationImmediatelyStopped = false;
|
|
6415
|
-
this.layer =
|
|
6416
|
-
|
|
6417
|
-
|
|
6418
|
-
|
|
6509
|
+
this.layer = {
|
|
6510
|
+
x: 0,
|
|
6511
|
+
y: 0
|
|
6512
|
+
};
|
|
6513
|
+
this.page = {
|
|
6514
|
+
x: 0,
|
|
6515
|
+
y: 0
|
|
6516
|
+
};
|
|
6517
|
+
this.canvas = {
|
|
6518
|
+
x: 0,
|
|
6519
|
+
y: 0
|
|
6520
|
+
};
|
|
6521
|
+
this.viewport = {
|
|
6522
|
+
x: 0,
|
|
6523
|
+
y: 0
|
|
6524
|
+
};
|
|
6419
6525
|
this.NONE = 0;
|
|
6420
6526
|
this.CAPTURING_PHASE = 1;
|
|
6421
6527
|
this.AT_TARGET = 2;
|
|
@@ -6457,11 +6563,26 @@
|
|
|
6457
6563
|
class FederatedMouseEvent extends FederatedEvent {
|
|
6458
6564
|
constructor() {
|
|
6459
6565
|
super(...arguments);
|
|
6460
|
-
this.client =
|
|
6461
|
-
|
|
6462
|
-
|
|
6463
|
-
|
|
6464
|
-
this.
|
|
6566
|
+
this.client = {
|
|
6567
|
+
x: 0,
|
|
6568
|
+
y: 0
|
|
6569
|
+
};
|
|
6570
|
+
this.movement = {
|
|
6571
|
+
x: 0,
|
|
6572
|
+
y: 0
|
|
6573
|
+
};
|
|
6574
|
+
this.offset = {
|
|
6575
|
+
x: 0,
|
|
6576
|
+
y: 0
|
|
6577
|
+
};
|
|
6578
|
+
this.global = {
|
|
6579
|
+
x: 0,
|
|
6580
|
+
y: 0
|
|
6581
|
+
};
|
|
6582
|
+
this.screen = {
|
|
6583
|
+
x: 0,
|
|
6584
|
+
y: 0
|
|
6585
|
+
};
|
|
6465
6586
|
}
|
|
6466
6587
|
get clientX() {
|
|
6467
6588
|
return this.client.x;
|
|
@@ -6591,7 +6712,7 @@
|
|
|
6591
6712
|
this.eventPool = new Map();
|
|
6592
6713
|
this.onPointerDown = (from, target) => {
|
|
6593
6714
|
if (!(from instanceof FederatedPointerEvent)) {
|
|
6594
|
-
|
|
6715
|
+
vutils.Logger.getInstance().warn('EventManager cannot map a non-pointer event as a pointer event');
|
|
6595
6716
|
return;
|
|
6596
6717
|
}
|
|
6597
6718
|
const e = this.createPointerEvent(from, from.type, target);
|
|
@@ -6610,7 +6731,7 @@
|
|
|
6610
6731
|
this.onPointerMove = (from, target) => {
|
|
6611
6732
|
var _a, _b;
|
|
6612
6733
|
if (!(from instanceof FederatedPointerEvent)) {
|
|
6613
|
-
|
|
6734
|
+
vutils.Logger.getInstance().warn('EventManager cannot map a non-pointer event as a pointer event');
|
|
6614
6735
|
return;
|
|
6615
6736
|
}
|
|
6616
6737
|
const e = this.createPointerEvent(from, from.type, target);
|
|
@@ -6684,7 +6805,7 @@
|
|
|
6684
6805
|
this.onPointerOver = (from, target) => {
|
|
6685
6806
|
var _a, _b;
|
|
6686
6807
|
if (!(from instanceof FederatedPointerEvent)) {
|
|
6687
|
-
|
|
6808
|
+
vutils.Logger.getInstance().warn('EventManager cannot map a non-pointer event as a pointer event');
|
|
6688
6809
|
return;
|
|
6689
6810
|
}
|
|
6690
6811
|
const trackingData = this.trackingData(from.pointerId);
|
|
@@ -6713,7 +6834,7 @@
|
|
|
6713
6834
|
};
|
|
6714
6835
|
this.onPointerOut = (from, target) => {
|
|
6715
6836
|
if (!(from instanceof FederatedPointerEvent)) {
|
|
6716
|
-
|
|
6837
|
+
vutils.Logger.getInstance().warn('EventManager cannot map a non-pointer event as a pointer event');
|
|
6717
6838
|
return;
|
|
6718
6839
|
}
|
|
6719
6840
|
const trackingData = this.trackingData(from.pointerId);
|
|
@@ -6744,7 +6865,7 @@
|
|
|
6744
6865
|
this.onPointerUp = (from, target) => {
|
|
6745
6866
|
var _a;
|
|
6746
6867
|
if (!(from instanceof FederatedPointerEvent)) {
|
|
6747
|
-
|
|
6868
|
+
vutils.Logger.getInstance().warn('EventManager cannot map a non-pointer event as a pointer event');
|
|
6748
6869
|
return;
|
|
6749
6870
|
}
|
|
6750
6871
|
const now = clock.now();
|
|
@@ -6815,7 +6936,7 @@
|
|
|
6815
6936
|
};
|
|
6816
6937
|
this.onPointerUpOutside = (from, target) => {
|
|
6817
6938
|
if (!(from instanceof FederatedPointerEvent)) {
|
|
6818
|
-
|
|
6939
|
+
vutils.Logger.getInstance().warn('EventManager cannot map a non-pointer event as a pointer event');
|
|
6819
6940
|
return;
|
|
6820
6941
|
}
|
|
6821
6942
|
const trackingData = this.trackingData(from.pointerId);
|
|
@@ -6840,7 +6961,7 @@
|
|
|
6840
6961
|
};
|
|
6841
6962
|
this.onWheel = (from, target) => {
|
|
6842
6963
|
if (!(from instanceof FederatedWheelEvent)) {
|
|
6843
|
-
|
|
6964
|
+
vutils.Logger.getInstance().warn('EventManager cannot map a non-wheel event as a wheel event');
|
|
6844
6965
|
return;
|
|
6845
6966
|
}
|
|
6846
6967
|
const wheelEvent = this.createWheelEvent(from, target);
|
|
@@ -6904,7 +7025,7 @@
|
|
|
6904
7025
|
}
|
|
6905
7026
|
}
|
|
6906
7027
|
else {
|
|
6907
|
-
|
|
7028
|
+
vutils.Logger.getInstance().warn(`[EventManager]: Event mapping not defined for ${e.type}`);
|
|
6908
7029
|
}
|
|
6909
7030
|
}
|
|
6910
7031
|
propagate(e, type) {
|
|
@@ -7038,16 +7159,13 @@
|
|
|
7038
7159
|
to.altKey = from.altKey;
|
|
7039
7160
|
to.button = from.button;
|
|
7040
7161
|
to.buttons = from.buttons;
|
|
7041
|
-
to.client.copyFrom(from.client);
|
|
7042
7162
|
to.ctrlKey = from.ctrlKey;
|
|
7043
7163
|
to.shiftKey = from.shiftKey;
|
|
7044
7164
|
to.metaKey = from.metaKey;
|
|
7045
|
-
|
|
7046
|
-
|
|
7047
|
-
|
|
7048
|
-
|
|
7049
|
-
to.offset.copyFrom(from.offset);
|
|
7050
|
-
to.viewport.copyFrom(from.viewport);
|
|
7165
|
+
['client', 'movement', 'canvas', 'screen', 'global', 'offset', 'viewport'].forEach(key => {
|
|
7166
|
+
to[key].x = from[key].x;
|
|
7167
|
+
to[key].y = from[key].y;
|
|
7168
|
+
});
|
|
7051
7169
|
}
|
|
7052
7170
|
copyData(from, to) {
|
|
7053
7171
|
to.isTrusted = from.isTrusted;
|
|
@@ -7057,8 +7175,10 @@
|
|
|
7057
7175
|
to.detail = from.detail;
|
|
7058
7176
|
to.view = from.view;
|
|
7059
7177
|
to.which = from.which;
|
|
7060
|
-
to.layer.
|
|
7061
|
-
to.
|
|
7178
|
+
to.layer.x = from.layer.x;
|
|
7179
|
+
to.layer.y = from.layer.y;
|
|
7180
|
+
to.page.x = from.page.x;
|
|
7181
|
+
to.page.y = from.page.y;
|
|
7062
7182
|
to.pickParams = from.pickParams;
|
|
7063
7183
|
}
|
|
7064
7184
|
trackingData(id) {
|
|
@@ -7499,8 +7619,10 @@
|
|
|
7499
7619
|
const { x: canvasX, y: canvasY } = this.mapToCanvasPoint(nativeEvent);
|
|
7500
7620
|
event.canvas.x = canvasX;
|
|
7501
7621
|
event.canvas.y = canvasY;
|
|
7502
|
-
event.global.
|
|
7503
|
-
event.
|
|
7622
|
+
event.global.x = canvasX;
|
|
7623
|
+
event.global.y = canvasY;
|
|
7624
|
+
event.offset.x = canvasX;
|
|
7625
|
+
event.offset.y = canvasY;
|
|
7504
7626
|
const { x: viewX, y: viewY } = this.mapToViewportPoint(event);
|
|
7505
7627
|
event.viewport.x = viewX;
|
|
7506
7628
|
event.viewport.y = viewY;
|
|
@@ -7525,8 +7647,10 @@
|
|
|
7525
7647
|
const { x: canvasX, y: canvasY } = this.mapToCanvasPoint(nativeEvent);
|
|
7526
7648
|
event.canvas.x = canvasX;
|
|
7527
7649
|
event.canvas.y = canvasY;
|
|
7528
|
-
event.global.
|
|
7529
|
-
event.
|
|
7650
|
+
event.global.x = canvasX;
|
|
7651
|
+
event.global.y = canvasY;
|
|
7652
|
+
event.offset.x = canvasX;
|
|
7653
|
+
event.offset.y = canvasY;
|
|
7530
7654
|
const { x: viewX, y: viewY } = this.mapToViewportPoint(event);
|
|
7531
7655
|
event.viewport.x = viewX;
|
|
7532
7656
|
event.viewport.y = viewY;
|
|
@@ -7742,7 +7866,7 @@
|
|
|
7742
7866
|
handler = new ManualTickHandler();
|
|
7743
7867
|
break;
|
|
7744
7868
|
default:
|
|
7745
|
-
|
|
7869
|
+
vutils.Logger.getInstance().warn('非法的计时器模式');
|
|
7746
7870
|
handler = new RAFTickHandler();
|
|
7747
7871
|
break;
|
|
7748
7872
|
}
|
|
@@ -8743,7 +8867,7 @@
|
|
|
8743
8867
|
}
|
|
8744
8868
|
lastStep = lastStep.prev;
|
|
8745
8869
|
}
|
|
8746
|
-
|
|
8870
|
+
vutils.Logger.getInstance().warn('未知错误,step中找不到属性');
|
|
8747
8871
|
return step.props[name];
|
|
8748
8872
|
}
|
|
8749
8873
|
updateTarget(step, ratio, end) {
|
|
@@ -9257,6 +9381,28 @@
|
|
|
9257
9381
|
return {};
|
|
9258
9382
|
}
|
|
9259
9383
|
onStart() {
|
|
9384
|
+
if (!this.target) {
|
|
9385
|
+
return;
|
|
9386
|
+
}
|
|
9387
|
+
if (this.target.type === 'rect') {
|
|
9388
|
+
this.onStartRect();
|
|
9389
|
+
}
|
|
9390
|
+
else if (this.target.type === 'line') {
|
|
9391
|
+
this.onStartLineOrArea('line');
|
|
9392
|
+
}
|
|
9393
|
+
else if (this.target.type === 'area') {
|
|
9394
|
+
this.onStartLineOrArea('area');
|
|
9395
|
+
}
|
|
9396
|
+
}
|
|
9397
|
+
onStartLineOrArea(type) {
|
|
9398
|
+
var _a;
|
|
9399
|
+
const root = this.target.attachShadow();
|
|
9400
|
+
const line = application.graphicService.creator[type](Object.assign({}, (_a = this.params) === null || _a === void 0 ? void 0 : _a.attribute));
|
|
9401
|
+
this[type] = line;
|
|
9402
|
+
line.pathProxy = new CustomPath2D();
|
|
9403
|
+
root.add(line);
|
|
9404
|
+
}
|
|
9405
|
+
onStartRect() {
|
|
9260
9406
|
var _a;
|
|
9261
9407
|
const root = this.target.attachShadow();
|
|
9262
9408
|
const height = this.target.AABBBounds.height();
|
|
@@ -9271,6 +9417,14 @@
|
|
|
9271
9417
|
this.target.detachShadow();
|
|
9272
9418
|
}
|
|
9273
9419
|
onUpdate(end, ratio, out) {
|
|
9420
|
+
if (this.rect) {
|
|
9421
|
+
return this.onUpdateRect(end, ratio, out);
|
|
9422
|
+
}
|
|
9423
|
+
else if (this.line || this.area) {
|
|
9424
|
+
return this.onUpdateLineOrArea(end, ratio, out);
|
|
9425
|
+
}
|
|
9426
|
+
}
|
|
9427
|
+
onUpdateRect(end, ratio, out) {
|
|
9274
9428
|
var _a, _b, _c, _d, _e, _f;
|
|
9275
9429
|
const parentWidth = (_a = this.target.attribute.width) !== null && _a !== void 0 ? _a : 250;
|
|
9276
9430
|
const streamLength = (_c = (_b = this.params) === null || _b === void 0 ? void 0 : _b.streamLength) !== null && _c !== void 0 ? _c : parentWidth;
|
|
@@ -9291,6 +9445,130 @@
|
|
|
9291
9445
|
}
|
|
9292
9446
|
});
|
|
9293
9447
|
}
|
|
9448
|
+
onUpdateLineOrArea(end, ratio, out) {
|
|
9449
|
+
const target = this.line || this.area;
|
|
9450
|
+
if (!target) {
|
|
9451
|
+
return;
|
|
9452
|
+
}
|
|
9453
|
+
const customPath = target.pathProxy;
|
|
9454
|
+
const targetLine = this.target;
|
|
9455
|
+
if (targetLine.cache || targetLine.cacheArea) {
|
|
9456
|
+
this._onUpdateLineOrAreaWithCache(customPath, targetLine, end, ratio, out);
|
|
9457
|
+
}
|
|
9458
|
+
else {
|
|
9459
|
+
this._onUpdateLineWithoutCache(customPath, targetLine, end, ratio, out);
|
|
9460
|
+
}
|
|
9461
|
+
const targetAttrs = targetLine.attribute;
|
|
9462
|
+
target.setAttributes(Object.assign({ stroke: targetAttrs.stroke }, target.attribute));
|
|
9463
|
+
target.addUpdateBoundTag();
|
|
9464
|
+
}
|
|
9465
|
+
_onUpdateLineOrAreaWithCache(customPath, g, end, ratio, out) {
|
|
9466
|
+
customPath.clear();
|
|
9467
|
+
if (g.type === 'line') {
|
|
9468
|
+
let cache = g.cache;
|
|
9469
|
+
if (!Array.isArray(cache)) {
|
|
9470
|
+
cache = [cache];
|
|
9471
|
+
}
|
|
9472
|
+
const totalLen = cache.reduce((l, c) => l + c.getLength(), 0);
|
|
9473
|
+
const curves = [];
|
|
9474
|
+
cache.forEach((c) => {
|
|
9475
|
+
c.curves.forEach((ci) => curves.push(ci));
|
|
9476
|
+
});
|
|
9477
|
+
return this._updateCurves(customPath, curves, totalLen, ratio);
|
|
9478
|
+
}
|
|
9479
|
+
else if (g.type === 'area') {
|
|
9480
|
+
const cache = g.cacheArea;
|
|
9481
|
+
const totalLen = cache.top.curves.reduce((a, b) => a + b.getLength(), 0);
|
|
9482
|
+
return this._updateCurves(customPath, cache.top.curves, totalLen, ratio);
|
|
9483
|
+
}
|
|
9484
|
+
}
|
|
9485
|
+
_updateCurves(customPath, curves, totalLen, ratio) {
|
|
9486
|
+
var _a, _b;
|
|
9487
|
+
const startLen = totalLen * ratio;
|
|
9488
|
+
const endLen = Math.min((_b = startLen + ((_a = this.params) === null || _a === void 0 ? void 0 : _a.streamLength)) !== null && _b !== void 0 ? _b : 10, totalLen);
|
|
9489
|
+
let lastLen = 0;
|
|
9490
|
+
let start = false;
|
|
9491
|
+
for (let i = 0; i < curves.length; i++) {
|
|
9492
|
+
const curveItem = curves[i];
|
|
9493
|
+
const len = curveItem.getLength();
|
|
9494
|
+
const startPercent = 1 - (lastLen + len - startLen) / len;
|
|
9495
|
+
let endPercent = 1 - (lastLen + len - endLen) / len;
|
|
9496
|
+
let curveForStart;
|
|
9497
|
+
if (lastLen < startLen && lastLen + len > startLen) {
|
|
9498
|
+
start = true;
|
|
9499
|
+
if (curveItem.p2 && curveItem.p3) {
|
|
9500
|
+
const [_, curve2] = divideCubic(curveItem, startPercent);
|
|
9501
|
+
customPath.moveTo(curve2.p0.x, curve2.p0.y);
|
|
9502
|
+
curveForStart = curve2;
|
|
9503
|
+
}
|
|
9504
|
+
else {
|
|
9505
|
+
const p = curveItem.getPointAt(startPercent);
|
|
9506
|
+
customPath.moveTo(p.x, p.y);
|
|
9507
|
+
}
|
|
9508
|
+
}
|
|
9509
|
+
if (lastLen < endLen && lastLen + len > endLen) {
|
|
9510
|
+
if (curveItem.p2 && curveItem.p3) {
|
|
9511
|
+
if (curveForStart) {
|
|
9512
|
+
endPercent = (endLen - startLen) / curveForStart.getLength();
|
|
9513
|
+
}
|
|
9514
|
+
const [curve1] = divideCubic(curveForStart || curveItem, endPercent);
|
|
9515
|
+
customPath.bezierCurveTo(curve1.p1.x, curve1.p1.y, curve1.p2.x, curve1.p2.y, curve1.p3.x, curve1.p3.y);
|
|
9516
|
+
}
|
|
9517
|
+
else {
|
|
9518
|
+
const p = curveItem.getPointAt(endPercent);
|
|
9519
|
+
customPath.lineTo(p.x, p.y);
|
|
9520
|
+
}
|
|
9521
|
+
break;
|
|
9522
|
+
}
|
|
9523
|
+
else if (start) {
|
|
9524
|
+
if (curveItem.p2 && curveItem.p3) {
|
|
9525
|
+
const curve = curveForStart || curveItem;
|
|
9526
|
+
customPath.bezierCurveTo(curve.p1.x, curve.p1.y, curve.p2.x, curve.p2.y, curve.p3.x, curve.p3.y);
|
|
9527
|
+
}
|
|
9528
|
+
else {
|
|
9529
|
+
customPath.lineTo(curveItem.p1.x, curveItem.p1.y);
|
|
9530
|
+
}
|
|
9531
|
+
}
|
|
9532
|
+
lastLen += len;
|
|
9533
|
+
}
|
|
9534
|
+
}
|
|
9535
|
+
_onUpdateLineWithoutCache(customPath, line, end, ratio, out) {
|
|
9536
|
+
var _a, _b;
|
|
9537
|
+
const { points, curveType } = line.attribute;
|
|
9538
|
+
if (!points || points.length < 2 || curveType !== 'linear') {
|
|
9539
|
+
return;
|
|
9540
|
+
}
|
|
9541
|
+
let totalLen = 0;
|
|
9542
|
+
for (let i = 1; i < points.length; i++) {
|
|
9543
|
+
totalLen += vutils.PointService.distancePP(points[i], points[i - 1]);
|
|
9544
|
+
}
|
|
9545
|
+
const startLen = totalLen * ratio;
|
|
9546
|
+
const endLen = Math.min((_b = startLen + ((_a = this.params) === null || _a === void 0 ? void 0 : _a.streamLength)) !== null && _b !== void 0 ? _b : 10, totalLen);
|
|
9547
|
+
const nextPoints = [];
|
|
9548
|
+
let lastLen = 0;
|
|
9549
|
+
for (let i = 1; i < points.length; i++) {
|
|
9550
|
+
const len = vutils.PointService.distancePP(points[i], points[i - 1]);
|
|
9551
|
+
if (lastLen < startLen && lastLen + len > startLen) {
|
|
9552
|
+
nextPoints.push(vutils.PointService.pointAtPP(points[i - 1], points[i], 1 - (lastLen + len - startLen) / len));
|
|
9553
|
+
}
|
|
9554
|
+
if (lastLen < endLen && lastLen + len > endLen) {
|
|
9555
|
+
nextPoints.push(vutils.PointService.pointAtPP(points[i - 1], points[i], 1 - (lastLen + len - endLen) / len));
|
|
9556
|
+
break;
|
|
9557
|
+
}
|
|
9558
|
+
else if (nextPoints.length) {
|
|
9559
|
+
nextPoints.push(points[i]);
|
|
9560
|
+
}
|
|
9561
|
+
lastLen += len;
|
|
9562
|
+
}
|
|
9563
|
+
if (!nextPoints.length || nextPoints.length < 2) {
|
|
9564
|
+
return;
|
|
9565
|
+
}
|
|
9566
|
+
customPath.clear();
|
|
9567
|
+
customPath.moveTo(nextPoints[0].x, nextPoints[0].y);
|
|
9568
|
+
for (let i = 1; i < nextPoints.length; i++) {
|
|
9569
|
+
customPath.lineTo(nextPoints[i].x, nextPoints[i].y);
|
|
9570
|
+
}
|
|
9571
|
+
}
|
|
9294
9572
|
}
|
|
9295
9573
|
class Meteor extends ACustomAnimate {
|
|
9296
9574
|
get lastPos() {
|
|
@@ -12202,6 +12480,10 @@
|
|
|
12202
12480
|
}
|
|
12203
12481
|
const nextStepVal = nextProps[key];
|
|
12204
12482
|
const lastStepVal = (_a = (lastProps && lastProps[key])) !== null && _a !== void 0 ? _a : subAnimate.getLastPropByName(key, step);
|
|
12483
|
+
if (nextStepVal == null || lastStepVal == null) {
|
|
12484
|
+
nextAttributes[key] = nextStepVal;
|
|
12485
|
+
return;
|
|
12486
|
+
}
|
|
12205
12487
|
let match;
|
|
12206
12488
|
match =
|
|
12207
12489
|
animate.interpolateFunc && animate.interpolateFunc(key, ratio, lastStepVal, nextStepVal, nextAttributes);
|
|
@@ -14213,12 +14495,12 @@
|
|
|
14213
14495
|
}
|
|
14214
14496
|
return bbox;
|
|
14215
14497
|
}
|
|
14216
|
-
GetLayout(str, width, height, textAlign, textBaseline, lineHeight, suffix, wordBreak,
|
|
14498
|
+
GetLayout(str, width, height, textAlign, textBaseline, lineHeight, suffix, wordBreak, suffixPosition) {
|
|
14217
14499
|
const linesLayout = [];
|
|
14218
14500
|
const bboxWH = [width, height];
|
|
14219
14501
|
const bboxOffset = [0, 0];
|
|
14220
14502
|
while (str.length > 0) {
|
|
14221
|
-
const { str: clipText } = this.textMeasure.clipTextWithSuffix(str, this.textOptions, width, suffix, wordBreak);
|
|
14503
|
+
const { str: clipText } = this.textMeasure.clipTextWithSuffix(str, this.textOptions, width, suffix, wordBreak, suffixPosition);
|
|
14222
14504
|
linesLayout.push({
|
|
14223
14505
|
str: clipText,
|
|
14224
14506
|
width: this.textMeasure.measureTextWidth(clipText, this.textOptions)
|
|
@@ -14247,7 +14529,7 @@
|
|
|
14247
14529
|
};
|
|
14248
14530
|
return this.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline, lineHeight);
|
|
14249
14531
|
}
|
|
14250
|
-
GetLayoutByLines(lines, textAlign, textBaseline, lineHeight, suffix = '', wordBreak, lineWidth) {
|
|
14532
|
+
GetLayoutByLines(lines, textAlign, textBaseline, lineHeight, suffix = '', wordBreak, lineWidth, suffixPosition = 'end') {
|
|
14251
14533
|
lines = lines.map(l => l.toString());
|
|
14252
14534
|
const linesLayout = [];
|
|
14253
14535
|
const bboxWH = [0, 0];
|
|
@@ -14256,7 +14538,7 @@
|
|
|
14256
14538
|
for (let i = 0, len = lines.length; i < len; i++) {
|
|
14257
14539
|
width = Math.min(this.textMeasure.measureTextWidth(lines[i], this.textOptions), lineWidth);
|
|
14258
14540
|
linesLayout.push({
|
|
14259
|
-
str: this.textMeasure.clipTextWithSuffix(lines[i], this.textOptions, width, suffix, wordBreak).str,
|
|
14541
|
+
str: this.textMeasure.clipTextWithSuffix(lines[i], this.textOptions, width, suffix, wordBreak, suffixPosition).str,
|
|
14260
14542
|
width
|
|
14261
14543
|
});
|
|
14262
14544
|
}
|
|
@@ -14542,7 +14824,7 @@
|
|
|
14542
14824
|
let width;
|
|
14543
14825
|
let str;
|
|
14544
14826
|
const attribute = this.attribute;
|
|
14545
|
-
const { maxLineWidth = textTheme.maxLineWidth, ellipsis = textTheme.ellipsis, textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline, fontFamily = textTheme.fontFamily, fontSize = textTheme.fontSize, fontWeight = textTheme.fontWeight, stroke = textTheme.stroke, lineWidth = textTheme.lineWidth,
|
|
14827
|
+
const { maxLineWidth = textTheme.maxLineWidth, ellipsis = textTheme.ellipsis, textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline, fontFamily = textTheme.fontFamily, fontSize = textTheme.fontSize, fontWeight = textTheme.fontWeight, stroke = textTheme.stroke, lineWidth = textTheme.lineWidth, ignoreBuf = textTheme.ignoreBuf, whiteSpace = textTheme.whiteSpace, suffixPosition = textTheme.suffixPosition } = attribute;
|
|
14546
14828
|
if (whiteSpace === 'normal') {
|
|
14547
14829
|
return this.updateWrapAABBBounds(text);
|
|
14548
14830
|
}
|
|
@@ -14562,7 +14844,7 @@
|
|
|
14562
14844
|
if (Number.isFinite(maxLineWidth)) {
|
|
14563
14845
|
if (ellipsis) {
|
|
14564
14846
|
const strEllipsis = (ellipsis === true ? textTheme.ellipsis : ellipsis);
|
|
14565
|
-
const data = textMeasure.clipTextWithSuffix(text.toString(), { fontSize, fontWeight, fontFamily }, maxLineWidth, strEllipsis, false);
|
|
14847
|
+
const data = textMeasure.clipTextWithSuffix(text.toString(), { fontSize, fontWeight, fontFamily }, maxLineWidth, strEllipsis, false, suffixPosition);
|
|
14566
14848
|
str = data.str;
|
|
14567
14849
|
width = data.width;
|
|
14568
14850
|
}
|
|
@@ -14606,7 +14888,7 @@
|
|
|
14606
14888
|
const attribute = this.attribute;
|
|
14607
14889
|
const { ignoreBuf = textTheme.ignoreBuf } = attribute;
|
|
14608
14890
|
const buf = ignoreBuf ? 0 : 2;
|
|
14609
|
-
const { maxLineWidth = textTheme.maxLineWidth, ellipsis = textTheme.ellipsis, fontSize = textTheme.fontSize, fontWeight = textTheme.fontWeight, fontFamily = textTheme.fontFamily, stroke = textTheme.stroke, lineWidth = textTheme.lineWidth, verticalMode = textTheme.verticalMode } = attribute;
|
|
14891
|
+
const { maxLineWidth = textTheme.maxLineWidth, ellipsis = textTheme.ellipsis, fontSize = textTheme.fontSize, fontWeight = textTheme.fontWeight, fontFamily = textTheme.fontFamily, stroke = textTheme.stroke, lineWidth = textTheme.lineWidth, verticalMode = textTheme.verticalMode, suffixPosition = textTheme.suffixPosition } = attribute;
|
|
14610
14892
|
const lineHeight = (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) !== null && _a !== void 0 ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
|
|
14611
14893
|
let { textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline } = attribute;
|
|
14612
14894
|
if (!verticalMode) {
|
|
@@ -14630,7 +14912,7 @@
|
|
|
14630
14912
|
if (Number.isFinite(maxLineWidth)) {
|
|
14631
14913
|
if (ellipsis) {
|
|
14632
14914
|
const strEllipsis = (ellipsis === true ? textTheme.ellipsis : ellipsis);
|
|
14633
|
-
const data = textMeasure.clipTextWithSuffixVertical(verticalList[0], { fontSize, fontWeight, fontFamily }, maxLineWidth, strEllipsis, false);
|
|
14915
|
+
const data = textMeasure.clipTextWithSuffixVertical(verticalList[0], { fontSize, fontWeight, fontFamily }, maxLineWidth, strEllipsis, false, suffixPosition);
|
|
14634
14916
|
verticalList = [data.verticalList];
|
|
14635
14917
|
width = data.width;
|
|
14636
14918
|
}
|
|
@@ -14667,7 +14949,7 @@
|
|
|
14667
14949
|
var _a, _b;
|
|
14668
14950
|
const textTheme = getTheme(this).text;
|
|
14669
14951
|
const attribute = this.attribute;
|
|
14670
|
-
const { fontFamily = textTheme.fontFamily, textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline, fontSize = textTheme.fontSize, fontWeight = textTheme.fontWeight, ellipsis = textTheme.ellipsis, maxLineWidth, stroke = textTheme.stroke, lineWidth = textTheme.lineWidth, whiteSpace = textTheme.whiteSpace } = attribute;
|
|
14952
|
+
const { fontFamily = textTheme.fontFamily, textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline, fontSize = textTheme.fontSize, fontWeight = textTheme.fontWeight, ellipsis = textTheme.ellipsis, maxLineWidth, stroke = textTheme.stroke, lineWidth = textTheme.lineWidth, whiteSpace = textTheme.whiteSpace, suffixPosition = textTheme.suffixPosition } = attribute;
|
|
14671
14953
|
const lineHeight = (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) !== null && _a !== void 0 ? _a : (attribute.fontSize || textTheme.fontSize);
|
|
14672
14954
|
if (whiteSpace === 'normal') {
|
|
14673
14955
|
return this.updateWrapAABBBounds(text);
|
|
@@ -14682,7 +14964,7 @@
|
|
|
14682
14964
|
}
|
|
14683
14965
|
const textMeasure = application.graphicUtil.textMeasure;
|
|
14684
14966
|
const layoutObj = new CanvasTextLayout(fontFamily, { fontSize, fontWeight, fontFamily }, textMeasure);
|
|
14685
|
-
const layoutData = layoutObj.GetLayoutByLines(text, textAlign, textBaseline, lineHeight, ellipsis === true ? textTheme.ellipsis : ellipsis || undefined, false, maxLineWidth);
|
|
14967
|
+
const layoutData = layoutObj.GetLayoutByLines(text, textAlign, textBaseline, lineHeight, ellipsis === true ? textTheme.ellipsis : ellipsis || undefined, false, maxLineWidth, suffixPosition);
|
|
14686
14968
|
const { bbox } = layoutData;
|
|
14687
14969
|
this.cache.layoutData = layoutData;
|
|
14688
14970
|
this.clearUpdateShapeTag();
|
|
@@ -14700,7 +14982,7 @@
|
|
|
14700
14982
|
const attribute = this.attribute;
|
|
14701
14983
|
const { ignoreBuf = textTheme.ignoreBuf } = attribute;
|
|
14702
14984
|
const buf = ignoreBuf ? 0 : 2;
|
|
14703
|
-
const { maxLineWidth = textTheme.maxLineWidth, ellipsis = textTheme.ellipsis, fontFamily = textTheme.fontFamily, fontSize = textTheme.fontSize, fontWeight = textTheme.fontWeight, stroke = textTheme.stroke, lineWidth = textTheme.lineWidth, verticalMode = textTheme.verticalMode } = attribute;
|
|
14985
|
+
const { maxLineWidth = textTheme.maxLineWidth, ellipsis = textTheme.ellipsis, fontFamily = textTheme.fontFamily, fontSize = textTheme.fontSize, fontWeight = textTheme.fontWeight, stroke = textTheme.stroke, lineWidth = textTheme.lineWidth, verticalMode = textTheme.verticalMode, suffixPosition = textTheme.suffixPosition } = attribute;
|
|
14704
14986
|
const lineHeight = (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) !== null && _a !== void 0 ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
|
|
14705
14987
|
let { textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline } = attribute;
|
|
14706
14988
|
if (!verticalMode) {
|
|
@@ -14730,7 +15012,7 @@
|
|
|
14730
15012
|
if (Number.isFinite(maxLineWidth)) {
|
|
14731
15013
|
if (ellipsis) {
|
|
14732
15014
|
const strEllipsis = (ellipsis === true ? textTheme.ellipsis : ellipsis);
|
|
14733
|
-
const data = textMeasure.clipTextWithSuffixVertical(verticalData, { fontSize, fontWeight, fontFamily }, maxLineWidth, strEllipsis, false);
|
|
15015
|
+
const data = textMeasure.clipTextWithSuffixVertical(verticalData, { fontSize, fontWeight, fontFamily }, maxLineWidth, strEllipsis, false, suffixPosition);
|
|
14734
15016
|
verticalLists[i] = data.verticalList;
|
|
14735
15017
|
width = data.width;
|
|
14736
15018
|
}
|
|
@@ -15844,6 +16126,9 @@
|
|
|
15844
16126
|
return super.isValid() && this._isValid();
|
|
15845
16127
|
}
|
|
15846
16128
|
_isValid() {
|
|
16129
|
+
if (this.pathProxy) {
|
|
16130
|
+
return true;
|
|
16131
|
+
}
|
|
15847
16132
|
const { points, segments } = this.attribute;
|
|
15848
16133
|
if (segments) {
|
|
15849
16134
|
if (segments.length === 0) {
|
|
@@ -17475,6 +17760,9 @@
|
|
|
17475
17760
|
return super.isValid() && this._isValid();
|
|
17476
17761
|
}
|
|
17477
17762
|
_isValid() {
|
|
17763
|
+
if (this.pathProxy) {
|
|
17764
|
+
return true;
|
|
17765
|
+
}
|
|
17478
17766
|
const { points, segments } = this.attribute;
|
|
17479
17767
|
if (segments) {
|
|
17480
17768
|
if (segments.length === 0) {
|
|
@@ -19088,8 +19376,9 @@
|
|
|
19088
19376
|
tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2);
|
|
19089
19377
|
}
|
|
19090
19378
|
if (shadowBlur) {
|
|
19091
|
-
const
|
|
19092
|
-
|
|
19379
|
+
const { shadowOffsetX = theme.shadowOffsetX, shadowOffsetY = theme.shadowOffsetY } = attribute;
|
|
19380
|
+
const shadowBlurWidth = (shadowBlur / Math.abs(scaleX + scaleY)) * 2 + Math.max(shadowOffsetX, shadowOffsetY);
|
|
19381
|
+
boundStroke(tb1, shadowBlurWidth, miter, strokeBoundsBuffer + 1);
|
|
19093
19382
|
aabbBounds.union(tb1);
|
|
19094
19383
|
}
|
|
19095
19384
|
this.combindShadowAABBBounds(aabbBounds, graphic);
|
|
@@ -21742,7 +22031,7 @@
|
|
|
21742
22031
|
this.order = 0;
|
|
21743
22032
|
}
|
|
21744
22033
|
drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, options) {
|
|
21745
|
-
const { background } = graphic.attribute;
|
|
22034
|
+
const { background, backgroundMode = graphicAttribute.backgroundMode } = graphic.attribute;
|
|
21746
22035
|
if (!background) {
|
|
21747
22036
|
return;
|
|
21748
22037
|
}
|
|
@@ -21761,7 +22050,7 @@
|
|
|
21761
22050
|
context.clip();
|
|
21762
22051
|
const b = graphic.AABBBounds;
|
|
21763
22052
|
context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute);
|
|
21764
|
-
|
|
22053
|
+
this.doDrawImage(context, res.data, b, backgroundMode);
|
|
21765
22054
|
context.restore();
|
|
21766
22055
|
if (!graphic.transMatrix.onlyTranslate()) {
|
|
21767
22056
|
context.setTransformForCurrent();
|
|
@@ -21775,6 +22064,18 @@
|
|
|
21775
22064
|
context.highPerformanceRestore();
|
|
21776
22065
|
}
|
|
21777
22066
|
}
|
|
22067
|
+
doDrawImage(context, data, b, backgroundMode) {
|
|
22068
|
+
if (backgroundMode === 'no-repeat') {
|
|
22069
|
+
context.drawImage(data, b.x1, b.y1, b.width(), b.height());
|
|
22070
|
+
}
|
|
22071
|
+
else {
|
|
22072
|
+
const pattern = context.createPattern(data, backgroundMode);
|
|
22073
|
+
context.fillStyle = pattern;
|
|
22074
|
+
context.translate(b.x1, b.y1);
|
|
22075
|
+
context.fillRect(0, 0, b.width(), b.height());
|
|
22076
|
+
context.translate(-b.x1, -b.y1);
|
|
22077
|
+
}
|
|
22078
|
+
}
|
|
21778
22079
|
};
|
|
21779
22080
|
exports.DefaultBaseBackgroundRenderContribution = __decorate([
|
|
21780
22081
|
injectable()
|
|
@@ -22134,7 +22435,7 @@
|
|
|
22134
22435
|
this.time = exports.BaseRenderContributionTime.beforeFillStroke;
|
|
22135
22436
|
}
|
|
22136
22437
|
drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb) {
|
|
22137
|
-
const { background } = graphic.attribute;
|
|
22438
|
+
const { background, backgroundMode = graphicAttribute.backgroundMode } = graphic.attribute;
|
|
22138
22439
|
if (!background) {
|
|
22139
22440
|
return;
|
|
22140
22441
|
}
|
|
@@ -22146,7 +22447,7 @@
|
|
|
22146
22447
|
context.highPerformanceSave();
|
|
22147
22448
|
context.setTransformFromMatrix(graphic.parent.globalTransMatrix, true);
|
|
22148
22449
|
const b = graphic.AABBBounds;
|
|
22149
|
-
|
|
22450
|
+
this.doDrawImage(context, res.data, b, backgroundMode);
|
|
22150
22451
|
context.highPerformanceRestore();
|
|
22151
22452
|
context.setTransformForCurrent();
|
|
22152
22453
|
}
|
|
@@ -22168,7 +22469,7 @@
|
|
|
22168
22469
|
this.time = exports.BaseRenderContributionTime.beforeFillStroke;
|
|
22169
22470
|
}
|
|
22170
22471
|
drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb) {
|
|
22171
|
-
const { background,
|
|
22472
|
+
const { background, backgroundMode = graphicAttribute.backgroundMode } = graphic.attribute;
|
|
22172
22473
|
if (!background) {
|
|
22173
22474
|
return;
|
|
22174
22475
|
}
|
|
@@ -22219,7 +22520,7 @@
|
|
|
22219
22520
|
context.translate(scrollX, scrollY);
|
|
22220
22521
|
}
|
|
22221
22522
|
const b = graphic.AABBBounds;
|
|
22222
|
-
|
|
22523
|
+
this.doDrawImage(context, res.data, b, backgroundMode);
|
|
22223
22524
|
context.restore();
|
|
22224
22525
|
if (!graphic.transMatrix.onlyTranslate()) {
|
|
22225
22526
|
context.setTransformForCurrent();
|
|
@@ -23666,6 +23967,13 @@
|
|
|
23666
23967
|
dirtyBounds.x2 = Math.ceil(b.x2);
|
|
23667
23968
|
dirtyBounds.y2 = Math.ceil(b.y2);
|
|
23668
23969
|
}
|
|
23970
|
+
const d = context.dpr % 1;
|
|
23971
|
+
if (d || d !== 0.5) {
|
|
23972
|
+
dirtyBounds.x1 = Math.floor(dirtyBounds.x1 * context.dpr) / context.dpr;
|
|
23973
|
+
dirtyBounds.y1 = Math.floor(dirtyBounds.y1 * context.dpr) / context.dpr;
|
|
23974
|
+
dirtyBounds.x2 = Math.ceil(dirtyBounds.x2 * context.dpr) / context.dpr;
|
|
23975
|
+
dirtyBounds.y2 = Math.ceil(dirtyBounds.y2 * context.dpr) / context.dpr;
|
|
23976
|
+
}
|
|
23669
23977
|
this.backupDirtyBounds.copy(dirtyBounds);
|
|
23670
23978
|
context.inuse = true;
|
|
23671
23979
|
context.clearMatrix();
|
|
@@ -23861,7 +24169,7 @@
|
|
|
23861
24169
|
}
|
|
23862
24170
|
}
|
|
23863
24171
|
selectRenderByType(type) {
|
|
23864
|
-
|
|
24172
|
+
vutils.Logger.getInstance().warn('未知错误,不应该走到这里');
|
|
23865
24173
|
return null;
|
|
23866
24174
|
}
|
|
23867
24175
|
selectRenderByNumberType(type) {
|