@visactor/vrender-core 0.16.14-alpha.3 → 0.16.14-alpha.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/cjs/common/utils.d.ts +0 -1
- package/cjs/common/utils.js +1 -10
- package/cjs/common/utils.js.map +1 -1
- package/cjs/core/graphic-utils.d.ts +1 -3
- package/cjs/core/graphic-utils.js +2 -4
- package/cjs/core/graphic-utils.js.map +1 -1
- package/cjs/core/stage.d.ts +0 -1
- package/cjs/core/stage.js +3 -7
- package/cjs/core/stage.js.map +1 -1
- package/cjs/graphic/config.js +1 -4
- package/cjs/graphic/config.js.map +1 -1
- package/cjs/graphic/text.d.ts +0 -1
- package/cjs/graphic/text.js +7 -93
- package/cjs/graphic/text.js.map +1 -1
- package/cjs/graphic/wrap-text.js +5 -6
- package/cjs/graphic/wrap-text.js.map +1 -1
- package/cjs/interface/core.d.ts +1 -3
- package/cjs/interface/core.js.map +1 -1
- package/cjs/interface/graphic/text.d.ts +1 -4
- package/cjs/interface/graphic/text.js.map +1 -1
- package/cjs/render/contributions/render/text-render.js +2 -2
- package/cjs/render/contributions/render/text-render.js.map +1 -1
- package/dist/index.js +299 -446
- package/dist/index.min.js +1 -1
- package/es/common/utils.d.ts +0 -1
- package/es/common/utils.js +1 -8
- package/es/common/utils.js.map +1 -1
- package/es/core/graphic-utils.d.ts +1 -3
- package/es/core/graphic-utils.js +1 -5
- package/es/core/graphic-utils.js.map +1 -1
- package/es/core/stage.d.ts +0 -1
- package/es/core/stage.js +3 -7
- package/es/core/stage.js.map +1 -1
- package/es/graphic/config.js +1 -4
- package/es/graphic/config.js.map +1 -1
- package/es/graphic/text.d.ts +0 -1
- package/es/graphic/text.js +9 -90
- package/es/graphic/text.js.map +1 -1
- package/es/graphic/wrap-text.js +4 -6
- package/es/graphic/wrap-text.js.map +1 -1
- package/es/interface/core.d.ts +1 -3
- package/es/interface/core.js.map +1 -1
- package/es/interface/graphic/text.d.ts +1 -4
- package/es/interface/graphic/text.js.map +1 -1
- package/es/render/contributions/render/text-render.js +1 -3
- package/es/render/contributions/render/text-render.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4294,10 +4294,7 @@
|
|
|
4294
4294
|
direction: 'horizontal',
|
|
4295
4295
|
wordBreak: 'break-all',
|
|
4296
4296
|
ignoreBuf: false,
|
|
4297
|
-
verticalMode: 0
|
|
4298
|
-
whiteSpace: 'no-wrap',
|
|
4299
|
-
heightLimit: Infinity,
|
|
4300
|
-
lineClamp: Infinity
|
|
4297
|
+
verticalMode: 0
|
|
4301
4298
|
};
|
|
4302
4299
|
const DefaultStyle = Object.assign(Object.assign(Object.assign({ opacity: 1, background: null, texture: null, textureColor: 'black', textureSize: 10, texturePadding: 2, backgroundMode: 0, blur: 0, cursor: null, html: null }, DefaultFillStyle), DefaultStrokeStyle), DefaultLayout);
|
|
4303
4300
|
const DefaultConnectAttribute = {
|
|
@@ -5425,247 +5422,6 @@
|
|
|
5425
5422
|
return containPath(commands, lineWidth, true, x, y);
|
|
5426
5423
|
}
|
|
5427
5424
|
|
|
5428
|
-
exports.Edge = void 0;
|
|
5429
|
-
(function (Edge) {
|
|
5430
|
-
Edge[Edge["Top"] = 1] = "Top";
|
|
5431
|
-
Edge[Edge["Right"] = 2] = "Right";
|
|
5432
|
-
Edge[Edge["Bottom"] = 4] = "Bottom";
|
|
5433
|
-
Edge[Edge["Left"] = 8] = "Left";
|
|
5434
|
-
Edge[Edge["ALL"] = 15] = "ALL";
|
|
5435
|
-
})(exports.Edge || (exports.Edge = {}));
|
|
5436
|
-
const _strokeVec4 = [
|
|
5437
|
-
false,
|
|
5438
|
-
false,
|
|
5439
|
-
false,
|
|
5440
|
-
false
|
|
5441
|
-
];
|
|
5442
|
-
const parseStroke = (stroke) => {
|
|
5443
|
-
var _a;
|
|
5444
|
-
let isFullStroke = true;
|
|
5445
|
-
if (vutils.isBoolean(stroke, true)) {
|
|
5446
|
-
for (let i = 0; i < 4; i++) {
|
|
5447
|
-
_strokeVec4[i] = stroke;
|
|
5448
|
-
isFullStroke && (isFullStroke = !!((_a = _strokeVec4[i]) !== null && _a !== void 0 ? _a : true));
|
|
5449
|
-
}
|
|
5450
|
-
isFullStroke = stroke;
|
|
5451
|
-
}
|
|
5452
|
-
else if (Array.isArray(stroke)) {
|
|
5453
|
-
for (let i = 0; i < 4; i++) {
|
|
5454
|
-
_strokeVec4[i] = !!stroke[i];
|
|
5455
|
-
isFullStroke && (isFullStroke = !!_strokeVec4[i]);
|
|
5456
|
-
}
|
|
5457
|
-
}
|
|
5458
|
-
else {
|
|
5459
|
-
_strokeVec4[0] = false;
|
|
5460
|
-
_strokeVec4[1] = false;
|
|
5461
|
-
_strokeVec4[2] = false;
|
|
5462
|
-
_strokeVec4[3] = false;
|
|
5463
|
-
}
|
|
5464
|
-
return {
|
|
5465
|
-
isFullStroke,
|
|
5466
|
-
stroke: _strokeVec4
|
|
5467
|
-
};
|
|
5468
|
-
};
|
|
5469
|
-
const _paddingVec4 = [0, 0, 0, 0];
|
|
5470
|
-
const parsePadding = (padding) => {
|
|
5471
|
-
if (!padding) {
|
|
5472
|
-
return 0;
|
|
5473
|
-
}
|
|
5474
|
-
if (vutils.isArray(padding)) {
|
|
5475
|
-
if (padding.length === 0) {
|
|
5476
|
-
return 0;
|
|
5477
|
-
}
|
|
5478
|
-
else if (padding.length === 1) {
|
|
5479
|
-
return padding[0];
|
|
5480
|
-
}
|
|
5481
|
-
else if (padding.length === 2) {
|
|
5482
|
-
_paddingVec4[0] = padding[0];
|
|
5483
|
-
_paddingVec4[2] = padding[0];
|
|
5484
|
-
_paddingVec4[1] = padding[1];
|
|
5485
|
-
_paddingVec4[3] = padding[1];
|
|
5486
|
-
return _paddingVec4;
|
|
5487
|
-
}
|
|
5488
|
-
return padding;
|
|
5489
|
-
}
|
|
5490
|
-
return padding;
|
|
5491
|
-
};
|
|
5492
|
-
const _coords = [
|
|
5493
|
-
{ x: 0, y: 0 },
|
|
5494
|
-
{ x: 0, y: 0 },
|
|
5495
|
-
{ x: 0, y: 0 },
|
|
5496
|
-
{ x: 0, y: 0 }
|
|
5497
|
-
];
|
|
5498
|
-
const indexList = [1, 2, 3, 0, 1, 2, 3, 0];
|
|
5499
|
-
function circleBounds(startAngle, endAngle, radius, bounds) {
|
|
5500
|
-
while (startAngle >= vutils.pi2) {
|
|
5501
|
-
startAngle -= vutils.pi2;
|
|
5502
|
-
}
|
|
5503
|
-
while (startAngle < 0) {
|
|
5504
|
-
startAngle += vutils.pi2;
|
|
5505
|
-
}
|
|
5506
|
-
while (startAngle > endAngle) {
|
|
5507
|
-
endAngle += vutils.pi2;
|
|
5508
|
-
}
|
|
5509
|
-
_coords[0].x = radius;
|
|
5510
|
-
_coords[1].y = radius;
|
|
5511
|
-
_coords[2].x = -radius;
|
|
5512
|
-
_coords[3].y = -radius;
|
|
5513
|
-
const startIdx = Math.ceil(startAngle / vutils.halfPi) % 4;
|
|
5514
|
-
const endIdx = Math.ceil(endAngle / vutils.halfPi) % 4;
|
|
5515
|
-
bounds.add(vutils.cos(startAngle) * radius, vutils.sin(startAngle) * radius);
|
|
5516
|
-
bounds.add(vutils.cos(endAngle) * radius, vutils.sin(endAngle) * radius);
|
|
5517
|
-
if (startIdx !== endIdx || endAngle - startAngle > vutils.pi) {
|
|
5518
|
-
let match = false;
|
|
5519
|
-
for (let i = 0; i < indexList.length; i++) {
|
|
5520
|
-
if (!match && startIdx === indexList[i]) {
|
|
5521
|
-
match = true;
|
|
5522
|
-
const p = _coords[startIdx];
|
|
5523
|
-
bounds.add(p.x, p.y);
|
|
5524
|
-
continue;
|
|
5525
|
-
}
|
|
5526
|
-
else if (match && endIdx === indexList[i]) {
|
|
5527
|
-
break;
|
|
5528
|
-
}
|
|
5529
|
-
if (match) {
|
|
5530
|
-
const p = _coords[indexList[i]];
|
|
5531
|
-
bounds.add(p.x, p.y);
|
|
5532
|
-
}
|
|
5533
|
-
}
|
|
5534
|
-
}
|
|
5535
|
-
}
|
|
5536
|
-
function pointsEqual(pointsA, pointsB) {
|
|
5537
|
-
if (!pointsA || !pointsB) {
|
|
5538
|
-
return false;
|
|
5539
|
-
}
|
|
5540
|
-
if (Array.isArray(pointsA) && Array.isArray(pointsB)) {
|
|
5541
|
-
if (pointsA.length !== pointsB.length) {
|
|
5542
|
-
return false;
|
|
5543
|
-
}
|
|
5544
|
-
return pointsA.every((point, index) => pointEqual(point, pointsB[index]));
|
|
5545
|
-
}
|
|
5546
|
-
if (!Number.isNaN(pointsA.x + pointsA.y)) {
|
|
5547
|
-
return pointEqual(pointsA, pointsB);
|
|
5548
|
-
}
|
|
5549
|
-
return false;
|
|
5550
|
-
}
|
|
5551
|
-
function pointEqual(pointA, pointB) {
|
|
5552
|
-
return (pointA.x === pointB.x &&
|
|
5553
|
-
pointA.y === pointB.y &&
|
|
5554
|
-
pointA.x1 === pointB.x1 &&
|
|
5555
|
-
pointA.y1 === pointB.y1 &&
|
|
5556
|
-
pointA.defined === pointB.defined);
|
|
5557
|
-
}
|
|
5558
|
-
function pointInterpolation(pointA, pointB, ratio) {
|
|
5559
|
-
const { x, y } = vutils.pointAt(pointA.x, pointA.y, pointB.x, pointB.y, ratio);
|
|
5560
|
-
const { x: x1, y: y1 } = vutils.pointAt(pointA.x1, pointA.y1, pointB.x1, pointB.y1, ratio);
|
|
5561
|
-
const point = new vutils.Point(x, y, x1, y1);
|
|
5562
|
-
point.defined = pointB.defined;
|
|
5563
|
-
return point;
|
|
5564
|
-
}
|
|
5565
|
-
function pointInterpolationHighPerformance(pointA, pointB, ratio, point) {
|
|
5566
|
-
const { x, y } = vutils.pointAt(pointA.x, pointA.y, pointB.x, pointB.y, ratio);
|
|
5567
|
-
const { x: x1, y: y1 } = vutils.pointAt(pointA.x1, pointA.y1, pointB.x1, pointB.y1, ratio);
|
|
5568
|
-
point.x = x;
|
|
5569
|
-
point.y = y;
|
|
5570
|
-
point.x1 = x1;
|
|
5571
|
-
point.y1 = y1;
|
|
5572
|
-
point.defined = pointB.defined;
|
|
5573
|
-
return point;
|
|
5574
|
-
}
|
|
5575
|
-
function pointsInterpolation(pointsA, pointsB, ratio) {
|
|
5576
|
-
if (!pointsA || !pointsB) {
|
|
5577
|
-
return [];
|
|
5578
|
-
}
|
|
5579
|
-
if (!Array.isArray(pointsA)) {
|
|
5580
|
-
pointsA = [pointsA];
|
|
5581
|
-
}
|
|
5582
|
-
if (!Array.isArray(pointsB)) {
|
|
5583
|
-
pointsB = [pointsB];
|
|
5584
|
-
}
|
|
5585
|
-
let points = [];
|
|
5586
|
-
if (pointsA.length > pointsB.length) {
|
|
5587
|
-
points = pointsB.map(point => {
|
|
5588
|
-
const p = new vutils.Point(point.x, point.y, point.x1, point.y1);
|
|
5589
|
-
p.defined = point.defined;
|
|
5590
|
-
return p;
|
|
5591
|
-
});
|
|
5592
|
-
for (let i = 0; i < pointsB.length; i++) {
|
|
5593
|
-
points[i] = pointInterpolation(pointsA[i], pointsB[i], ratio);
|
|
5594
|
-
}
|
|
5595
|
-
}
|
|
5596
|
-
else {
|
|
5597
|
-
points = pointsB.map(point => {
|
|
5598
|
-
const p = new vutils.Point(point.x, point.y, point.x1, point.y1);
|
|
5599
|
-
p.defined = point.defined;
|
|
5600
|
-
return p;
|
|
5601
|
-
});
|
|
5602
|
-
for (let i = 0; i < pointsA.length; i++) {
|
|
5603
|
-
points[i] = pointInterpolation(pointsA[i], pointsB[i], ratio);
|
|
5604
|
-
}
|
|
5605
|
-
}
|
|
5606
|
-
return points;
|
|
5607
|
-
}
|
|
5608
|
-
const transformKeys = [
|
|
5609
|
-
'x',
|
|
5610
|
-
'y',
|
|
5611
|
-
'dx',
|
|
5612
|
-
'dy',
|
|
5613
|
-
'scaleX',
|
|
5614
|
-
'scaleY',
|
|
5615
|
-
'angle',
|
|
5616
|
-
'anchor',
|
|
5617
|
-
'postMatrix',
|
|
5618
|
-
'scrollX',
|
|
5619
|
-
'scrollY'
|
|
5620
|
-
];
|
|
5621
|
-
const isTransformKey = (key) => {
|
|
5622
|
-
return transformKeys.includes(key);
|
|
5623
|
-
};
|
|
5624
|
-
function getAttributeFromDefaultAttrList(attr, key) {
|
|
5625
|
-
if (vutils.isArray(attr)) {
|
|
5626
|
-
let val;
|
|
5627
|
-
for (let i = 0; i < attr.length && val === undefined; i++) {
|
|
5628
|
-
val = attr[i][key];
|
|
5629
|
-
}
|
|
5630
|
-
return val;
|
|
5631
|
-
}
|
|
5632
|
-
return attr[key];
|
|
5633
|
-
}
|
|
5634
|
-
class RafBasedSTO {
|
|
5635
|
-
constructor() {
|
|
5636
|
-
this.durations = [];
|
|
5637
|
-
this.timeout = RafBasedSTO.TimeOut;
|
|
5638
|
-
this.lastDate = 0;
|
|
5639
|
-
this.durationsListThreshold = 30;
|
|
5640
|
-
}
|
|
5641
|
-
call(cb) {
|
|
5642
|
-
this.lastDate = Date.now();
|
|
5643
|
-
return setTimeout(() => {
|
|
5644
|
-
this.appendDuration(Date.now() - this.lastDate);
|
|
5645
|
-
cb(0);
|
|
5646
|
-
}, this.timeout, true);
|
|
5647
|
-
}
|
|
5648
|
-
clear(h) {
|
|
5649
|
-
clearTimeout(h);
|
|
5650
|
-
}
|
|
5651
|
-
appendDuration(d) {
|
|
5652
|
-
this.durations.push(d);
|
|
5653
|
-
if (this.durations.length > this.durationsListThreshold) {
|
|
5654
|
-
this.durations.shift();
|
|
5655
|
-
}
|
|
5656
|
-
this.timeout = Math.min(Math.max(this.durations.reduce((a, b) => a + b, 0) / this.durations.length, 1000 / 60), 1000 / 30);
|
|
5657
|
-
}
|
|
5658
|
-
}
|
|
5659
|
-
RafBasedSTO.TimeOut = 1000 / 60;
|
|
5660
|
-
const rafBasedSto = new RafBasedSTO();
|
|
5661
|
-
const calculateLineHeight = (lineHeight, fontSize) => {
|
|
5662
|
-
if (vutils.isString(lineHeight) && lineHeight[lineHeight.length - 1] === '%') {
|
|
5663
|
-
const scale = Number.parseFloat(lineHeight.substring(0, lineHeight.length - 1)) / 100;
|
|
5664
|
-
return fontSize * scale;
|
|
5665
|
-
}
|
|
5666
|
-
return lineHeight;
|
|
5667
|
-
};
|
|
5668
|
-
|
|
5669
5425
|
exports.DefaultGraphicUtil = class DefaultGraphicUtil {
|
|
5670
5426
|
constructor(contributions, global) {
|
|
5671
5427
|
this.contributions = contributions;
|
|
@@ -5716,7 +5472,7 @@
|
|
|
5716
5472
|
return new vutils.TextMeasure(Object.assign({ defaultFontParams: {
|
|
5717
5473
|
fontFamily: DefaultTextStyle.fontFamily,
|
|
5718
5474
|
fontSize: DefaultTextStyle.fontSize
|
|
5719
|
-
}, getCanvasForMeasure: getCanvasForMeasure || (() => this.canvas), getTextBounds: undefined, specialCharSet: '-/: .,@%\'"~' + vutils.TextMeasure.ALPHABET_CHAR_SET + vutils.TextMeasure.ALPHABET_CHAR_SET.toUpperCase() }, (option !== null && option !== void 0 ? option : {})),
|
|
5475
|
+
}, getCanvasForMeasure: getCanvasForMeasure || (() => this.canvas), getTextBounds: undefined, specialCharSet: '-/: .,@%\'"~' + vutils.TextMeasure.ALPHABET_CHAR_SET + vutils.TextMeasure.ALPHABET_CHAR_SET.toUpperCase() }, (option !== null && option !== void 0 ? option : {})), textSpec);
|
|
5720
5476
|
}
|
|
5721
5477
|
};
|
|
5722
5478
|
exports.DefaultGraphicUtil = __decorate([
|
|
@@ -8964,65 +8720,299 @@
|
|
|
8964
8720
|
}
|
|
8965
8721
|
}
|
|
8966
8722
|
}
|
|
8967
|
-
getLastPropByName(name, step) {
|
|
8968
|
-
let lastStep = step.prev;
|
|
8969
|
-
while (lastStep) {
|
|
8970
|
-
if (lastStep.props && lastStep.props[name] !== undefined) {
|
|
8971
|
-
return lastStep.props[name];
|
|
8972
|
-
}
|
|
8973
|
-
else if (lastStep.customAnimate) {
|
|
8974
|
-
const val = lastStep.customAnimate.getEndProps()[name];
|
|
8975
|
-
if (val !== undefined) {
|
|
8976
|
-
return val;
|
|
8977
|
-
}
|
|
8978
|
-
}
|
|
8979
|
-
lastStep = lastStep.prev;
|
|
8723
|
+
getLastPropByName(name, step) {
|
|
8724
|
+
let lastStep = step.prev;
|
|
8725
|
+
while (lastStep) {
|
|
8726
|
+
if (lastStep.props && lastStep.props[name] !== undefined) {
|
|
8727
|
+
return lastStep.props[name];
|
|
8728
|
+
}
|
|
8729
|
+
else if (lastStep.customAnimate) {
|
|
8730
|
+
const val = lastStep.customAnimate.getEndProps()[name];
|
|
8731
|
+
if (val !== undefined) {
|
|
8732
|
+
return val;
|
|
8733
|
+
}
|
|
8734
|
+
}
|
|
8735
|
+
lastStep = lastStep.prev;
|
|
8736
|
+
}
|
|
8737
|
+
console.warn('未知错误,step中找不到属性');
|
|
8738
|
+
return step.props[name];
|
|
8739
|
+
}
|
|
8740
|
+
updateTarget(step, ratio, end) {
|
|
8741
|
+
if (step.props == null && step.customAnimate == null) {
|
|
8742
|
+
return;
|
|
8743
|
+
}
|
|
8744
|
+
this.target.onStep(this, this.animate, step, ratio, end);
|
|
8745
|
+
}
|
|
8746
|
+
}
|
|
8747
|
+
class Step {
|
|
8748
|
+
constructor(position, duration, props, easing) {
|
|
8749
|
+
this.duration = duration;
|
|
8750
|
+
this.position = position;
|
|
8751
|
+
this.props = props;
|
|
8752
|
+
this.easing = easing;
|
|
8753
|
+
}
|
|
8754
|
+
append(step) {
|
|
8755
|
+
step.prev = this;
|
|
8756
|
+
step.next = this.next;
|
|
8757
|
+
this.next = step;
|
|
8758
|
+
}
|
|
8759
|
+
getLastProps() {
|
|
8760
|
+
let step = this.prev;
|
|
8761
|
+
while (step) {
|
|
8762
|
+
if (step.props) {
|
|
8763
|
+
return step.props;
|
|
8764
|
+
}
|
|
8765
|
+
else if (step.customAnimate) {
|
|
8766
|
+
return step.customAnimate.getMergedEndProps();
|
|
8767
|
+
}
|
|
8768
|
+
step = step.prev;
|
|
8769
|
+
}
|
|
8770
|
+
return null;
|
|
8771
|
+
}
|
|
8772
|
+
}
|
|
8773
|
+
|
|
8774
|
+
const DefaultStateAnimateConfig = {
|
|
8775
|
+
duration: 200,
|
|
8776
|
+
easing: 'cubicOut'
|
|
8777
|
+
};
|
|
8778
|
+
const DefaultMorphingAnimateConfig = {
|
|
8779
|
+
duration: 1000,
|
|
8780
|
+
easing: 'quadInOut'
|
|
8781
|
+
};
|
|
8782
|
+
|
|
8783
|
+
exports.Edge = void 0;
|
|
8784
|
+
(function (Edge) {
|
|
8785
|
+
Edge[Edge["Top"] = 1] = "Top";
|
|
8786
|
+
Edge[Edge["Right"] = 2] = "Right";
|
|
8787
|
+
Edge[Edge["Bottom"] = 4] = "Bottom";
|
|
8788
|
+
Edge[Edge["Left"] = 8] = "Left";
|
|
8789
|
+
Edge[Edge["ALL"] = 15] = "ALL";
|
|
8790
|
+
})(exports.Edge || (exports.Edge = {}));
|
|
8791
|
+
const _strokeVec4 = [
|
|
8792
|
+
false,
|
|
8793
|
+
false,
|
|
8794
|
+
false,
|
|
8795
|
+
false
|
|
8796
|
+
];
|
|
8797
|
+
const parseStroke = (stroke) => {
|
|
8798
|
+
var _a;
|
|
8799
|
+
let isFullStroke = true;
|
|
8800
|
+
if (vutils.isBoolean(stroke, true)) {
|
|
8801
|
+
for (let i = 0; i < 4; i++) {
|
|
8802
|
+
_strokeVec4[i] = stroke;
|
|
8803
|
+
isFullStroke && (isFullStroke = !!((_a = _strokeVec4[i]) !== null && _a !== void 0 ? _a : true));
|
|
8804
|
+
}
|
|
8805
|
+
isFullStroke = stroke;
|
|
8806
|
+
}
|
|
8807
|
+
else if (Array.isArray(stroke)) {
|
|
8808
|
+
for (let i = 0; i < 4; i++) {
|
|
8809
|
+
_strokeVec4[i] = !!stroke[i];
|
|
8810
|
+
isFullStroke && (isFullStroke = !!_strokeVec4[i]);
|
|
8811
|
+
}
|
|
8812
|
+
}
|
|
8813
|
+
else {
|
|
8814
|
+
_strokeVec4[0] = false;
|
|
8815
|
+
_strokeVec4[1] = false;
|
|
8816
|
+
_strokeVec4[2] = false;
|
|
8817
|
+
_strokeVec4[3] = false;
|
|
8818
|
+
}
|
|
8819
|
+
return {
|
|
8820
|
+
isFullStroke,
|
|
8821
|
+
stroke: _strokeVec4
|
|
8822
|
+
};
|
|
8823
|
+
};
|
|
8824
|
+
const _paddingVec4 = [0, 0, 0, 0];
|
|
8825
|
+
const parsePadding = (padding) => {
|
|
8826
|
+
if (!padding) {
|
|
8827
|
+
return 0;
|
|
8828
|
+
}
|
|
8829
|
+
if (vutils.isArray(padding)) {
|
|
8830
|
+
if (padding.length === 0) {
|
|
8831
|
+
return 0;
|
|
8832
|
+
}
|
|
8833
|
+
else if (padding.length === 1) {
|
|
8834
|
+
return padding[0];
|
|
8835
|
+
}
|
|
8836
|
+
else if (padding.length === 2) {
|
|
8837
|
+
_paddingVec4[0] = padding[0];
|
|
8838
|
+
_paddingVec4[2] = padding[0];
|
|
8839
|
+
_paddingVec4[1] = padding[1];
|
|
8840
|
+
_paddingVec4[3] = padding[1];
|
|
8841
|
+
return _paddingVec4;
|
|
8842
|
+
}
|
|
8843
|
+
return padding;
|
|
8844
|
+
}
|
|
8845
|
+
return padding;
|
|
8846
|
+
};
|
|
8847
|
+
const _coords = [
|
|
8848
|
+
{ x: 0, y: 0 },
|
|
8849
|
+
{ x: 0, y: 0 },
|
|
8850
|
+
{ x: 0, y: 0 },
|
|
8851
|
+
{ x: 0, y: 0 }
|
|
8852
|
+
];
|
|
8853
|
+
const indexList = [1, 2, 3, 0, 1, 2, 3, 0];
|
|
8854
|
+
function circleBounds(startAngle, endAngle, radius, bounds) {
|
|
8855
|
+
while (startAngle >= vutils.pi2) {
|
|
8856
|
+
startAngle -= vutils.pi2;
|
|
8857
|
+
}
|
|
8858
|
+
while (startAngle < 0) {
|
|
8859
|
+
startAngle += vutils.pi2;
|
|
8860
|
+
}
|
|
8861
|
+
while (startAngle > endAngle) {
|
|
8862
|
+
endAngle += vutils.pi2;
|
|
8863
|
+
}
|
|
8864
|
+
_coords[0].x = radius;
|
|
8865
|
+
_coords[1].y = radius;
|
|
8866
|
+
_coords[2].x = -radius;
|
|
8867
|
+
_coords[3].y = -radius;
|
|
8868
|
+
const startIdx = Math.ceil(startAngle / vutils.halfPi) % 4;
|
|
8869
|
+
const endIdx = Math.ceil(endAngle / vutils.halfPi) % 4;
|
|
8870
|
+
bounds.add(vutils.cos(startAngle) * radius, vutils.sin(startAngle) * radius);
|
|
8871
|
+
bounds.add(vutils.cos(endAngle) * radius, vutils.sin(endAngle) * radius);
|
|
8872
|
+
if (startIdx !== endIdx || endAngle - startAngle > vutils.pi) {
|
|
8873
|
+
let match = false;
|
|
8874
|
+
for (let i = 0; i < indexList.length; i++) {
|
|
8875
|
+
if (!match && startIdx === indexList[i]) {
|
|
8876
|
+
match = true;
|
|
8877
|
+
const p = _coords[startIdx];
|
|
8878
|
+
bounds.add(p.x, p.y);
|
|
8879
|
+
continue;
|
|
8880
|
+
}
|
|
8881
|
+
else if (match && endIdx === indexList[i]) {
|
|
8882
|
+
break;
|
|
8883
|
+
}
|
|
8884
|
+
if (match) {
|
|
8885
|
+
const p = _coords[indexList[i]];
|
|
8886
|
+
bounds.add(p.x, p.y);
|
|
8887
|
+
}
|
|
8888
|
+
}
|
|
8889
|
+
}
|
|
8890
|
+
}
|
|
8891
|
+
function pointsEqual(pointsA, pointsB) {
|
|
8892
|
+
if (!pointsA || !pointsB) {
|
|
8893
|
+
return false;
|
|
8894
|
+
}
|
|
8895
|
+
if (Array.isArray(pointsA) && Array.isArray(pointsB)) {
|
|
8896
|
+
if (pointsA.length !== pointsB.length) {
|
|
8897
|
+
return false;
|
|
8898
|
+
}
|
|
8899
|
+
return pointsA.every((point, index) => pointEqual(point, pointsB[index]));
|
|
8900
|
+
}
|
|
8901
|
+
if (!Number.isNaN(pointsA.x + pointsA.y)) {
|
|
8902
|
+
return pointEqual(pointsA, pointsB);
|
|
8903
|
+
}
|
|
8904
|
+
return false;
|
|
8905
|
+
}
|
|
8906
|
+
function pointEqual(pointA, pointB) {
|
|
8907
|
+
return (pointA.x === pointB.x &&
|
|
8908
|
+
pointA.y === pointB.y &&
|
|
8909
|
+
pointA.x1 === pointB.x1 &&
|
|
8910
|
+
pointA.y1 === pointB.y1 &&
|
|
8911
|
+
pointA.defined === pointB.defined);
|
|
8912
|
+
}
|
|
8913
|
+
function pointInterpolation(pointA, pointB, ratio) {
|
|
8914
|
+
const { x, y } = vutils.pointAt(pointA.x, pointA.y, pointB.x, pointB.y, ratio);
|
|
8915
|
+
const { x: x1, y: y1 } = vutils.pointAt(pointA.x1, pointA.y1, pointB.x1, pointB.y1, ratio);
|
|
8916
|
+
const point = new vutils.Point(x, y, x1, y1);
|
|
8917
|
+
point.defined = pointB.defined;
|
|
8918
|
+
return point;
|
|
8919
|
+
}
|
|
8920
|
+
function pointInterpolationHighPerformance(pointA, pointB, ratio, point) {
|
|
8921
|
+
const { x, y } = vutils.pointAt(pointA.x, pointA.y, pointB.x, pointB.y, ratio);
|
|
8922
|
+
const { x: x1, y: y1 } = vutils.pointAt(pointA.x1, pointA.y1, pointB.x1, pointB.y1, ratio);
|
|
8923
|
+
point.x = x;
|
|
8924
|
+
point.y = y;
|
|
8925
|
+
point.x1 = x1;
|
|
8926
|
+
point.y1 = y1;
|
|
8927
|
+
point.defined = pointB.defined;
|
|
8928
|
+
return point;
|
|
8929
|
+
}
|
|
8930
|
+
function pointsInterpolation(pointsA, pointsB, ratio) {
|
|
8931
|
+
if (!pointsA || !pointsB) {
|
|
8932
|
+
return [];
|
|
8933
|
+
}
|
|
8934
|
+
if (!Array.isArray(pointsA)) {
|
|
8935
|
+
pointsA = [pointsA];
|
|
8936
|
+
}
|
|
8937
|
+
if (!Array.isArray(pointsB)) {
|
|
8938
|
+
pointsB = [pointsB];
|
|
8939
|
+
}
|
|
8940
|
+
let points = [];
|
|
8941
|
+
if (pointsA.length > pointsB.length) {
|
|
8942
|
+
points = pointsB.map(point => {
|
|
8943
|
+
const p = new vutils.Point(point.x, point.y, point.x1, point.y1);
|
|
8944
|
+
p.defined = point.defined;
|
|
8945
|
+
return p;
|
|
8946
|
+
});
|
|
8947
|
+
for (let i = 0; i < pointsB.length; i++) {
|
|
8948
|
+
points[i] = pointInterpolation(pointsA[i], pointsB[i], ratio);
|
|
8949
|
+
}
|
|
8950
|
+
}
|
|
8951
|
+
else {
|
|
8952
|
+
points = pointsB.map(point => {
|
|
8953
|
+
const p = new vutils.Point(point.x, point.y, point.x1, point.y1);
|
|
8954
|
+
p.defined = point.defined;
|
|
8955
|
+
return p;
|
|
8956
|
+
});
|
|
8957
|
+
for (let i = 0; i < pointsA.length; i++) {
|
|
8958
|
+
points[i] = pointInterpolation(pointsA[i], pointsB[i], ratio);
|
|
8980
8959
|
}
|
|
8981
|
-
console.warn('未知错误,step中找不到属性');
|
|
8982
|
-
return step.props[name];
|
|
8983
8960
|
}
|
|
8984
|
-
|
|
8985
|
-
|
|
8986
|
-
|
|
8961
|
+
return points;
|
|
8962
|
+
}
|
|
8963
|
+
const transformKeys = [
|
|
8964
|
+
'x',
|
|
8965
|
+
'y',
|
|
8966
|
+
'dx',
|
|
8967
|
+
'dy',
|
|
8968
|
+
'scaleX',
|
|
8969
|
+
'scaleY',
|
|
8970
|
+
'angle',
|
|
8971
|
+
'anchor',
|
|
8972
|
+
'postMatrix',
|
|
8973
|
+
'scrollX',
|
|
8974
|
+
'scrollY'
|
|
8975
|
+
];
|
|
8976
|
+
const isTransformKey = (key) => {
|
|
8977
|
+
return transformKeys.includes(key);
|
|
8978
|
+
};
|
|
8979
|
+
function getAttributeFromDefaultAttrList(attr, key) {
|
|
8980
|
+
if (vutils.isArray(attr)) {
|
|
8981
|
+
let val;
|
|
8982
|
+
for (let i = 0; i < attr.length && val === undefined; i++) {
|
|
8983
|
+
val = attr[i][key];
|
|
8987
8984
|
}
|
|
8988
|
-
|
|
8985
|
+
return val;
|
|
8989
8986
|
}
|
|
8987
|
+
return attr[key];
|
|
8990
8988
|
}
|
|
8991
|
-
class
|
|
8992
|
-
constructor(
|
|
8993
|
-
this.
|
|
8994
|
-
this.
|
|
8995
|
-
this.
|
|
8996
|
-
this.
|
|
8989
|
+
class RafBasedSTO {
|
|
8990
|
+
constructor() {
|
|
8991
|
+
this.durations = [];
|
|
8992
|
+
this.timeout = RafBasedSTO.TimeOut;
|
|
8993
|
+
this.lastDate = 0;
|
|
8994
|
+
this.durationsListThreshold = 30;
|
|
8997
8995
|
}
|
|
8998
|
-
|
|
8999
|
-
|
|
9000
|
-
|
|
9001
|
-
|
|
8996
|
+
call(cb) {
|
|
8997
|
+
this.lastDate = Date.now();
|
|
8998
|
+
return setTimeout(() => {
|
|
8999
|
+
this.appendDuration(Date.now() - this.lastDate);
|
|
9000
|
+
cb(0);
|
|
9001
|
+
}, this.timeout, true);
|
|
9002
9002
|
}
|
|
9003
|
-
|
|
9004
|
-
|
|
9005
|
-
|
|
9006
|
-
|
|
9007
|
-
|
|
9008
|
-
|
|
9009
|
-
|
|
9010
|
-
return step.customAnimate.getMergedEndProps();
|
|
9011
|
-
}
|
|
9012
|
-
step = step.prev;
|
|
9003
|
+
clear(h) {
|
|
9004
|
+
clearTimeout(h);
|
|
9005
|
+
}
|
|
9006
|
+
appendDuration(d) {
|
|
9007
|
+
this.durations.push(d);
|
|
9008
|
+
if (this.durations.length > this.durationsListThreshold) {
|
|
9009
|
+
this.durations.shift();
|
|
9013
9010
|
}
|
|
9014
|
-
|
|
9011
|
+
this.timeout = Math.min(Math.max(this.durations.reduce((a, b) => a + b, 0) / this.durations.length, 1000 / 60), 1000 / 30);
|
|
9015
9012
|
}
|
|
9016
9013
|
}
|
|
9017
|
-
|
|
9018
|
-
const
|
|
9019
|
-
duration: 200,
|
|
9020
|
-
easing: 'cubicOut'
|
|
9021
|
-
};
|
|
9022
|
-
const DefaultMorphingAnimateConfig = {
|
|
9023
|
-
duration: 1000,
|
|
9024
|
-
easing: 'quadInOut'
|
|
9025
|
-
};
|
|
9014
|
+
RafBasedSTO.TimeOut = 1000 / 60;
|
|
9015
|
+
const rafBasedSto = new RafBasedSTO();
|
|
9026
9016
|
|
|
9027
9017
|
class IncreaseCount extends ACustomAnimate {
|
|
9028
9018
|
constructor(from, to, duration, easing, params) {
|
|
@@ -14324,8 +14314,6 @@
|
|
|
14324
14314
|
const TEXT_UPDATE_TAG_KEY = [
|
|
14325
14315
|
'text',
|
|
14326
14316
|
'maxLineWidth',
|
|
14327
|
-
'heightLimit',
|
|
14328
|
-
'lineClamp',
|
|
14329
14317
|
'fontSize',
|
|
14330
14318
|
'fontFamily',
|
|
14331
14319
|
'fontWeight',
|
|
@@ -14410,113 +14398,6 @@
|
|
|
14410
14398
|
this.clearUpdateBoundTag();
|
|
14411
14399
|
return bounds;
|
|
14412
14400
|
}
|
|
14413
|
-
updateWrapAABBBounds(text) {
|
|
14414
|
-
var _a, _b, _c, _d;
|
|
14415
|
-
const textTheme = getTheme(this).text;
|
|
14416
|
-
const { fontFamily = textTheme.fontFamily, textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline, fontSize = textTheme.fontSize, ellipsis = textTheme.ellipsis, maxLineWidth, stroke = textTheme.stroke, lineWidth = textTheme.lineWidth, wordBreak = textTheme.wordBreak, fontWeight = textTheme.fontWeight, ignoreBuf = textTheme.ignoreBuf, heightLimit = 0, lineClamp } = this.attribute;
|
|
14417
|
-
const lineHeight = (_a = calculateLineHeight(this.attribute.lineHeight, this.attribute.fontSize || textTheme.fontSize)) !== null && _a !== void 0 ? _a : (this.attribute.fontSize || textTheme.fontSize);
|
|
14418
|
-
const buf = ignoreBuf ? 0 : 2;
|
|
14419
|
-
if (!this.shouldUpdateShape() && ((_b = this.cache) === null || _b === void 0 ? void 0 : _b.layoutData)) {
|
|
14420
|
-
const bbox = this.cache.layoutData.bbox;
|
|
14421
|
-
this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height);
|
|
14422
|
-
if (stroke) {
|
|
14423
|
-
this._AABBBounds.expand(lineWidth / 2);
|
|
14424
|
-
}
|
|
14425
|
-
return this._AABBBounds;
|
|
14426
|
-
}
|
|
14427
|
-
const textMeasure = application.graphicUtil.textMeasure;
|
|
14428
|
-
const layoutObj = new CanvasTextLayout(fontFamily, { fontSize, fontWeight, fontFamily }, textMeasure);
|
|
14429
|
-
const lines = vutils.isArray(text) ? text.map(l => l.toString()) : [text.toString()];
|
|
14430
|
-
const linesLayout = [];
|
|
14431
|
-
const bboxWH = [0, 0];
|
|
14432
|
-
let lineCountLimit = Infinity;
|
|
14433
|
-
if (heightLimit > 0) {
|
|
14434
|
-
lineCountLimit = Math.max(Math.floor(heightLimit / lineHeight), 1);
|
|
14435
|
-
}
|
|
14436
|
-
if (lineClamp) {
|
|
14437
|
-
lineCountLimit = Math.min(lineCountLimit, lineClamp);
|
|
14438
|
-
}
|
|
14439
|
-
if (typeof maxLineWidth === 'number' && maxLineWidth !== Infinity) {
|
|
14440
|
-
if (maxLineWidth > 0) {
|
|
14441
|
-
for (let i = 0; i < lines.length; i++) {
|
|
14442
|
-
const str = lines[i];
|
|
14443
|
-
let needCut = true;
|
|
14444
|
-
if (i === lineCountLimit - 1) {
|
|
14445
|
-
const clip = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, false);
|
|
14446
|
-
linesLayout.push({
|
|
14447
|
-
str: clip.str,
|
|
14448
|
-
width: clip.width
|
|
14449
|
-
});
|
|
14450
|
-
break;
|
|
14451
|
-
}
|
|
14452
|
-
const clip = layoutObj.textMeasure.clipText(str, layoutObj.textOptions, maxLineWidth, wordBreak === 'break-word');
|
|
14453
|
-
if (str !== '' && clip.str === '') {
|
|
14454
|
-
if (ellipsis) {
|
|
14455
|
-
const clipEllipsis = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, false);
|
|
14456
|
-
clip.str = (_c = clipEllipsis.str) !== null && _c !== void 0 ? _c : '';
|
|
14457
|
-
clip.width = (_d = clipEllipsis.width) !== null && _d !== void 0 ? _d : 0;
|
|
14458
|
-
}
|
|
14459
|
-
else {
|
|
14460
|
-
clip.str = '';
|
|
14461
|
-
clip.width = 0;
|
|
14462
|
-
}
|
|
14463
|
-
needCut = false;
|
|
14464
|
-
}
|
|
14465
|
-
linesLayout.push({
|
|
14466
|
-
str: clip.str,
|
|
14467
|
-
width: clip.width
|
|
14468
|
-
});
|
|
14469
|
-
if (clip.str.length === str.length) ;
|
|
14470
|
-
else if (needCut) {
|
|
14471
|
-
const newStr = str.substring(clip.str.length);
|
|
14472
|
-
lines.splice(i + 1, 0, newStr);
|
|
14473
|
-
}
|
|
14474
|
-
}
|
|
14475
|
-
}
|
|
14476
|
-
let maxWidth = 0;
|
|
14477
|
-
linesLayout.forEach(layout => {
|
|
14478
|
-
maxWidth = Math.max(maxWidth, layout.width);
|
|
14479
|
-
});
|
|
14480
|
-
bboxWH[0] = maxWidth;
|
|
14481
|
-
}
|
|
14482
|
-
else {
|
|
14483
|
-
let lineWidth = 0;
|
|
14484
|
-
let width;
|
|
14485
|
-
let text;
|
|
14486
|
-
for (let i = 0, len = lines.length; i < len; i++) {
|
|
14487
|
-
if (i === lineCountLimit - 1) {
|
|
14488
|
-
const clip = layoutObj.textMeasure.clipTextWithSuffix(lines[i], layoutObj.textOptions, maxLineWidth, ellipsis, false);
|
|
14489
|
-
linesLayout.push({
|
|
14490
|
-
str: clip.str,
|
|
14491
|
-
width: clip.width
|
|
14492
|
-
});
|
|
14493
|
-
lineWidth = Math.max(lineWidth, clip.width);
|
|
14494
|
-
break;
|
|
14495
|
-
}
|
|
14496
|
-
text = lines[i];
|
|
14497
|
-
width = layoutObj.textMeasure.measureTextWidth(text, layoutObj.textOptions, wordBreak === 'break-word');
|
|
14498
|
-
lineWidth = Math.max(lineWidth, width);
|
|
14499
|
-
linesLayout.push({ str: text, width });
|
|
14500
|
-
}
|
|
14501
|
-
bboxWH[0] = lineWidth;
|
|
14502
|
-
}
|
|
14503
|
-
bboxWH[1] = linesLayout.length * (lineHeight + buf);
|
|
14504
|
-
const bbox = {
|
|
14505
|
-
xOffset: 0,
|
|
14506
|
-
yOffset: 0,
|
|
14507
|
-
width: bboxWH[0],
|
|
14508
|
-
height: bboxWH[1]
|
|
14509
|
-
};
|
|
14510
|
-
layoutObj.LayoutBBox(bbox, textAlign, textBaseline);
|
|
14511
|
-
const layoutData = layoutObj.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline, lineHeight);
|
|
14512
|
-
this.cache.layoutData = layoutData;
|
|
14513
|
-
this.clearUpdateShapeTag();
|
|
14514
|
-
this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height);
|
|
14515
|
-
if (stroke) {
|
|
14516
|
-
this._AABBBounds.expand(lineWidth / 2);
|
|
14517
|
-
}
|
|
14518
|
-
return this._AABBBounds;
|
|
14519
|
-
}
|
|
14520
14401
|
updateSingallineAABBBounds(text) {
|
|
14521
14402
|
const textTheme = getTheme(this).text;
|
|
14522
14403
|
const { direction = textTheme.direction } = this.attribute;
|
|
@@ -14538,13 +14419,9 @@
|
|
|
14538
14419
|
let width;
|
|
14539
14420
|
let str;
|
|
14540
14421
|
const attribute = this.attribute;
|
|
14541
|
-
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, wordBreak = textTheme.wordBreak, ignoreBuf = textTheme.ignoreBuf
|
|
14542
|
-
if (whiteSpace === 'normal') {
|
|
14543
|
-
return this.updateWrapAABBBounds(text);
|
|
14544
|
-
}
|
|
14422
|
+
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, wordBreak = textTheme.wordBreak, ignoreBuf = textTheme.ignoreBuf } = attribute;
|
|
14545
14423
|
const buf = ignoreBuf ? 0 : Math.max(2, fontSize * 0.075);
|
|
14546
|
-
const
|
|
14547
|
-
const lineHeight = (_a = calculateLineHeight(attribute.lineHeight, textFontSize)) !== null && _a !== void 0 ? _a : textFontSize + buf;
|
|
14424
|
+
const { lineHeight = (_a = attribute.lineHeight) !== null && _a !== void 0 ? _a : (attribute.fontSize || textTheme.fontSize) + buf } = attribute;
|
|
14548
14425
|
if (!this.shouldUpdateShape() && this.cache) {
|
|
14549
14426
|
width = (_b = this.cache.clipedWidth) !== null && _b !== void 0 ? _b : 0;
|
|
14550
14427
|
const dx = textDrawOffsetX(textAlign, width);
|
|
@@ -14602,8 +14479,7 @@
|
|
|
14602
14479
|
const attribute = this.attribute;
|
|
14603
14480
|
const { ignoreBuf = textTheme.ignoreBuf } = attribute;
|
|
14604
14481
|
const buf = ignoreBuf ? 0 : 2;
|
|
14605
|
-
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;
|
|
14606
|
-
const lineHeight = (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) !== null && _a !== void 0 ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
|
|
14482
|
+
const { maxLineWidth = textTheme.maxLineWidth, ellipsis = textTheme.ellipsis, fontSize = textTheme.fontSize, fontWeight = textTheme.fontWeight, fontFamily = textTheme.fontFamily, stroke = textTheme.stroke, lineHeight = (_a = attribute.lineHeight) !== null && _a !== void 0 ? _a : (attribute.fontSize || textTheme.fontSize) + buf, lineWidth = textTheme.lineWidth, verticalMode = textTheme.verticalMode } = attribute;
|
|
14607
14483
|
let { textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline } = attribute;
|
|
14608
14484
|
if (!verticalMode) {
|
|
14609
14485
|
const t = textAlign;
|
|
@@ -14660,15 +14536,11 @@
|
|
|
14660
14536
|
return this._AABBBounds;
|
|
14661
14537
|
}
|
|
14662
14538
|
updateHorizontalMultilineAABBBounds(text) {
|
|
14663
|
-
var _a
|
|
14539
|
+
var _a;
|
|
14664
14540
|
const textTheme = getTheme(this).text;
|
|
14665
14541
|
const attribute = this.attribute;
|
|
14666
|
-
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,
|
|
14667
|
-
|
|
14668
|
-
if (whiteSpace === 'normal') {
|
|
14669
|
-
return this.updateWrapAABBBounds(text);
|
|
14670
|
-
}
|
|
14671
|
-
if (!this.shouldUpdateShape() && ((_b = this.cache) === null || _b === void 0 ? void 0 : _b.layoutData)) {
|
|
14542
|
+
const { fontFamily = textTheme.fontFamily, textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline, fontSize = textTheme.fontSize, fontWeight = textTheme.fontWeight, lineHeight = attribute.lineHeight || attribute.fontSize || textTheme.fontSize, ellipsis = textTheme.ellipsis, maxLineWidth, stroke = textTheme.stroke, lineWidth = textTheme.lineWidth, wordBreak = textTheme.wordBreak } = attribute;
|
|
14543
|
+
if (!this.shouldUpdateShape() && ((_a = this.cache) === null || _a === void 0 ? void 0 : _a.layoutData)) {
|
|
14672
14544
|
const bbox = this.cache.layoutData.bbox;
|
|
14673
14545
|
this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height);
|
|
14674
14546
|
if (stroke) {
|
|
@@ -14696,8 +14568,7 @@
|
|
|
14696
14568
|
const attribute = this.attribute;
|
|
14697
14569
|
const { ignoreBuf = textTheme.ignoreBuf } = attribute;
|
|
14698
14570
|
const buf = ignoreBuf ? 0 : 2;
|
|
14699
|
-
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;
|
|
14700
|
-
const lineHeight = (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) !== null && _a !== void 0 ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
|
|
14571
|
+
const { maxLineWidth = textTheme.maxLineWidth, ellipsis = textTheme.ellipsis, fontFamily = textTheme.fontFamily, fontSize = textTheme.fontSize, fontWeight = textTheme.fontWeight, stroke = textTheme.stroke, lineHeight = (_a = attribute.lineHeight) !== null && _a !== void 0 ? _a : (attribute.fontSize || textTheme.fontSize) + buf, lineWidth = textTheme.lineWidth, verticalMode = textTheme.verticalMode } = attribute;
|
|
14701
14572
|
let { textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline } = attribute;
|
|
14702
14573
|
if (!verticalMode) {
|
|
14703
14574
|
const t = textAlign;
|
|
@@ -14804,12 +14675,11 @@
|
|
|
14804
14675
|
return text != null && text !== '';
|
|
14805
14676
|
}
|
|
14806
14677
|
updateMultilineAABBBounds(text) {
|
|
14807
|
-
var _a, _b, _c
|
|
14678
|
+
var _a, _b, _c;
|
|
14808
14679
|
const textTheme = getTheme(this).text;
|
|
14809
|
-
const { fontFamily = textTheme.fontFamily, textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline, fontSize = textTheme.fontSize, ellipsis = textTheme.ellipsis, maxLineWidth, stroke = textTheme.stroke, lineWidth = textTheme.lineWidth, wordBreak = textTheme.wordBreak, fontWeight = textTheme.fontWeight, ignoreBuf = textTheme.ignoreBuf, heightLimit = 0, lineClamp } = this.attribute;
|
|
14810
|
-
const lineHeight = (_a = calculateLineHeight(this.attribute.lineHeight, this.attribute.fontSize || textTheme.fontSize)) !== null && _a !== void 0 ? _a : (this.attribute.fontSize || textTheme.fontSize);
|
|
14680
|
+
const { fontFamily = textTheme.fontFamily, textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline, fontSize = textTheme.fontSize, lineHeight = this.attribute.lineHeight || this.attribute.fontSize || textTheme.fontSize, ellipsis = textTheme.ellipsis, maxLineWidth, stroke = textTheme.stroke, lineWidth = textTheme.lineWidth, wordBreak = textTheme.wordBreak, fontWeight = textTheme.fontWeight, ignoreBuf = textTheme.ignoreBuf, heightLimit = 0, lineClamp } = this.attribute;
|
|
14811
14681
|
const buf = ignoreBuf ? 0 : 2;
|
|
14812
|
-
if (!this.shouldUpdateShape() && ((
|
|
14682
|
+
if (!this.shouldUpdateShape() && ((_a = this.cache) === null || _a === void 0 ? void 0 : _a.layoutData)) {
|
|
14813
14683
|
const bbox = this.cache.layoutData.bbox;
|
|
14814
14684
|
this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height);
|
|
14815
14685
|
if (stroke) {
|
|
@@ -14846,8 +14716,8 @@
|
|
|
14846
14716
|
if (str !== '' && clip.str === '') {
|
|
14847
14717
|
if (ellipsis) {
|
|
14848
14718
|
const clipEllipsis = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, false);
|
|
14849
|
-
clip.str = (
|
|
14850
|
-
clip.width = (
|
|
14719
|
+
clip.str = (_b = clipEllipsis.str) !== null && _b !== void 0 ? _b : '';
|
|
14720
|
+
clip.width = (_c = clipEllipsis.width) !== null && _c !== void 0 ? _c : 0;
|
|
14851
14721
|
}
|
|
14852
14722
|
else {
|
|
14853
14723
|
clip.str = '';
|
|
@@ -20991,7 +20861,7 @@
|
|
|
20991
20861
|
textAlign = (_a = text.getBaselineMapAlign()[textBaseline]) !== null && _a !== void 0 ? _a : 'left';
|
|
20992
20862
|
textBaseline = (_b = text.getAlignMapBaseline()[t]) !== null && _b !== void 0 ? _b : 'top';
|
|
20993
20863
|
}
|
|
20994
|
-
const lineHeight = (_c =
|
|
20864
|
+
const lineHeight = (_c = text.attribute.lineHeight) !== null && _c !== void 0 ? _c : fontSize;
|
|
20995
20865
|
const data = this.valid(text, textAttribute, fillCb, strokeCb);
|
|
20996
20866
|
if (!data) {
|
|
20997
20867
|
return;
|
|
@@ -26254,19 +26124,6 @@
|
|
|
26254
26124
|
this.setAttributes({ background: this._background });
|
|
26255
26125
|
}
|
|
26256
26126
|
}
|
|
26257
|
-
preventRender(prevent) {
|
|
26258
|
-
if (prevent) {
|
|
26259
|
-
this._skipRender = -Infinity;
|
|
26260
|
-
}
|
|
26261
|
-
else {
|
|
26262
|
-
if (this.params && this.params.optimize && this.params.optimize.skipRenderWithOutRange !== false) {
|
|
26263
|
-
this._skipRender = this.window.isVisible() ? 0 : 1;
|
|
26264
|
-
}
|
|
26265
|
-
else {
|
|
26266
|
-
this._skipRender = 0;
|
|
26267
|
-
}
|
|
26268
|
-
}
|
|
26269
|
-
}
|
|
26270
26127
|
optmize(params) {
|
|
26271
26128
|
this.optmizeRender(params === null || params === void 0 ? void 0 : params.skipRenderWithOutRange);
|
|
26272
26129
|
}
|
|
@@ -26274,11 +26131,8 @@
|
|
|
26274
26131
|
if (!skipRenderWithOutRange) {
|
|
26275
26132
|
return;
|
|
26276
26133
|
}
|
|
26277
|
-
this._skipRender = this.
|
|
26134
|
+
this._skipRender = this.window.isVisible() ? 0 : 1;
|
|
26278
26135
|
this.window.onVisibleChange(visible => {
|
|
26279
|
-
if (this._skipRender < 0) {
|
|
26280
|
-
return;
|
|
26281
|
-
}
|
|
26282
26136
|
if (visible) {
|
|
26283
26137
|
if (this.dirtyBounds) {
|
|
26284
26138
|
this.dirtyBounds.setValue(0, 0, this._viewBox.width(), this._viewBox.height());
|
|
@@ -27646,7 +27500,6 @@
|
|
|
27646
27500
|
exports.builtinSymbols = builtinSymbols;
|
|
27647
27501
|
exports.builtinSymbolsMap = builtinSymbolsMap;
|
|
27648
27502
|
exports.calcLineCache = calcLineCache$1;
|
|
27649
|
-
exports.calculateLineHeight = calculateLineHeight;
|
|
27650
27503
|
exports.centroidOfSubpath = centroidOfSubpath;
|
|
27651
27504
|
exports.circleBounds = circleBounds;
|
|
27652
27505
|
exports.clock = clock;
|