@visactor/vrender 0.21.0-alpha.11 → 0.21.0-alpha.13
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/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/dist/index.es.js +507 -529
- package/dist/index.js +506 -528
- package/dist/index.min.js +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -595,6 +595,12 @@
|
|
|
595
595
|
get env() {
|
|
596
596
|
return this._env;
|
|
597
597
|
}
|
|
598
|
+
get isImageAnonymous() {
|
|
599
|
+
return this._isImageAnonymous;
|
|
600
|
+
}
|
|
601
|
+
set isImageAnonymous(isImageAnonymous) {
|
|
602
|
+
this._isImageAnonymous = isImageAnonymous;
|
|
603
|
+
}
|
|
598
604
|
get devicePixelRatio() {
|
|
599
605
|
return this._env || this.setEnv("browser"), this.envContribution.getDevicePixelRatio();
|
|
600
606
|
}
|
|
@@ -629,7 +635,7 @@
|
|
|
629
635
|
this._env || this.setEnv("browser"), this.envContribution.applyStyles = support;
|
|
630
636
|
}
|
|
631
637
|
constructor(contributions) {
|
|
632
|
-
this.contributions = contributions, this.id = Generator.GenAutoIncrementId(), this.hooks = {
|
|
638
|
+
this.contributions = contributions, this._isImageAnonymous = !0, this.id = Generator.GenAutoIncrementId(), this.hooks = {
|
|
633
639
|
onSetEnv: new SyncHook(["lastEnv", "env", "global"])
|
|
634
640
|
}, this.measureTextMethod = "native", this.optimizeVisible = !1;
|
|
635
641
|
}
|
|
@@ -748,13 +754,6 @@
|
|
|
748
754
|
};
|
|
749
755
|
exports.DefaultGlobal = __decorate$1H([injectable(), __param$T(0, inject(ContributionProvider)), __param$T(0, named(EnvContribution)), __metadata$1h("design:paramtypes", [Object])], exports.DefaultGlobal);
|
|
750
756
|
|
|
751
|
-
exports.MeasureModeEnum = void 0;
|
|
752
|
-
!function (MeasureModeEnum) {
|
|
753
|
-
MeasureModeEnum[MeasureModeEnum.estimate = 0] = "estimate", MeasureModeEnum[MeasureModeEnum.actualBounding = 1] = "actualBounding", MeasureModeEnum[MeasureModeEnum.fontBounding = 2] = "fontBounding";
|
|
754
|
-
}(exports.MeasureModeEnum || (exports.MeasureModeEnum = {}));
|
|
755
|
-
|
|
756
|
-
const strCommandMap = ["arc", "arcTo", "bezierCurveTo", "closePath", "ellipse", "lineTo", "moveTo", "quadraticCurveTo", "rect"];
|
|
757
|
-
|
|
758
757
|
function getDefaultExportFromCjs (x) {
|
|
759
758
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
760
759
|
}
|
|
@@ -1709,9 +1708,7 @@
|
|
|
1709
1708
|
} = this.textSpec;
|
|
1710
1709
|
return {
|
|
1711
1710
|
width: metrics.width,
|
|
1712
|
-
height: null !== (_a = lineHeight) && void 0 !== _a ? _a : fontSize
|
|
1713
|
-
fontBoundingBoxAscent: metrics.fontBoundingBoxAscent,
|
|
1714
|
-
fontBoundingBoxDescent: metrics.fontBoundingBoxDescent
|
|
1711
|
+
height: null !== (_a = lineHeight) && void 0 !== _a ? _a : fontSize
|
|
1715
1712
|
};
|
|
1716
1713
|
}
|
|
1717
1714
|
quickMeasure(text) {
|
|
@@ -1725,7 +1722,7 @@
|
|
|
1725
1722
|
for (let i = 0; i < text.length; i++) {
|
|
1726
1723
|
const char = text[i];
|
|
1727
1724
|
let size = this._measureSpecialChar(char);
|
|
1728
|
-
isNil$1(size) && TextMeasure.NUMBERS_CHAR_SET.includes(char) && (size = this._measureNumberChar()), isNil$1(size) && ["F", "W"].includes(eastAsianCharacterInfo(char)) && (size = this._measureFullSizeChar()), isNil$1(size) && (size = this._measureLetterChar()), totalSize.width += size.width, totalSize.height = Math.max(totalSize.height, size.height)
|
|
1725
|
+
isNil$1(size) && TextMeasure.NUMBERS_CHAR_SET.includes(char) && (size = this._measureNumberChar()), isNil$1(size) && ["F", "W"].includes(eastAsianCharacterInfo(char)) && (size = this._measureFullSizeChar()), isNil$1(size) && (size = this._measureLetterChar()), totalSize.width += size.width, totalSize.height = Math.max(totalSize.height, size.height);
|
|
1729
1726
|
}
|
|
1730
1727
|
return totalSize;
|
|
1731
1728
|
}
|
|
@@ -1774,9 +1771,7 @@
|
|
|
1774
1771
|
const numberBounds = this._standardMethod(TextMeasure.NUMBERS_CHAR_SET);
|
|
1775
1772
|
this._numberCharSize = {
|
|
1776
1773
|
width: numberBounds.width / TextMeasure.NUMBERS_CHAR_SET.length,
|
|
1777
|
-
height: numberBounds.height
|
|
1778
|
-
fontBoundingBoxAscent: numberBounds.fontBoundingBoxAscent,
|
|
1779
|
-
fontBoundingBoxDescent: numberBounds.fontBoundingBoxDescent
|
|
1774
|
+
height: numberBounds.height
|
|
1780
1775
|
};
|
|
1781
1776
|
}
|
|
1782
1777
|
return this._numberCharSize;
|
|
@@ -1789,9 +1784,7 @@
|
|
|
1789
1784
|
const alphabetBounds = this._standardMethod(TextMeasure.ALPHABET_CHAR_SET);
|
|
1790
1785
|
this._letterCharSize = {
|
|
1791
1786
|
width: alphabetBounds.width / TextMeasure.ALPHABET_CHAR_SET.length,
|
|
1792
|
-
height: alphabetBounds.height
|
|
1793
|
-
fontBoundingBoxAscent: alphabetBounds.fontBoundingBoxAscent,
|
|
1794
|
-
fontBoundingBoxDescent: alphabetBounds.fontBoundingBoxDescent
|
|
1787
|
+
height: alphabetBounds.height
|
|
1795
1788
|
};
|
|
1796
1789
|
}
|
|
1797
1790
|
return this._letterCharSize;
|
|
@@ -3932,7 +3925,6 @@
|
|
|
3932
3925
|
const DefaultTextStyle = {
|
|
3933
3926
|
text: "",
|
|
3934
3927
|
maxLineWidth: 1 / 0,
|
|
3935
|
-
maxWidth: 1 / 0,
|
|
3936
3928
|
textAlign: "left",
|
|
3937
3929
|
textBaseline: "alphabetic",
|
|
3938
3930
|
fontSize: 16,
|
|
@@ -3956,9 +3948,7 @@
|
|
|
3956
3948
|
suffixPosition: "end",
|
|
3957
3949
|
underlineDash: [],
|
|
3958
3950
|
underlineOffset: 0,
|
|
3959
|
-
disableAutoClipedPoptip: void 0
|
|
3960
|
-
measureMode: exports.MeasureModeEnum.fontBounding,
|
|
3961
|
-
keepCenterInLine: !1
|
|
3951
|
+
disableAutoClipedPoptip: void 0
|
|
3962
3952
|
};
|
|
3963
3953
|
const DefaultPickStyle = {
|
|
3964
3954
|
pickStrokeBuffer: 0
|
|
@@ -4012,8 +4002,7 @@
|
|
|
4012
4002
|
globalZIndex: 1,
|
|
4013
4003
|
globalCompositeOperation: "",
|
|
4014
4004
|
overflow: "hidden",
|
|
4015
|
-
shadowPickMode: "graphic"
|
|
4016
|
-
keepStrokeScale: !1
|
|
4005
|
+
shadowPickMode: "graphic"
|
|
4017
4006
|
}, DefaultDebugAttribute), DefaultStyle), DefaultTransform);
|
|
4018
4007
|
function addAttributeToPrototype(obj, c, keys) {
|
|
4019
4008
|
keys.forEach(key => {
|
|
@@ -4288,32 +4277,10 @@
|
|
|
4288
4277
|
configure(service, env) {
|
|
4289
4278
|
this.canvas = service.canvas, this.context = service.context, service.bindTextMeasure(this);
|
|
4290
4279
|
}
|
|
4291
|
-
|
|
4280
|
+
measureTextWidth(text, options) {
|
|
4281
|
+
if (!this.context) return this.estimate(text, options).width;
|
|
4292
4282
|
this.context.setTextStyleWithoutAlignBaseline(options);
|
|
4293
|
-
|
|
4294
|
-
return compatible ? this.compatibleMetrics(metrics, options) : metrics;
|
|
4295
|
-
}
|
|
4296
|
-
_measureTextWithAlignBaseline(text, options, compatible) {
|
|
4297
|
-
this.context.setTextStyle(options);
|
|
4298
|
-
const metrics = this.context.measureText(text);
|
|
4299
|
-
return compatible ? this.compatibleMetrics(metrics, options) : metrics;
|
|
4300
|
-
}
|
|
4301
|
-
compatibleMetrics(metrics, options) {
|
|
4302
|
-
if (null == metrics.actualBoundingBoxAscent || null == metrics.actualBoundingBoxDescent || null == metrics.fontBoundingBoxAscent || null == metrics.fontBoundingBoxDescent) {
|
|
4303
|
-
const {
|
|
4304
|
-
ascent: ascent,
|
|
4305
|
-
descent: descent
|
|
4306
|
-
} = this.measureTextBoundADscentEstimate(options);
|
|
4307
|
-
metrics.actualBoundingBoxAscent = ascent, metrics.actualBoundingBoxDescent = descent, metrics.fontBoundingBoxAscent = ascent, metrics.fontBoundingBoxDescent = descent;
|
|
4308
|
-
}
|
|
4309
|
-
if (null == metrics.actualBoundingBoxLeft || null == metrics.actualBoundingBoxRight) {
|
|
4310
|
-
const {
|
|
4311
|
-
left: left,
|
|
4312
|
-
right: right
|
|
4313
|
-
} = this.measureTextBoundLeftRightEstimate(options);
|
|
4314
|
-
metrics.actualBoundingBoxLeft = left, metrics.actualBoundingBoxRight = right;
|
|
4315
|
-
}
|
|
4316
|
-
return metrics;
|
|
4283
|
+
return this.context.measureText(text).width;
|
|
4317
4284
|
}
|
|
4318
4285
|
estimate(text, _ref) {
|
|
4319
4286
|
let {
|
|
@@ -4327,97 +4294,19 @@
|
|
|
4327
4294
|
height: fontSize
|
|
4328
4295
|
};
|
|
4329
4296
|
}
|
|
4330
|
-
|
|
4331
|
-
return this.context ? (textMeasure = null != textMeasure ? textMeasure : this._measureTextWithoutAlignBaseline(text, options)).width : this.estimate(text, options).width;
|
|
4332
|
-
}
|
|
4333
|
-
measureTextBoundsWidth(text, options, textMeasure) {
|
|
4334
|
-
return this.context ? (textMeasure = null != textMeasure ? textMeasure : this._measureTextWithoutAlignBaseline(text, options)).width : this.estimate(text, options).width;
|
|
4335
|
-
}
|
|
4336
|
-
measureTextBoundsLeftRight(text, options, textMeasure) {
|
|
4337
|
-
return this.context ? {
|
|
4338
|
-
left: (textMeasure = null != textMeasure ? textMeasure : this._measureTextWithAlignBaseline(text, options, !0)).actualBoundingBoxLeft,
|
|
4339
|
-
right: textMeasure.actualBoundingBoxRight
|
|
4340
|
-
} : this.measureTextBoundLeftRightEstimate(options);
|
|
4341
|
-
}
|
|
4342
|
-
measureTextPixelHeight(text, options, textMeasure) {
|
|
4343
|
-
var _a;
|
|
4344
|
-
return this.context ? (textMeasure = null != textMeasure ? textMeasure : this._measureTextWithoutAlignBaseline(text, options, !0), Math.abs(textMeasure.actualBoundingBoxAscent - textMeasure.actualBoundingBoxDescent)) : null !== (_a = options.fontSize) && void 0 !== _a ? _a : DefaultTextStyle.fontSize;
|
|
4345
|
-
}
|
|
4346
|
-
measureTextPixelADscent(text, options, textMeasure) {
|
|
4347
|
-
return this.context ? {
|
|
4348
|
-
ascent: (textMeasure = null != textMeasure ? textMeasure : this._measureTextWithAlignBaseline(text, options, !0)).actualBoundingBoxAscent,
|
|
4349
|
-
descent: textMeasure.actualBoundingBoxDescent
|
|
4350
|
-
} : this.measureTextBoundADscentEstimate(options);
|
|
4351
|
-
}
|
|
4352
|
-
measureTextBoundHieght(text, options, textMeasure) {
|
|
4297
|
+
measureTextPixelHeight(text, options) {
|
|
4353
4298
|
var _a;
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
return
|
|
4358
|
-
ascent: (textMeasure = null != textMeasure ? textMeasure : this._measureTextWithAlignBaseline(text, options, !0)).fontBoundingBoxAscent,
|
|
4359
|
-
descent: textMeasure.fontBoundingBoxDescent
|
|
4360
|
-
} : this.measureTextBoundADscentEstimate(options);
|
|
4361
|
-
}
|
|
4362
|
-
measureTextBoundADscentEstimate(options) {
|
|
4363
|
-
var _a;
|
|
4364
|
-
const fontSize = null !== (_a = options.fontSize) && void 0 !== _a ? _a : DefaultTextStyle.fontSize;
|
|
4365
|
-
return {
|
|
4366
|
-
ascent: .79 * fontSize,
|
|
4367
|
-
descent: .21 * fontSize
|
|
4368
|
-
};
|
|
4299
|
+
if (!this.context) return null !== (_a = options.fontSize) && void 0 !== _a ? _a : DefaultTextStyle.fontSize;
|
|
4300
|
+
this.context.setTextStyleWithoutAlignBaseline(options);
|
|
4301
|
+
const textMeasure = this.context.measureText(text);
|
|
4302
|
+
return Math.abs(textMeasure.actualBoundingBoxAscent - textMeasure.actualBoundingBoxDescent);
|
|
4369
4303
|
}
|
|
4370
|
-
|
|
4304
|
+
measureTextBoundHieght(text, options) {
|
|
4371
4305
|
var _a;
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
return "center" === textAlign ? {
|
|
4377
|
-
left: fontSize / 2,
|
|
4378
|
-
right: fontSize / 2
|
|
4379
|
-
} : "right" === textAlign || "end" === textAlign ? {
|
|
4380
|
-
left: fontSize,
|
|
4381
|
-
right: 0
|
|
4382
|
-
} : {
|
|
4383
|
-
left: 0,
|
|
4384
|
-
right: fontSize
|
|
4385
|
-
};
|
|
4386
|
-
}
|
|
4387
|
-
measureTextPixelADscentAndWidth(text, options, mode) {
|
|
4388
|
-
if (!this.context) return Object.assign(Object.assign({}, this.measureTextBoundADscentEstimate(options)), {
|
|
4389
|
-
width: this.estimate(text, options).width
|
|
4390
|
-
});
|
|
4391
|
-
const out = this._measureTextWithoutAlignBaseline(text, options, !0);
|
|
4392
|
-
if (mode === exports.MeasureModeEnum.actualBounding) return {
|
|
4393
|
-
ascent: out.actualBoundingBoxAscent,
|
|
4394
|
-
descent: out.actualBoundingBoxDescent,
|
|
4395
|
-
width: out.width
|
|
4396
|
-
};
|
|
4397
|
-
if (mode === exports.MeasureModeEnum.estimate) return Object.assign(Object.assign({}, this.measureTextBoundADscentEstimate(options)), {
|
|
4398
|
-
width: out.width
|
|
4399
|
-
});
|
|
4400
|
-
if (mode === exports.MeasureModeEnum.fontBounding) {
|
|
4401
|
-
let ascent = out.fontBoundingBoxAscent,
|
|
4402
|
-
descent = out.fontBoundingBoxDescent;
|
|
4403
|
-
if (out.actualBoundingBoxDescent && descent < out.actualBoundingBoxDescent) {
|
|
4404
|
-
const delta = out.actualBoundingBoxDescent - descent;
|
|
4405
|
-
descent += delta, ascent -= delta;
|
|
4406
|
-
} else if (out.actualBoundingBoxAscent && ascent < out.actualBoundingBoxAscent) {
|
|
4407
|
-
const delta = out.actualBoundingBoxAscent - ascent;
|
|
4408
|
-
ascent += delta, descent -= delta;
|
|
4409
|
-
}
|
|
4410
|
-
return {
|
|
4411
|
-
ascent: ascent,
|
|
4412
|
-
descent: descent,
|
|
4413
|
-
width: out.width
|
|
4414
|
-
};
|
|
4415
|
-
}
|
|
4416
|
-
return {
|
|
4417
|
-
ascent: out.actualBoundingBoxAscent,
|
|
4418
|
-
descent: out.actualBoundingBoxDescent,
|
|
4419
|
-
width: out.width
|
|
4420
|
-
};
|
|
4306
|
+
if (!this.context) return null !== (_a = options.fontSize) && void 0 !== _a ? _a : DefaultTextStyle.fontSize;
|
|
4307
|
+
this.context.setTextStyleWithoutAlignBaseline(options);
|
|
4308
|
+
const textMeasure = this.context.measureText(text);
|
|
4309
|
+
return Math.abs(textMeasure.fontBoundingBoxAscent - textMeasure.fontBoundingBoxDescent);
|
|
4421
4310
|
}
|
|
4422
4311
|
measureText(text, options) {
|
|
4423
4312
|
return this.context ? (this.context.setTextStyleWithoutAlignBaseline(options), this.context.measureText(text)) : this.estimate(text, options);
|
|
@@ -6529,7 +6418,7 @@
|
|
|
6529
6418
|
}
|
|
6530
6419
|
}
|
|
6531
6420
|
|
|
6532
|
-
class DefaultTicker
|
|
6421
|
+
class DefaultTicker {
|
|
6533
6422
|
set mode(m) {
|
|
6534
6423
|
this._mode !== m && (this._mode = m, this.setupTickHandler());
|
|
6535
6424
|
}
|
|
@@ -6538,17 +6427,17 @@
|
|
|
6538
6427
|
}
|
|
6539
6428
|
constructor() {
|
|
6540
6429
|
let timelines = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
6541
|
-
|
|
6430
|
+
this.handleTick = (handler, params) => {
|
|
6542
6431
|
const {
|
|
6543
6432
|
once = !1
|
|
6544
6433
|
} = null != params ? params : {};
|
|
6545
|
-
this.ifCanStop() ? this.stop() : (this._handlerTick(), once || handler.tick(this.interval, this.handleTick));
|
|
6546
|
-
}, this._handlerTick =
|
|
6434
|
+
this.ifCanStop() ? this.stop() : (this._handlerTick(handler), once || handler.tick(this.interval, this.handleTick));
|
|
6435
|
+
}, this._handlerTick = handler => {
|
|
6547
6436
|
const time = this.tickerHandler.getTime();
|
|
6548
6437
|
let delta = 0;
|
|
6549
6438
|
this.lastFrameTime >= 0 && (delta = time - this.lastFrameTime), this.lastFrameTime = time, this.status === STATUS$1.RUNNING && (this.tickCounts++, this.timelines.forEach(t => {
|
|
6550
6439
|
t.tick(delta);
|
|
6551
|
-
})
|
|
6440
|
+
}));
|
|
6552
6441
|
}, this.init(), this.lastFrameTime = -1, this.tickCounts = 0, this.timelines = timelines, this.autoStop = !0;
|
|
6553
6442
|
}
|
|
6554
6443
|
init() {
|
|
@@ -6644,9 +6533,6 @@
|
|
|
6644
6533
|
stop() {
|
|
6645
6534
|
this.status = STATUS$1.INITIAL, this.setupTickHandler(), this.lastFrameTime = -1;
|
|
6646
6535
|
}
|
|
6647
|
-
trySyncTickStatus() {
|
|
6648
|
-
this.status === STATUS$1.RUNNING && this._handlerTick();
|
|
6649
|
-
}
|
|
6650
6536
|
}
|
|
6651
6537
|
|
|
6652
6538
|
class ManualTickHandler {
|
|
@@ -7788,7 +7674,7 @@
|
|
|
7788
7674
|
lastMatchedIndex = i, lastMatchedPoint = tagMap.get(this.toPoints[i].context);
|
|
7789
7675
|
break;
|
|
7790
7676
|
}
|
|
7791
|
-
"clip" === this.newPointAnimateType && 0 !== this.toPoints.length && (Number.isFinite(lastMatchedIndex) ? (this.clipRange = this.toPoints[lastMatchedIndex][this.clipRangeByDimension] / this.toPoints[this.toPoints.length - 1][this.clipRangeByDimension],
|
|
7677
|
+
"clip" === this.newPointAnimateType && 0 !== this.toPoints.length && (Number.isFinite(lastMatchedIndex) ? (this.clipRange = this.toPoints[lastMatchedIndex][this.clipRangeByDimension] / this.toPoints[this.toPoints.length - 1][this.clipRangeByDimension], isValidNumber$1(this.clipRange) ? this.clipRange = clamp$1(this.clipRange, 0, 1) : this.clipRange = 0) : this.clipRange = 0);
|
|
7792
7678
|
let prevMatchedPoint = this.toPoints[0];
|
|
7793
7679
|
this.interpolatePoints = this.toPoints.map((point, index) => {
|
|
7794
7680
|
const matchedPoint = tagMap.get(point.context);
|
|
@@ -7800,19 +7686,11 @@
|
|
|
7800
7686
|
return newPoint.defined = toPoint.defined, newPoint.context = toPoint.context, newPoint;
|
|
7801
7687
|
});
|
|
7802
7688
|
}
|
|
7803
|
-
onFirstRun() {
|
|
7804
|
-
const lastClipRange = this.target.attribute.clipRange;
|
|
7805
|
-
isValidNumber$1(lastClipRange * this.clipRange) && (this.clipRange *= lastClipRange);
|
|
7806
|
-
}
|
|
7807
7689
|
onUpdate(end, ratio, out) {
|
|
7808
7690
|
if (this.points = this.points.map((point, index) => {
|
|
7809
7691
|
const newPoint = pointInterpolation(this.interpolatePoints[index][0], this.interpolatePoints[index][1], ratio);
|
|
7810
7692
|
return newPoint.context = point.context, newPoint;
|
|
7811
|
-
}), this.clipRange) {
|
|
7812
|
-
if (this.shrinkClipRange) return void (end ? (out.points = this.toPoints, out.clipRange = 1) : (out.points = this.fromPoints, out.clipRange = this.clipRange - (this.clipRange - this.shrinkClipRange) * ratio));
|
|
7813
|
-
out.clipRange = this.clipRange + (1 - this.clipRange) * ratio;
|
|
7814
|
-
}
|
|
7815
|
-
if (this.segmentsCache && this.to.segments) {
|
|
7693
|
+
}), this.clipRange && (out.clipRange = this.clipRange + (1 - this.clipRange) * ratio), this.segmentsCache && this.to.segments) {
|
|
7816
7694
|
let start = 0;
|
|
7817
7695
|
out.segments = this.to.segments.map((segment, index) => {
|
|
7818
7696
|
const end = start + this.segmentsCache[index],
|
|
@@ -9228,7 +9106,7 @@
|
|
|
9228
9106
|
}
|
|
9229
9107
|
static GetFile(url, type) {
|
|
9230
9108
|
let data = ResourceLoader.cache.get(url);
|
|
9231
|
-
return data ? "
|
|
9109
|
+
return data ? "fail" === data.loadState ? Promise.reject() : "init" === data.loadState || "loading" === data.loadState ? data.dataPromise.then(data => data.data) : Promise.resolve(data.data) : (data = {
|
|
9232
9110
|
type: type,
|
|
9233
9111
|
loadState: "init"
|
|
9234
9112
|
}, 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));
|
|
@@ -12166,8 +12044,7 @@
|
|
|
12166
12044
|
x: originX = arcAttribute.x,
|
|
12167
12045
|
y: originY = arcAttribute.y,
|
|
12168
12046
|
scaleX = arcAttribute.scaleX,
|
|
12169
|
-
scaleY = arcAttribute.scaleY
|
|
12170
|
-
keepStrokeScale = arcAttribute.keepStrokeScale
|
|
12047
|
+
scaleY = arcAttribute.scaleY
|
|
12171
12048
|
} = arc.attribute;
|
|
12172
12049
|
let {
|
|
12173
12050
|
innerRadius = arcAttribute.innerRadius,
|
|
@@ -12179,7 +12056,7 @@
|
|
|
12179
12056
|
{
|
|
12180
12057
|
distance = arcAttribute[key].distance
|
|
12181
12058
|
} = borderStyle,
|
|
12182
|
-
d =
|
|
12059
|
+
d = getScaledStroke(context, distance, context.dpr),
|
|
12183
12060
|
deltaAngle = distance / outerRadius,
|
|
12184
12061
|
sign = "outerBorder" === key ? 1 : -1;
|
|
12185
12062
|
if (arc.setAttributes({
|
|
@@ -12224,15 +12101,14 @@
|
|
|
12224
12101
|
x: originX = circleAttribute.x,
|
|
12225
12102
|
y: originY = circleAttribute.y,
|
|
12226
12103
|
scaleX = circleAttribute.scaleX,
|
|
12227
|
-
scaleY = circleAttribute.scaleY
|
|
12228
|
-
keepStrokeScale = circleAttribute.keepStrokeScale
|
|
12104
|
+
scaleY = circleAttribute.scaleY
|
|
12229
12105
|
} = circle.attribute,
|
|
12230
12106
|
renderBorder = (borderStyle, key) => {
|
|
12231
12107
|
const doStroke = !(!borderStyle || !borderStyle.stroke),
|
|
12232
12108
|
{
|
|
12233
12109
|
distance = circleAttribute[key].distance
|
|
12234
12110
|
} = borderStyle,
|
|
12235
|
-
d =
|
|
12111
|
+
d = getScaledStroke(context, distance, context.dpr),
|
|
12236
12112
|
sign = "outerBorder" === key ? 1 : -1;
|
|
12237
12113
|
if (context.beginPath(), context.arc(x, y, radius + sign * d, startAngle, endAngle), context.closePath(), context.setShadowBlendStyle && context.setShadowBlendStyle(circle, circle.attribute, circleAttribute), strokeCb) strokeCb(context, borderStyle, circleAttribute[key]);else if (doStroke) {
|
|
12238
12114
|
const lastOpacity = circleAttribute[key].opacity;
|
|
@@ -12351,8 +12227,7 @@
|
|
|
12351
12227
|
scaleX = rectAttribute.scaleX,
|
|
12352
12228
|
scaleY = rectAttribute.scaleY,
|
|
12353
12229
|
x1: x1,
|
|
12354
|
-
y1: y1
|
|
12355
|
-
keepStrokeScale = rectAttribute.keepStrokeScale
|
|
12230
|
+
y1: y1
|
|
12356
12231
|
} = rect.attribute;
|
|
12357
12232
|
let {
|
|
12358
12233
|
width: width,
|
|
@@ -12365,7 +12240,7 @@
|
|
|
12365
12240
|
{
|
|
12366
12241
|
distance = rectAttribute[key].distance
|
|
12367
12242
|
} = borderStyle,
|
|
12368
|
-
d =
|
|
12243
|
+
d = getScaledStroke(context, distance, context.dpr),
|
|
12369
12244
|
nextX = x + sign * d,
|
|
12370
12245
|
nextY = y + sign * d,
|
|
12371
12246
|
dw = 2 * d;
|
|
@@ -12495,8 +12370,9 @@
|
|
|
12495
12370
|
constructor() {
|
|
12496
12371
|
super(...arguments), this.time = exports.BaseRenderContributionTime.afterFillStroke, this.useStyle = !0, this.order = 0;
|
|
12497
12372
|
}
|
|
12498
|
-
drawShape(
|
|
12499
|
-
return super.drawShape(
|
|
12373
|
+
drawShape(image, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb) {
|
|
12374
|
+
if (!(image.isGifImage && image.renderFrame && image.playing)) return super.drawShape(image, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb);
|
|
12375
|
+
image.renderFrame(context, x, y);
|
|
12500
12376
|
}
|
|
12501
12377
|
}
|
|
12502
12378
|
const defaultImageRenderContribution = new DefaultImageRenderContribution();
|
|
@@ -12522,15 +12398,14 @@
|
|
|
12522
12398
|
x: originX = symbolAttribute.x,
|
|
12523
12399
|
y: originY = symbolAttribute.y,
|
|
12524
12400
|
scaleX = symbolAttribute.scaleX,
|
|
12525
|
-
scaleY = symbolAttribute.scaleY
|
|
12526
|
-
keepStrokeScale = symbolAttribute.keepStrokeScale
|
|
12401
|
+
scaleY = symbolAttribute.scaleY
|
|
12527
12402
|
} = symbol.attribute,
|
|
12528
12403
|
renderBorder = (borderStyle, key) => {
|
|
12529
12404
|
const doStroke = !(!borderStyle || !borderStyle.stroke),
|
|
12530
12405
|
{
|
|
12531
12406
|
distance = symbolAttribute[key].distance
|
|
12532
12407
|
} = borderStyle,
|
|
12533
|
-
d =
|
|
12408
|
+
d = getScaledStroke(context, distance, context.dpr),
|
|
12534
12409
|
sign = "outerBorder" === key ? 1 : -1;
|
|
12535
12410
|
if (context.beginPath(), !1 === parsedPath.drawOffset(context, size, x, y, sign * d) && context.closePath(), context.setShadowBlendStyle && context.setShadowBlendStyle(symbol, symbol.attribute, symbolAttribute), strokeCb) strokeCb(context, borderStyle, symbolAttribute[key]);else if (doStroke) {
|
|
12536
12411
|
const lastOpacity = symbolAttribute[key].opacity;
|
|
@@ -13808,8 +13683,16 @@
|
|
|
13808
13683
|
verticalMode = textAttribute.verticalMode,
|
|
13809
13684
|
x: originX = textAttribute.x,
|
|
13810
13685
|
y: originY = textAttribute.y
|
|
13811
|
-
} = text.attribute
|
|
13812
|
-
|
|
13686
|
+
} = text.attribute;
|
|
13687
|
+
let {
|
|
13688
|
+
textAlign = textAttribute.textAlign,
|
|
13689
|
+
textBaseline = textAttribute.textBaseline
|
|
13690
|
+
} = text.attribute;
|
|
13691
|
+
if (!verticalMode && "vertical" === direction) {
|
|
13692
|
+
const t = textAlign;
|
|
13693
|
+
textAlign = null !== (_a = text.getBaselineMapAlign()[textBaseline]) && void 0 !== _a ? _a : "left", textBaseline = null !== (_b = text.getAlignMapBaseline()[t]) && void 0 !== _b ? _b : "top";
|
|
13694
|
+
}
|
|
13695
|
+
const lineHeight = null !== (_c = calculateLineHeight(text.attribute.lineHeight, fontSize)) && void 0 !== _c ? _c : fontSize,
|
|
13813
13696
|
data = this.valid(text, textAttribute, fillCb, strokeCb);
|
|
13814
13697
|
if (!data) return;
|
|
13815
13698
|
const {
|
|
@@ -13829,60 +13712,79 @@
|
|
|
13829
13712
|
const matrix = matrixAllocate.allocate(1, 0, 0, 1, 0, 0);
|
|
13830
13713
|
matrix.rotateByCenter(Math.PI / 2, _x, _y), context.transformFromMatrix(matrix, !0), matrixAllocate.free(matrix);
|
|
13831
13714
|
}
|
|
13832
|
-
doStroke && (strokeCb ? strokeCb(context, text.attribute, textAttribute) : sVisible && (context.setStrokeStyle(text, text.attribute, originX - x, originY - y, textAttribute), context.strokeText(t, _x, _y, z))), doFill && (fillCb ? fillCb(context, text.attribute, textAttribute) : fVisible && (context.setCommonStyle(text, text.attribute, originX - x, originY - y, textAttribute), context.fillText(t, _x, _y, z))), direction && (context.highPerformanceRestore(), context.setTransformForCurrent());
|
|
13715
|
+
doStroke && (strokeCb ? strokeCb(context, text.attribute, textAttribute) : sVisible && (context.setStrokeStyle(text, text.attribute, originX - x, originY - y, textAttribute), context.strokeText(t, _x, _y, z))), doFill && (fillCb ? fillCb(context, text.attribute, textAttribute) : fVisible && (context.setCommonStyle(text, text.attribute, originX - x, originY - y, textAttribute), context.fillText(t, _x, _y, z), this.drawUnderLine(underline, lineThrough, text, _x, _y, z, textAttribute, context))), direction && (context.highPerformanceRestore(), context.setTransformForCurrent());
|
|
13833
13716
|
};
|
|
13834
|
-
if (
|
|
13835
|
-
|
|
13836
|
-
|
|
13837
|
-
|
|
13838
|
-
|
|
13839
|
-
|
|
13840
|
-
|
|
13841
|
-
|
|
13842
|
-
|
|
13843
|
-
|
|
13844
|
-
context
|
|
13845
|
-
|
|
13846
|
-
|
|
13847
|
-
|
|
13717
|
+
if (text.isMultiLine) {
|
|
13718
|
+
if (context.setTextStyleWithoutAlignBaseline(text.attribute, textAttribute, z), "horizontal" === direction) {
|
|
13719
|
+
const {
|
|
13720
|
+
multilineLayout: multilineLayout
|
|
13721
|
+
} = text;
|
|
13722
|
+
if (!multilineLayout) return void context.highPerformanceRestore();
|
|
13723
|
+
const {
|
|
13724
|
+
xOffset: xOffset,
|
|
13725
|
+
yOffset: yOffset
|
|
13726
|
+
} = multilineLayout.bbox;
|
|
13727
|
+
doStroke && (strokeCb ? strokeCb(context, text.attribute, textAttribute) : sVisible && (context.setStrokeStyle(text, text.attribute, originX - x, originY - y, textAttribute), multilineLayout.lines.forEach(line => {
|
|
13728
|
+
context.strokeText(line.str, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y, z);
|
|
13729
|
+
}))), doFill && (fillCb ? fillCb(context, text.attribute, textAttribute) : fVisible && (context.setCommonStyle(text, text.attribute, originX - x, originY - y, textAttribute), multilineLayout.lines.forEach(line => {
|
|
13730
|
+
context.fillText(line.str, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y, z), this.drawUnderLine(underline, lineThrough, text, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y - textDrawOffsetY("bottom", fontSize) - .05 * fontSize, z, textAttribute, context, {
|
|
13731
|
+
width: line.width
|
|
13732
|
+
});
|
|
13733
|
+
})));
|
|
13734
|
+
} else {
|
|
13735
|
+
text.tryUpdateAABBBounds();
|
|
13736
|
+
const cache = text.cache,
|
|
13737
|
+
{
|
|
13738
|
+
verticalList: verticalList
|
|
13739
|
+
} = cache;
|
|
13740
|
+
context.textAlign = "left", context.textBaseline = "top";
|
|
13741
|
+
const totalHeight = lineHeight * verticalList.length;
|
|
13742
|
+
let totalW = 0;
|
|
13743
|
+
verticalList.forEach(verticalData => {
|
|
13744
|
+
const _w = verticalData.reduce((a, b) => a + (b.width || 0), 0);
|
|
13745
|
+
totalW = max(_w, totalW);
|
|
13746
|
+
});
|
|
13747
|
+
let offsetY = 0,
|
|
13748
|
+
offsetX = 0;
|
|
13749
|
+
"bottom" === textBaseline ? offsetX = -totalHeight : "middle" === textBaseline && (offsetX = -totalHeight / 2), "center" === textAlign ? offsetY -= totalW / 2 : "right" === textAlign && (offsetY -= totalW), verticalList.forEach((verticalData, i) => {
|
|
13750
|
+
const currentW = verticalData.reduce((a, b) => a + (b.width || 0), 0),
|
|
13751
|
+
dw = totalW - currentW;
|
|
13752
|
+
let currentOffsetY = offsetY;
|
|
13753
|
+
"center" === textAlign ? currentOffsetY += dw / 2 : "right" === textAlign && (currentOffsetY += dw), verticalData.forEach(item => {
|
|
13754
|
+
const {
|
|
13755
|
+
text: text,
|
|
13756
|
+
width: width,
|
|
13757
|
+
direction: direction
|
|
13758
|
+
} = item;
|
|
13759
|
+
drawText(text, totalHeight - (i + 1) * lineHeight + offsetX, currentOffsetY, direction), currentOffsetY += width;
|
|
13760
|
+
});
|
|
13848
13761
|
});
|
|
13849
|
-
})));
|
|
13850
|
-
} else {
|
|
13851
|
-
let {
|
|
13852
|
-
textAlign = textAttribute.textAlign,
|
|
13853
|
-
textBaseline = textAttribute.textBaseline
|
|
13854
|
-
} = text.attribute;
|
|
13855
|
-
if (!verticalMode) {
|
|
13856
|
-
const t = textAlign;
|
|
13857
|
-
textAlign = null !== (_b = text.getBaselineMapAlign()[textBaseline]) && void 0 !== _b ? _b : "left", textBaseline = null !== (_c = text.getAlignMapBaseline()[t]) && void 0 !== _c ? _c : "top";
|
|
13858
13762
|
}
|
|
13763
|
+
} else if ("horizontal" === direction) {
|
|
13764
|
+
context.setTextStyle(text.attribute, textAttribute, z);
|
|
13765
|
+
const t = text.clipedText;
|
|
13766
|
+
let dy = 0;
|
|
13767
|
+
lineHeight !== fontSize && ("top" === textBaseline ? dy = (lineHeight - fontSize) / 2 : "middle" === textBaseline || "bottom" === textBaseline && (dy = -(lineHeight - fontSize) / 2)), drawText(t, 0, dy, 0);
|
|
13768
|
+
} else {
|
|
13859
13769
|
text.tryUpdateAABBBounds();
|
|
13860
|
-
const cache = text.cache
|
|
13861
|
-
|
|
13770
|
+
const cache = text.cache;
|
|
13771
|
+
if (cache) {
|
|
13772
|
+
context.setTextStyleWithoutAlignBaseline(text.attribute, textAttribute, z);
|
|
13773
|
+
const {
|
|
13862
13774
|
verticalList: verticalList
|
|
13863
13775
|
} = cache;
|
|
13864
|
-
|
|
13865
|
-
|
|
13866
|
-
|
|
13867
|
-
|
|
13868
|
-
const _w = verticalData.reduce((a, b) => a + (b.width || 0), 0);
|
|
13869
|
-
totalW = max(_w, totalW);
|
|
13870
|
-
});
|
|
13871
|
-
let offsetY = 0,
|
|
13872
|
-
offsetX = 0;
|
|
13873
|
-
"bottom" === textBaseline ? offsetX = -totalHeight : "middle" === textBaseline && (offsetX = -totalHeight / 2), "center" === textAlign ? offsetY -= totalW / 2 : "right" === textAlign && (offsetY -= totalW), verticalList.forEach((verticalData, i) => {
|
|
13874
|
-
const currentW = verticalData.reduce((a, b) => a + (b.width || 0), 0),
|
|
13875
|
-
dw = totalW - currentW;
|
|
13876
|
-
let currentOffsetY = offsetY;
|
|
13877
|
-
"center" === textAlign ? currentOffsetY += dw / 2 : "right" === textAlign && (currentOffsetY += dw), verticalData.forEach(item => {
|
|
13776
|
+
let offsetY = 0;
|
|
13777
|
+
const totalW = verticalList[0].reduce((a, b) => a + (b.width || 0), 0);
|
|
13778
|
+
let offsetX = 0;
|
|
13779
|
+
"bottom" === textBaseline ? offsetX = -lineHeight : "middle" === textBaseline && (offsetX = -lineHeight / 2), "center" === textAlign ? offsetY -= totalW / 2 : "right" === textAlign && (offsetY -= totalW), context.textAlign = "left", context.textBaseline = "top", verticalList[0].forEach(item => {
|
|
13878
13780
|
const {
|
|
13879
13781
|
text: text,
|
|
13880
13782
|
width: width,
|
|
13881
13783
|
direction: direction
|
|
13882
13784
|
} = item;
|
|
13883
|
-
drawText(text,
|
|
13785
|
+
drawText(text, offsetX, offsetY, direction), offsetY += width;
|
|
13884
13786
|
});
|
|
13885
|
-
}
|
|
13787
|
+
}
|
|
13886
13788
|
}
|
|
13887
13789
|
transform3dMatrixToContextMatrix && this.restoreTransformUseContext2d(text, textAttribute, z, context), this.afterRenderStep(text, context, x, y, doFill, doStroke, fVisible, sVisible, textAttribute, drawContext, fillCb, strokeCb);
|
|
13888
13790
|
}
|
|
@@ -13894,10 +13796,12 @@
|
|
|
13894
13796
|
computed3dMatrix = !keepDirIn3d;
|
|
13895
13797
|
this._draw(text, textAttribute, computed3dMatrix, drawContext, params);
|
|
13896
13798
|
}
|
|
13897
|
-
drawUnderLine(underline, lineThrough, text,
|
|
13799
|
+
drawUnderLine(underline, lineThrough, text, x, y, z, textAttribute, context, multiOption) {
|
|
13898
13800
|
if (lineThrough + underline <= 0) return;
|
|
13899
13801
|
const {
|
|
13900
13802
|
textAlign = textAttribute.textAlign,
|
|
13803
|
+
textBaseline = textAttribute.textBaseline,
|
|
13804
|
+
fontSize = textAttribute.fontSize,
|
|
13901
13805
|
fill = textAttribute.fill,
|
|
13902
13806
|
opacity = textAttribute.opacity,
|
|
13903
13807
|
underlineOffset = textAttribute.underlineOffset,
|
|
@@ -13907,21 +13811,23 @@
|
|
|
13907
13811
|
isMulti = !isNil$1(multiOption),
|
|
13908
13812
|
w = isMulti ? multiOption.width : text.clipedWidth,
|
|
13909
13813
|
offsetX = isMulti ? 0 : textDrawOffsetX(textAlign, w),
|
|
13814
|
+
offsetY = textLayoutOffsetY(isMulti ? "alphabetic" : textBaseline, fontSize, fontSize),
|
|
13910
13815
|
attribute = {
|
|
13911
13816
|
lineWidth: 0,
|
|
13912
13817
|
stroke: fill,
|
|
13913
13818
|
opacity: opacity,
|
|
13914
13819
|
strokeOpacity: fillOpacity
|
|
13915
13820
|
};
|
|
13821
|
+
let deltaY = isMulti ? -3 : 0;
|
|
13916
13822
|
if (underline) {
|
|
13917
|
-
attribute.lineWidth = underline, context.setStrokeStyle(text, attribute,
|
|
13918
|
-
const dy =
|
|
13919
|
-
context.moveTo(
|
|
13823
|
+
attribute.lineWidth = underline, context.setStrokeStyle(text, attribute, x, y, textAttribute), underlineDash && context.setLineDash(underlineDash), context.beginPath();
|
|
13824
|
+
const dy = y + offsetY + fontSize + underlineOffset + deltaY;
|
|
13825
|
+
context.moveTo(x + offsetX, dy, z), context.lineTo(x + offsetX + w, dy, z), context.stroke();
|
|
13920
13826
|
}
|
|
13921
|
-
if (lineThrough) {
|
|
13922
|
-
attribute.lineWidth = lineThrough, context.setStrokeStyle(text, attribute,
|
|
13923
|
-
const dy =
|
|
13924
|
-
context.moveTo(
|
|
13827
|
+
if (isMulti && (deltaY = -1), lineThrough) {
|
|
13828
|
+
attribute.lineWidth = lineThrough, context.setStrokeStyle(text, attribute, x, y, textAttribute), context.beginPath();
|
|
13829
|
+
const dy = y + offsetY + fontSize / 2 + deltaY;
|
|
13830
|
+
context.moveTo(x + offsetX, dy, z), context.lineTo(x + offsetX + w, dy, z), context.stroke();
|
|
13925
13831
|
}
|
|
13926
13832
|
}
|
|
13927
13833
|
};
|
|
@@ -14216,10 +14122,12 @@
|
|
|
14216
14122
|
const {
|
|
14217
14123
|
image: url
|
|
14218
14124
|
} = image.attribute;
|
|
14219
|
-
if (!
|
|
14220
|
-
|
|
14221
|
-
|
|
14222
|
-
|
|
14125
|
+
if (!image.isGifImage) {
|
|
14126
|
+
if (!url || !image.resources) return;
|
|
14127
|
+
const res = image.resources.get(url);
|
|
14128
|
+
if ("loading" === res.state && isString$1(url)) return void ResourceLoader.improveImageLoading(url);
|
|
14129
|
+
if ("success" !== res.state) return;
|
|
14130
|
+
}
|
|
14223
14131
|
const {
|
|
14224
14132
|
context: context
|
|
14225
14133
|
} = renderService.drawParams;
|
|
@@ -14604,63 +14512,58 @@
|
|
|
14604
14512
|
constructor(fontFamily, options, textMeasure) {
|
|
14605
14513
|
this.fontFamily = fontFamily, this.textOptions = options, this.textMeasure = textMeasure;
|
|
14606
14514
|
}
|
|
14607
|
-
LayoutBBox(bbox, textAlign, textBaseline
|
|
14515
|
+
LayoutBBox(bbox, textAlign, textBaseline) {
|
|
14608
14516
|
if ("left" === textAlign || "start" === textAlign) bbox.xOffset = 0;else if ("center" === textAlign) bbox.xOffset = bbox.width / -2;else {
|
|
14609
14517
|
if ("right" !== textAlign && "end" !== textAlign) throw new Error("非法的textAlign");
|
|
14610
14518
|
bbox.xOffset = -bbox.width;
|
|
14611
14519
|
}
|
|
14612
|
-
|
|
14613
|
-
|
|
14614
|
-
|
|
14615
|
-
|
|
14616
|
-
|
|
14617
|
-
|
|
14618
|
-
|
|
14619
|
-
|
|
14620
|
-
|
|
14520
|
+
return bbox.yOffset = "top" === textBaseline ? 0 : "middle" === textBaseline ? bbox.height / -2 : "alphabetic" === textBaseline ? -.79 * bbox.height : -bbox.height, bbox;
|
|
14521
|
+
}
|
|
14522
|
+
GetLayout(str, width, height, textAlign, textBaseline, lineHeight, suffix, wordBreak, suffixPosition) {
|
|
14523
|
+
const linesLayout = [],
|
|
14524
|
+
bboxWH = [width, height],
|
|
14525
|
+
bboxOffset = [0, 0];
|
|
14526
|
+
for (; str.length > 0;) {
|
|
14527
|
+
const {
|
|
14528
|
+
str: clipText
|
|
14529
|
+
} = this.textMeasure.clipTextWithSuffix(str, this.textOptions, width, suffix, wordBreak, suffixPosition);
|
|
14530
|
+
linesLayout.push({
|
|
14531
|
+
str: clipText,
|
|
14532
|
+
width: this.textMeasure.measureTextWidth(clipText, this.textOptions)
|
|
14533
|
+
}), str = str.substring(clipText.length);
|
|
14534
|
+
}
|
|
14535
|
+
"left" === textAlign || "start" === textAlign || ("center" === textAlign ? bboxOffset[0] = bboxWH[0] / -2 : "right" !== textAlign && "end" !== textAlign || (bboxOffset[0] = -bboxWH[0])), "top" === textBaseline || ("middle" === textBaseline ? bboxOffset[1] = bboxWH[1] / -2 : "bottom" === textBaseline && (bboxOffset[1] = -bboxWH[1]));
|
|
14536
|
+
const bbox = {
|
|
14537
|
+
xOffset: bboxOffset[0],
|
|
14538
|
+
yOffset: bboxOffset[1],
|
|
14539
|
+
width: bboxWH[0],
|
|
14540
|
+
height: bboxWH[1]
|
|
14541
|
+
};
|
|
14542
|
+
return this.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline, lineHeight);
|
|
14621
14543
|
}
|
|
14622
14544
|
GetLayoutByLines(lines, textAlign, textBaseline, lineHeight) {
|
|
14623
14545
|
let suffix = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : "";
|
|
14624
14546
|
let wordBreak = arguments.length > 5 ? arguments[5] : undefined;
|
|
14625
|
-
let
|
|
14626
|
-
|
|
14627
|
-
lineWidth: lineWidth,
|
|
14628
|
-
suffixPosition = "end",
|
|
14629
|
-
measureMode = exports.MeasureModeEnum.actualBounding,
|
|
14630
|
-
keepCenterInLine = !1
|
|
14631
|
-
} = null != params ? params : {};
|
|
14547
|
+
let lineWidth = arguments.length > 6 ? arguments[6] : undefined;
|
|
14548
|
+
let suffixPosition = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : "end";
|
|
14632
14549
|
lines = lines.map(l => l.toString());
|
|
14633
14550
|
const linesLayout = [],
|
|
14634
14551
|
bboxWH = [0, 0];
|
|
14635
14552
|
if ("number" == typeof lineWidth && lineWidth !== 1 / 0) {
|
|
14636
14553
|
let width;
|
|
14637
|
-
for (let i = 0, len = lines.length; i < len; i++) {
|
|
14638
|
-
|
|
14639
|
-
width
|
|
14640
|
-
|
|
14641
|
-
width: width,
|
|
14642
|
-
ascent: metrics.ascent,
|
|
14643
|
-
descent: metrics.descent,
|
|
14644
|
-
keepCenterInLine: keepCenterInLine
|
|
14645
|
-
});
|
|
14646
|
-
}
|
|
14554
|
+
for (let i = 0, len = lines.length; i < len; i++) width = Math.min(this.textMeasure.measureTextWidth(lines[i], this.textOptions), lineWidth), linesLayout.push({
|
|
14555
|
+
str: this.textMeasure.clipTextWithSuffix(lines[i], this.textOptions, width, suffix, wordBreak, suffixPosition).str,
|
|
14556
|
+
width: width
|
|
14557
|
+
});
|
|
14647
14558
|
bboxWH[0] = lineWidth;
|
|
14648
14559
|
} else {
|
|
14649
|
-
let width,
|
|
14650
|
-
|
|
14651
|
-
|
|
14652
|
-
|
|
14653
|
-
|
|
14654
|
-
|
|
14655
|
-
|
|
14656
|
-
str: text,
|
|
14657
|
-
width: width,
|
|
14658
|
-
ascent: metrics.ascent,
|
|
14659
|
-
descent: metrics.descent,
|
|
14660
|
-
keepCenterInLine: keepCenterInLine
|
|
14661
|
-
});
|
|
14662
|
-
}
|
|
14663
|
-
bboxWH[0] = _lineWidth;
|
|
14560
|
+
let width, text;
|
|
14561
|
+
lineWidth = 0;
|
|
14562
|
+
for (let i = 0, len = lines.length; i < len; i++) text = lines[i], width = this.textMeasure.measureTextWidth(text, this.textOptions), lineWidth = Math.max(lineWidth, width), linesLayout.push({
|
|
14563
|
+
str: text,
|
|
14564
|
+
width: width
|
|
14565
|
+
});
|
|
14566
|
+
bboxWH[0] = lineWidth;
|
|
14664
14567
|
}
|
|
14665
14568
|
bboxWH[1] = linesLayout.length * lineHeight, bboxWH[0] = linesLayout.reduce((a, b) => Math.max(a, b.width), 0);
|
|
14666
14569
|
const bbox = {
|
|
@@ -14669,7 +14572,7 @@
|
|
|
14669
14572
|
width: bboxWH[0],
|
|
14670
14573
|
height: bboxWH[1]
|
|
14671
14574
|
};
|
|
14672
|
-
return this.LayoutBBox(bbox, textAlign, textBaseline
|
|
14575
|
+
return this.LayoutBBox(bbox, textAlign, textBaseline), this.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline, lineHeight);
|
|
14673
14576
|
}
|
|
14674
14577
|
layoutWithBBox(bbox, lines, textAlign, textBaseline, lineHeight) {
|
|
14675
14578
|
const origin = [0, 0],
|
|
@@ -14688,16 +14591,11 @@
|
|
|
14688
14591
|
};
|
|
14689
14592
|
}
|
|
14690
14593
|
lineOffset(bbox, line, textAlign, textBaseline, lineHeight, origin) {
|
|
14691
|
-
|
|
14692
|
-
const buf = 0,
|
|
14693
|
-
actualHeightWithBuf = line.ascent + line.descent + buf;
|
|
14694
|
-
actualHeightWithBuf < lineHeight - buf && ("bottom" === textBaseline ? line.topOffset += (lineHeight - actualHeightWithBuf) / 2 : "top" === textBaseline && (line.topOffset -= (lineHeight - actualHeightWithBuf) / 2));
|
|
14695
|
-
}
|
|
14696
|
-
return origin[1] += lineHeight, line;
|
|
14594
|
+
return "left" === textAlign || "start" === textAlign ? line.leftOffset = 0 : "center" === textAlign ? line.leftOffset = (bbox.width - line.width) / 2 : "right" !== textAlign && "end" !== textAlign || (line.leftOffset = bbox.width - line.width), line.topOffset = (lineHeight - this.textOptions.fontSize) / 2 + .79 * this.textOptions.fontSize + origin[1], origin[1] += lineHeight, line;
|
|
14697
14595
|
}
|
|
14698
14596
|
}
|
|
14699
14597
|
|
|
14700
|
-
const TEXT_UPDATE_TAG_KEY = ["text", "maxLineWidth", "
|
|
14598
|
+
const TEXT_UPDATE_TAG_KEY = ["text", "maxLineWidth", "textAlign", "textBaseline", "heightLimit", "lineClamp", "fontSize", "fontFamily", "fontWeight", "ellipsis", "lineHeight", "direction", "wordBreak", "heightLimit", "lineClamp", ...GRAPHIC_UPDATE_TAG_KEY];
|
|
14701
14599
|
class Text extends Graphic {
|
|
14702
14600
|
get font() {
|
|
14703
14601
|
const textTheme = this.getGraphicTheme();
|
|
@@ -14706,22 +14604,26 @@
|
|
|
14706
14604
|
get clipedText() {
|
|
14707
14605
|
var _a;
|
|
14708
14606
|
const attribute = this.attribute,
|
|
14709
|
-
textTheme = this.getGraphicTheme()
|
|
14710
|
-
|
|
14711
|
-
|
|
14607
|
+
textTheme = this.getGraphicTheme();
|
|
14608
|
+
if (!this.isSimplify()) return;
|
|
14609
|
+
const {
|
|
14610
|
+
maxLineWidth = textTheme.maxLineWidth
|
|
14611
|
+
} = attribute;
|
|
14612
|
+
return Number.isFinite(maxLineWidth) ? (this.tryUpdateAABBBounds(), this.cache.clipedText) : (null !== (_a = attribute.text) && void 0 !== _a ? _a : textTheme.text).toString();
|
|
14712
14613
|
}
|
|
14713
14614
|
get clipedWidth() {
|
|
14714
|
-
return this.tryUpdateAABBBounds(), this.cache.clipedWidth;
|
|
14615
|
+
if (this.isSimplify()) return this.tryUpdateAABBBounds(), this.cache.clipedWidth;
|
|
14715
14616
|
}
|
|
14716
14617
|
get cliped() {
|
|
14717
14618
|
var _a, _b;
|
|
14718
14619
|
const textTheme = this.getGraphicTheme(),
|
|
14719
14620
|
attribute = this.attribute,
|
|
14720
|
-
|
|
14721
|
-
|
|
14722
|
-
|
|
14723
|
-
|
|
14724
|
-
|
|
14621
|
+
{
|
|
14622
|
+
maxLineWidth = textTheme.maxLineWidth,
|
|
14623
|
+
text: text,
|
|
14624
|
+
whiteSpace = textTheme.whiteSpace
|
|
14625
|
+
} = attribute;
|
|
14626
|
+
if (!Number.isFinite(maxLineWidth)) return !1;
|
|
14725
14627
|
if (this.tryUpdateAABBBounds(), null === (_b = null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData) || void 0 === _b ? void 0 : _b.lines) {
|
|
14726
14628
|
let mergedText = "";
|
|
14727
14629
|
this.cache.layoutData.lines.forEach(item => {
|
|
@@ -14732,7 +14634,10 @@
|
|
|
14732
14634
|
return "vertical" === attribute.direction && this.cache.verticalList && this.cache.verticalList[0] ? this.cache.verticalList[0].map(item => item.text).join("") !== attribute.text.toString() : null != this.clipedText && this.clipedText !== attribute.text.toString();
|
|
14733
14635
|
}
|
|
14734
14636
|
get multilineLayout() {
|
|
14735
|
-
return this.tryUpdateAABBBounds(), this.cache.layoutData;
|
|
14637
|
+
if (this.isMultiLine) return this.tryUpdateAABBBounds(), this.cache.layoutData;
|
|
14638
|
+
}
|
|
14639
|
+
isSimplify() {
|
|
14640
|
+
return !this.isMultiLine && "vertical" !== this.attribute.direction;
|
|
14736
14641
|
}
|
|
14737
14642
|
get isMultiLine() {
|
|
14738
14643
|
return Array.isArray(this.attribute.text) || "normal" === this.attribute.whiteSpace;
|
|
@@ -14805,74 +14710,8 @@
|
|
|
14805
14710
|
}
|
|
14806
14711
|
return application.graphicService.combindShadowAABBBounds(aabbBounds, this), null == attribute.forceBoundsHeight && null == attribute.forceBoundsWidth || application.graphicService.updateHTMLTextAABBBounds(attribute, textTheme, aabbBounds), transformBoundsWithMatrix(aabbBounds, aabbBounds, this.transMatrix), aabbBounds;
|
|
14807
14712
|
}
|
|
14808
|
-
updateSingallineAABBBounds(text) {
|
|
14809
|
-
this.updateMultilineAABBBounds([text]);
|
|
14810
|
-
const layoutData = this.cache.layoutData;
|
|
14811
|
-
if (layoutData) {
|
|
14812
|
-
const line = layoutData.lines[0];
|
|
14813
|
-
this.cache.clipedText = line.str, this.cache.clipedWidth = line.width;
|
|
14814
|
-
}
|
|
14815
|
-
return this._AABBBounds;
|
|
14816
|
-
}
|
|
14817
|
-
updateMultilineAABBBounds(text) {
|
|
14818
|
-
const textTheme = this.getGraphicTheme(),
|
|
14819
|
-
{
|
|
14820
|
-
direction = textTheme.direction,
|
|
14821
|
-
underlineOffset = textTheme.underlineOffset
|
|
14822
|
-
} = this.attribute,
|
|
14823
|
-
b = "horizontal" === direction ? this.updateHorizontalMultilineAABBBounds(text) : this.updateVerticalMultilineAABBBounds(text);
|
|
14824
|
-
return "horizontal" === direction && underlineOffset && this._AABBBounds.add(this._AABBBounds.x1, this._AABBBounds.y2 + underlineOffset), b;
|
|
14825
|
-
}
|
|
14826
|
-
guessLineHeightBuf(fontSize) {
|
|
14827
|
-
return fontSize ? .1 * fontSize : 0;
|
|
14828
|
-
}
|
|
14829
|
-
updateHorizontalMultilineAABBBounds(text) {
|
|
14830
|
-
var _a;
|
|
14831
|
-
const textTheme = this.getGraphicTheme(),
|
|
14832
|
-
attribute = this.attribute,
|
|
14833
|
-
{
|
|
14834
|
-
fontFamily = textTheme.fontFamily,
|
|
14835
|
-
textAlign = textTheme.textAlign,
|
|
14836
|
-
textBaseline = textTheme.textBaseline,
|
|
14837
|
-
fontSize = textTheme.fontSize,
|
|
14838
|
-
fontWeight = textTheme.fontWeight,
|
|
14839
|
-
ellipsis = textTheme.ellipsis,
|
|
14840
|
-
maxLineWidth: maxLineWidth,
|
|
14841
|
-
stroke = textTheme.stroke,
|
|
14842
|
-
wrap = textTheme.wrap,
|
|
14843
|
-
measureMode = textTheme.measureMode,
|
|
14844
|
-
lineWidth = textTheme.lineWidth,
|
|
14845
|
-
whiteSpace = textTheme.whiteSpace,
|
|
14846
|
-
suffixPosition = textTheme.suffixPosition,
|
|
14847
|
-
ignoreBuf = textTheme.ignoreBuf,
|
|
14848
|
-
keepCenterInLine = textTheme.keepCenterInLine
|
|
14849
|
-
} = attribute,
|
|
14850
|
-
buf = ignoreBuf ? 0 : this.guessLineHeightBuf(fontSize),
|
|
14851
|
-
lineHeight = this.getLineHeight(attribute, textTheme) + buf;
|
|
14852
|
-
if ("normal" === whiteSpace || wrap) return this.updateWrapAABBBounds(text);
|
|
14853
|
-
if (!this.shouldUpdateShape() && (null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData)) {
|
|
14854
|
-
const bbox = this.cache.layoutData.bbox;
|
|
14855
|
-
return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
14856
|
-
}
|
|
14857
|
-
const textMeasure = application.graphicUtil.textMeasure,
|
|
14858
|
-
layoutData = new CanvasTextLayout(fontFamily, {
|
|
14859
|
-
fontSize: fontSize,
|
|
14860
|
-
fontWeight: fontWeight,
|
|
14861
|
-
fontFamily: fontFamily,
|
|
14862
|
-
lineHeight: lineHeight
|
|
14863
|
-
}, textMeasure).GetLayoutByLines(text, textAlign, textBaseline, lineHeight, !0 === ellipsis ? textTheme.ellipsis : ellipsis || void 0, !1, {
|
|
14864
|
-
lineWidth: maxLineWidth,
|
|
14865
|
-
suffixPosition: suffixPosition,
|
|
14866
|
-
measureMode: measureMode,
|
|
14867
|
-
keepCenterInLine: keepCenterInLine
|
|
14868
|
-
}),
|
|
14869
|
-
{
|
|
14870
|
-
bbox: bbox
|
|
14871
|
-
} = layoutData;
|
|
14872
|
-
return this.cache.layoutData = layoutData, this.clearUpdateShapeTag(), this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
14873
|
-
}
|
|
14874
14713
|
updateWrapAABBBounds(text) {
|
|
14875
|
-
var _a, _b, _c;
|
|
14714
|
+
var _a, _b, _c, _d;
|
|
14876
14715
|
const textTheme = this.getGraphicTheme(),
|
|
14877
14716
|
{
|
|
14878
14717
|
fontFamily = textTheme.fontFamily,
|
|
@@ -14886,26 +14725,22 @@
|
|
|
14886
14725
|
wordBreak = textTheme.wordBreak,
|
|
14887
14726
|
fontWeight = textTheme.fontWeight,
|
|
14888
14727
|
ignoreBuf = textTheme.ignoreBuf,
|
|
14889
|
-
measureMode = textTheme.measureMode,
|
|
14890
14728
|
suffixPosition = textTheme.suffixPosition,
|
|
14891
14729
|
heightLimit = 0,
|
|
14892
|
-
lineClamp: lineClamp
|
|
14893
|
-
keepCenterInLine = textTheme.keepCenterInLine
|
|
14730
|
+
lineClamp: lineClamp
|
|
14894
14731
|
} = this.attribute,
|
|
14895
|
-
|
|
14896
|
-
|
|
14897
|
-
if (!this.shouldUpdateShape() && (null === (
|
|
14732
|
+
lineHeight = null !== (_a = calculateLineHeight(this.attribute.lineHeight, this.attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : this.attribute.fontSize || textTheme.fontSize,
|
|
14733
|
+
buf = ignoreBuf ? 0 : 2;
|
|
14734
|
+
if (!this.shouldUpdateShape() && (null === (_b = this.cache) || void 0 === _b ? void 0 : _b.layoutData)) {
|
|
14898
14735
|
const bbox = this.cache.layoutData.bbox;
|
|
14899
14736
|
return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
14900
14737
|
}
|
|
14901
14738
|
const textMeasure = application.graphicUtil.textMeasure,
|
|
14902
|
-
|
|
14739
|
+
layoutObj = new CanvasTextLayout(fontFamily, {
|
|
14903
14740
|
fontSize: fontSize,
|
|
14904
14741
|
fontWeight: fontWeight,
|
|
14905
|
-
fontFamily: fontFamily
|
|
14906
|
-
|
|
14907
|
-
},
|
|
14908
|
-
layoutObj = new CanvasTextLayout(fontFamily, textOptions, textMeasure),
|
|
14742
|
+
fontFamily: fontFamily
|
|
14743
|
+
}, textMeasure),
|
|
14909
14744
|
lines = isArray$1(text) ? text.map(l => l.toString()) : [text.toString()],
|
|
14910
14745
|
linesLayout = [],
|
|
14911
14746
|
bboxWH = [0, 0];
|
|
@@ -14915,37 +14750,29 @@
|
|
|
14915
14750
|
const str = lines[i];
|
|
14916
14751
|
let needCut = !0;
|
|
14917
14752
|
if (i === lineCountLimit - 1) {
|
|
14918
|
-
const clip = textMeasure.clipTextWithSuffix(str, textOptions, maxLineWidth, ellipsis, !1, suffixPosition, i !== lines.length - 1)
|
|
14919
|
-
matrics = textMeasure.measureTextPixelADscentAndWidth(clip.str, textOptions, measureMode);
|
|
14753
|
+
const clip = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1, suffixPosition, i !== lines.length - 1);
|
|
14920
14754
|
linesLayout.push({
|
|
14921
14755
|
str: clip.str,
|
|
14922
|
-
width: clip.width
|
|
14923
|
-
ascent: matrics.ascent,
|
|
14924
|
-
descent: matrics.descent,
|
|
14925
|
-
keepCenterInLine: keepCenterInLine
|
|
14756
|
+
width: clip.width
|
|
14926
14757
|
});
|
|
14927
14758
|
break;
|
|
14928
14759
|
}
|
|
14929
|
-
const clip = textMeasure.clipText(str, textOptions, maxLineWidth, "break-all" !== wordBreak, "keep-all" === wordBreak);
|
|
14760
|
+
const clip = layoutObj.textMeasure.clipText(str, layoutObj.textOptions, maxLineWidth, "break-all" !== wordBreak, "keep-all" === wordBreak);
|
|
14930
14761
|
if ("" !== str && "" === clip.str || clip.wordBreaked) {
|
|
14931
14762
|
if (ellipsis) {
|
|
14932
|
-
const clipEllipsis = textMeasure.clipTextWithSuffix(str, textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
|
|
14933
|
-
clip.str = null !== (
|
|
14763
|
+
const clipEllipsis = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
|
|
14764
|
+
clip.str = null !== (_c = clipEllipsis.str) && void 0 !== _c ? _c : "", clip.width = null !== (_d = clipEllipsis.width) && void 0 !== _d ? _d : 0;
|
|
14934
14765
|
} else clip.str = "", clip.width = 0;
|
|
14935
14766
|
needCut = !1;
|
|
14936
14767
|
}
|
|
14937
|
-
const matrics = textMeasure.measureTextPixelADscentAndWidth(clip.str, textOptions, measureMode);
|
|
14938
14768
|
linesLayout.push({
|
|
14939
14769
|
str: clip.str,
|
|
14940
|
-
width: clip.width
|
|
14941
|
-
ascent: matrics.ascent,
|
|
14942
|
-
descent: matrics.descent,
|
|
14943
|
-
keepCenterInLine: keepCenterInLine
|
|
14770
|
+
width: clip.width
|
|
14944
14771
|
});
|
|
14945
14772
|
let cutLength = clip.str.length;
|
|
14946
14773
|
if (!clip.wordBreaked || "" !== str && "" === clip.str || (needCut = !0, cutLength = clip.wordBreaked), clip.str.length === str.length) ;else if (needCut) {
|
|
14947
|
-
|
|
14948
|
-
lines.splice(i + 1, 0, newStr);
|
|
14774
|
+
let newStr = str.substring(cutLength);
|
|
14775
|
+
"keep-all" === wordBreak && (newStr = newStr.replace(/^\s+/g, "")), lines.splice(i + 1, 0, newStr);
|
|
14949
14776
|
}
|
|
14950
14777
|
}
|
|
14951
14778
|
let maxWidth = 0;
|
|
@@ -14958,46 +14785,235 @@
|
|
|
14958
14785
|
lineWidth = 0;
|
|
14959
14786
|
for (let i = 0, len = lines.length; i < len; i++) {
|
|
14960
14787
|
if (i === lineCountLimit - 1) {
|
|
14961
|
-
const clip = textMeasure.clipTextWithSuffix(lines[i], textOptions, maxLineWidth, ellipsis, !1, suffixPosition)
|
|
14962
|
-
matrics = textMeasure.measureTextPixelADscentAndWidth(clip.str, textOptions, measureMode);
|
|
14788
|
+
const clip = layoutObj.textMeasure.clipTextWithSuffix(lines[i], layoutObj.textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
|
|
14963
14789
|
linesLayout.push({
|
|
14964
14790
|
str: clip.str,
|
|
14965
|
-
width: clip.width
|
|
14966
|
-
ascent: matrics.ascent,
|
|
14967
|
-
descent: matrics.descent,
|
|
14968
|
-
keepCenterInLine: keepCenterInLine
|
|
14791
|
+
width: clip.width
|
|
14969
14792
|
}), lineWidth = Math.max(lineWidth, clip.width);
|
|
14970
14793
|
break;
|
|
14971
14794
|
}
|
|
14972
|
-
text = lines[i], width = textMeasure.measureTextWidth(text, textOptions), lineWidth = Math.max(lineWidth, width)
|
|
14973
|
-
const matrics = textMeasure.measureTextPixelADscentAndWidth(text, textOptions, measureMode);
|
|
14974
|
-
linesLayout.push({
|
|
14795
|
+
text = lines[i], width = layoutObj.textMeasure.measureTextWidth(text, layoutObj.textOptions, "break-word" === wordBreak), lineWidth = Math.max(lineWidth, width), linesLayout.push({
|
|
14975
14796
|
str: text,
|
|
14976
|
-
width: width
|
|
14977
|
-
ascent: matrics.ascent,
|
|
14978
|
-
descent: matrics.descent,
|
|
14979
|
-
keepCenterInLine: keepCenterInLine
|
|
14797
|
+
width: width
|
|
14980
14798
|
});
|
|
14981
14799
|
}
|
|
14982
14800
|
bboxWH[0] = lineWidth;
|
|
14983
14801
|
}
|
|
14984
|
-
bboxWH[1] = linesLayout.length * lineHeight;
|
|
14802
|
+
bboxWH[1] = linesLayout.length * (lineHeight + buf);
|
|
14985
14803
|
const bbox = {
|
|
14986
14804
|
xOffset: 0,
|
|
14987
14805
|
yOffset: 0,
|
|
14988
14806
|
width: bboxWH[0],
|
|
14989
14807
|
height: bboxWH[1]
|
|
14990
14808
|
};
|
|
14991
|
-
layoutObj.LayoutBBox(bbox, textAlign, textBaseline
|
|
14809
|
+
layoutObj.LayoutBBox(bbox, textAlign, textBaseline);
|
|
14992
14810
|
const layoutData = layoutObj.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline, lineHeight);
|
|
14993
14811
|
return this.cache.layoutData = layoutData, this.clearUpdateShapeTag(), this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
14994
14812
|
}
|
|
14995
|
-
|
|
14813
|
+
updateSingallineAABBBounds(text) {
|
|
14814
|
+
const textTheme = this.getGraphicTheme(),
|
|
14815
|
+
{
|
|
14816
|
+
direction = textTheme.direction,
|
|
14817
|
+
underlineOffset = textTheme.underlineOffset
|
|
14818
|
+
} = this.attribute,
|
|
14819
|
+
b = "horizontal" === direction ? this.updateHorizontalSinglelineAABBBounds(text) : this.updateVerticalSinglelineAABBBounds(text);
|
|
14820
|
+
return "horizontal" === direction && underlineOffset && this._AABBBounds.add(this._AABBBounds.x1, this._AABBBounds.y2 + underlineOffset), b;
|
|
14821
|
+
}
|
|
14822
|
+
updateMultilineAABBBounds(text) {
|
|
14823
|
+
const textTheme = this.getGraphicTheme(),
|
|
14824
|
+
{
|
|
14825
|
+
direction = textTheme.direction,
|
|
14826
|
+
underlineOffset = textTheme.underlineOffset
|
|
14827
|
+
} = this.attribute,
|
|
14828
|
+
b = "horizontal" === direction ? this.updateHorizontalMultilineAABBBounds(text) : this.updateVerticalMultilineAABBBounds(text);
|
|
14829
|
+
return "horizontal" === direction && underlineOffset && this._AABBBounds.add(this._AABBBounds.x1, this._AABBBounds.y2 + underlineOffset), b;
|
|
14830
|
+
}
|
|
14831
|
+
updateHorizontalSinglelineAABBBounds(text) {
|
|
14996
14832
|
var _a, _b;
|
|
14833
|
+
const textTheme = this.getGraphicTheme(),
|
|
14834
|
+
{
|
|
14835
|
+
wrap = textTheme.wrap
|
|
14836
|
+
} = this.attribute;
|
|
14837
|
+
if (wrap) return this.updateWrapAABBBounds([text]);
|
|
14838
|
+
const textMeasure = application.graphicUtil.textMeasure;
|
|
14839
|
+
let width, str;
|
|
14840
|
+
const attribute = this.attribute,
|
|
14841
|
+
{
|
|
14842
|
+
maxLineWidth = textTheme.maxLineWidth,
|
|
14843
|
+
ellipsis = textTheme.ellipsis,
|
|
14844
|
+
textAlign = textTheme.textAlign,
|
|
14845
|
+
textBaseline = textTheme.textBaseline,
|
|
14846
|
+
fontFamily = textTheme.fontFamily,
|
|
14847
|
+
fontSize = textTheme.fontSize,
|
|
14848
|
+
fontWeight = textTheme.fontWeight,
|
|
14849
|
+
stroke = textTheme.stroke,
|
|
14850
|
+
lineWidth = textTheme.lineWidth,
|
|
14851
|
+
ignoreBuf = textTheme.ignoreBuf,
|
|
14852
|
+
whiteSpace = textTheme.whiteSpace,
|
|
14853
|
+
suffixPosition = textTheme.suffixPosition
|
|
14854
|
+
} = attribute;
|
|
14855
|
+
if ("normal" === whiteSpace) return this.updateWrapAABBBounds(text);
|
|
14856
|
+
const buf = ignoreBuf ? 0 : Math.max(2, .075 * fontSize),
|
|
14857
|
+
textFontSize = attribute.fontSize || textTheme.fontSize,
|
|
14858
|
+
lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, textFontSize)) && void 0 !== _a ? _a : textFontSize + buf;
|
|
14859
|
+
if (!this.shouldUpdateShape() && this.cache) {
|
|
14860
|
+
width = null !== (_b = this.cache.clipedWidth) && void 0 !== _b ? _b : 0;
|
|
14861
|
+
const dx = textDrawOffsetX(textAlign, width),
|
|
14862
|
+
dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);
|
|
14863
|
+
return this._AABBBounds.set(dx, dy, dx + width, dy + lineHeight), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
14864
|
+
}
|
|
14865
|
+
if (Number.isFinite(maxLineWidth)) {
|
|
14866
|
+
if (ellipsis) {
|
|
14867
|
+
const strEllipsis = !0 === ellipsis ? textTheme.ellipsis : ellipsis,
|
|
14868
|
+
data = textMeasure.clipTextWithSuffix(text.toString(), {
|
|
14869
|
+
fontSize: fontSize,
|
|
14870
|
+
fontWeight: fontWeight,
|
|
14871
|
+
fontFamily: fontFamily
|
|
14872
|
+
}, maxLineWidth, strEllipsis, !1, suffixPosition);
|
|
14873
|
+
str = data.str, width = data.width;
|
|
14874
|
+
} else {
|
|
14875
|
+
const data = textMeasure.clipText(text.toString(), {
|
|
14876
|
+
fontSize: fontSize,
|
|
14877
|
+
fontWeight: fontWeight,
|
|
14878
|
+
fontFamily: fontFamily
|
|
14879
|
+
}, maxLineWidth, !1);
|
|
14880
|
+
str = data.str, width = data.width;
|
|
14881
|
+
}
|
|
14882
|
+
this.cache.clipedText = str, this.cache.clipedWidth = width;
|
|
14883
|
+
} else width = textMeasure.measureTextWidth(text.toString(), {
|
|
14884
|
+
fontSize: fontSize,
|
|
14885
|
+
fontWeight: fontWeight,
|
|
14886
|
+
fontFamily: fontFamily
|
|
14887
|
+
}), this.cache.clipedText = text.toString(), this.cache.clipedWidth = width;
|
|
14888
|
+
this.clearUpdateShapeTag();
|
|
14889
|
+
const dx = textDrawOffsetX(textAlign, width);
|
|
14890
|
+
let lh = lineHeight;
|
|
14891
|
+
application.global && application.global.isSafari() && (lh += .2 * fontSize);
|
|
14892
|
+
const dy = textLayoutOffsetY(textBaseline, lh, fontSize, buf);
|
|
14893
|
+
return this._AABBBounds.set(dx, dy, dx + width, dy + lh), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
14894
|
+
}
|
|
14895
|
+
getBaselineMapAlign() {
|
|
14896
|
+
return Text.baselineMapAlign;
|
|
14897
|
+
}
|
|
14898
|
+
getAlignMapBaseline() {
|
|
14899
|
+
return Text.alignMapBaseline;
|
|
14900
|
+
}
|
|
14901
|
+
updateVerticalSinglelineAABBBounds(text) {
|
|
14902
|
+
var _a, _b, _c;
|
|
14997
14903
|
const textTheme = this.getGraphicTheme(),
|
|
14998
14904
|
textMeasure = application.graphicUtil.textMeasure;
|
|
14999
14905
|
let width;
|
|
15000
14906
|
const attribute = this.attribute,
|
|
14907
|
+
{
|
|
14908
|
+
ignoreBuf = textTheme.ignoreBuf
|
|
14909
|
+
} = attribute,
|
|
14910
|
+
buf = ignoreBuf ? 0 : 2,
|
|
14911
|
+
{
|
|
14912
|
+
maxLineWidth = textTheme.maxLineWidth,
|
|
14913
|
+
ellipsis = textTheme.ellipsis,
|
|
14914
|
+
fontSize = textTheme.fontSize,
|
|
14915
|
+
fontWeight = textTheme.fontWeight,
|
|
14916
|
+
fontFamily = textTheme.fontFamily,
|
|
14917
|
+
stroke = textTheme.stroke,
|
|
14918
|
+
lineWidth = textTheme.lineWidth,
|
|
14919
|
+
verticalMode = textTheme.verticalMode,
|
|
14920
|
+
suffixPosition = textTheme.suffixPosition
|
|
14921
|
+
} = attribute,
|
|
14922
|
+
lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
|
|
14923
|
+
let {
|
|
14924
|
+
textAlign = textTheme.textAlign,
|
|
14925
|
+
textBaseline = textTheme.textBaseline
|
|
14926
|
+
} = attribute;
|
|
14927
|
+
if (!verticalMode) {
|
|
14928
|
+
const t = textAlign;
|
|
14929
|
+
textAlign = null !== (_b = Text.baselineMapAlign[textBaseline]) && void 0 !== _b ? _b : "left", textBaseline = null !== (_c = Text.alignMapBaseline[t]) && void 0 !== _c ? _c : "top";
|
|
14930
|
+
}
|
|
14931
|
+
if (!this.shouldUpdateShape() && this.cache) {
|
|
14932
|
+
width = this.cache.clipedWidth;
|
|
14933
|
+
const dx = textDrawOffsetX(textAlign, width),
|
|
14934
|
+
dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);
|
|
14935
|
+
return this._AABBBounds.set(dy, dx, dy + lineHeight, dx + width), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
14936
|
+
}
|
|
14937
|
+
let verticalList = [verticalLayout(text.toString())];
|
|
14938
|
+
if (Number.isFinite(maxLineWidth)) {
|
|
14939
|
+
if (ellipsis) {
|
|
14940
|
+
const strEllipsis = !0 === ellipsis ? textTheme.ellipsis : ellipsis,
|
|
14941
|
+
data = textMeasure.clipTextWithSuffixVertical(verticalList[0], {
|
|
14942
|
+
fontSize: fontSize,
|
|
14943
|
+
fontWeight: fontWeight,
|
|
14944
|
+
fontFamily: fontFamily
|
|
14945
|
+
}, maxLineWidth, strEllipsis, !1, suffixPosition);
|
|
14946
|
+
verticalList = [data.verticalList], width = data.width;
|
|
14947
|
+
} else {
|
|
14948
|
+
const data = textMeasure.clipTextVertical(verticalList[0], {
|
|
14949
|
+
fontSize: fontSize,
|
|
14950
|
+
fontWeight: fontWeight,
|
|
14951
|
+
fontFamily: fontFamily
|
|
14952
|
+
}, maxLineWidth, !1);
|
|
14953
|
+
verticalList = [data.verticalList], width = data.width;
|
|
14954
|
+
}
|
|
14955
|
+
this.cache.verticalList = verticalList, this.cache.clipedWidth = width;
|
|
14956
|
+
} else width = 0, verticalList[0].forEach(t => {
|
|
14957
|
+
const w = t.direction === exports.TextDirection.HORIZONTAL ? fontSize : textMeasure.measureTextWidth(t.text, {
|
|
14958
|
+
fontSize: fontSize,
|
|
14959
|
+
fontWeight: fontWeight,
|
|
14960
|
+
fontFamily: fontFamily
|
|
14961
|
+
});
|
|
14962
|
+
width += w, t.width = w;
|
|
14963
|
+
}), this.cache.verticalList = verticalList, this.cache.clipedWidth = width;
|
|
14964
|
+
this.clearUpdateShapeTag();
|
|
14965
|
+
const dx = textDrawOffsetX(textAlign, width),
|
|
14966
|
+
dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);
|
|
14967
|
+
return this._AABBBounds.set(dy, dx, dy + lineHeight, dx + width), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
14968
|
+
}
|
|
14969
|
+
updateHorizontalMultilineAABBBounds(text) {
|
|
14970
|
+
var _a, _b;
|
|
14971
|
+
const textTheme = this.getGraphicTheme(),
|
|
14972
|
+
{
|
|
14973
|
+
wrap = textTheme.wrap
|
|
14974
|
+
} = this.attribute;
|
|
14975
|
+
if (wrap) return this.updateWrapAABBBounds(text);
|
|
14976
|
+
const attribute = this.attribute,
|
|
14977
|
+
{
|
|
14978
|
+
fontFamily = textTheme.fontFamily,
|
|
14979
|
+
textAlign = textTheme.textAlign,
|
|
14980
|
+
textBaseline = textTheme.textBaseline,
|
|
14981
|
+
fontSize = textTheme.fontSize,
|
|
14982
|
+
fontWeight = textTheme.fontWeight,
|
|
14983
|
+
ellipsis = textTheme.ellipsis,
|
|
14984
|
+
maxLineWidth: maxLineWidth,
|
|
14985
|
+
stroke = textTheme.stroke,
|
|
14986
|
+
lineWidth = textTheme.lineWidth,
|
|
14987
|
+
whiteSpace = textTheme.whiteSpace,
|
|
14988
|
+
suffixPosition = textTheme.suffixPosition
|
|
14989
|
+
} = attribute,
|
|
14990
|
+
lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : attribute.fontSize || textTheme.fontSize;
|
|
14991
|
+
if ("normal" === whiteSpace) return this.updateWrapAABBBounds(text);
|
|
14992
|
+
if (!this.shouldUpdateShape() && (null === (_b = this.cache) || void 0 === _b ? void 0 : _b.layoutData)) {
|
|
14993
|
+
const bbox = this.cache.layoutData.bbox;
|
|
14994
|
+
return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
14995
|
+
}
|
|
14996
|
+
const textMeasure = application.graphicUtil.textMeasure,
|
|
14997
|
+
layoutData = new CanvasTextLayout(fontFamily, {
|
|
14998
|
+
fontSize: fontSize,
|
|
14999
|
+
fontWeight: fontWeight,
|
|
15000
|
+
fontFamily: fontFamily
|
|
15001
|
+
}, textMeasure).GetLayoutByLines(text, textAlign, textBaseline, lineHeight, !0 === ellipsis ? textTheme.ellipsis : ellipsis || void 0, !1, maxLineWidth, suffixPosition),
|
|
15002
|
+
{
|
|
15003
|
+
bbox: bbox
|
|
15004
|
+
} = layoutData;
|
|
15005
|
+
return this.cache.layoutData = layoutData, this.clearUpdateShapeTag(), this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
15006
|
+
}
|
|
15007
|
+
updateVerticalMultilineAABBBounds(text) {
|
|
15008
|
+
var _a, _b, _c;
|
|
15009
|
+
const textTheme = this.getGraphicTheme(),
|
|
15010
|
+
textMeasure = application.graphicUtil.textMeasure;
|
|
15011
|
+
let width;
|
|
15012
|
+
const attribute = this.attribute,
|
|
15013
|
+
{
|
|
15014
|
+
ignoreBuf = textTheme.ignoreBuf
|
|
15015
|
+
} = attribute,
|
|
15016
|
+
buf = ignoreBuf ? 0 : 2,
|
|
15001
15017
|
{
|
|
15002
15018
|
maxLineWidth = textTheme.maxLineWidth,
|
|
15003
15019
|
ellipsis = textTheme.ellipsis,
|
|
@@ -15009,14 +15025,14 @@
|
|
|
15009
15025
|
verticalMode = textTheme.verticalMode,
|
|
15010
15026
|
suffixPosition = textTheme.suffixPosition
|
|
15011
15027
|
} = attribute,
|
|
15012
|
-
lineHeight =
|
|
15028
|
+
lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
|
|
15013
15029
|
let {
|
|
15014
15030
|
textAlign = textTheme.textAlign,
|
|
15015
15031
|
textBaseline = textTheme.textBaseline
|
|
15016
15032
|
} = attribute;
|
|
15017
15033
|
if (!verticalMode) {
|
|
15018
15034
|
const t = textAlign;
|
|
15019
|
-
textAlign = null !== (
|
|
15035
|
+
textAlign = null !== (_b = Text.baselineMapAlign[textBaseline]) && void 0 !== _b ? _b : "left", textBaseline = null !== (_c = Text.alignMapBaseline[t]) && void 0 !== _c ? _c : "top";
|
|
15020
15036
|
}
|
|
15021
15037
|
if (width = 0, !this.shouldUpdateShape() && this.cache) {
|
|
15022
15038
|
this.cache.verticalList.forEach(item => {
|
|
@@ -15064,15 +15080,6 @@
|
|
|
15064
15080
|
dy = textLayoutOffsetY(textBaseline, height, fontSize);
|
|
15065
15081
|
return this._AABBBounds.set(dy, dx, dy + height, dx + width), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
15066
15082
|
}
|
|
15067
|
-
getMaxWidth(theme) {
|
|
15068
|
-
var _a, _b;
|
|
15069
|
-
const attribute = this.attribute;
|
|
15070
|
-
return null !== (_b = null !== (_a = attribute.maxLineWidth) && void 0 !== _a ? _a : attribute.maxWidth) && void 0 !== _b ? _b : theme.maxWidth;
|
|
15071
|
-
}
|
|
15072
|
-
getLineHeight(attribute, textTheme) {
|
|
15073
|
-
var _a;
|
|
15074
|
-
return null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : attribute.fontSize || textTheme.fontSize;
|
|
15075
|
-
}
|
|
15076
15083
|
needUpdateTags(keys) {
|
|
15077
15084
|
let k = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : TEXT_UPDATE_TAG_KEY;
|
|
15078
15085
|
return super.needUpdateTags(keys, k);
|
|
@@ -15087,12 +15094,6 @@
|
|
|
15087
15094
|
getNoWorkAnimateAttr() {
|
|
15088
15095
|
return Text.NOWORK_ANIMATE_ATTR;
|
|
15089
15096
|
}
|
|
15090
|
-
getBaselineMapAlign() {
|
|
15091
|
-
return Text.baselineMapAlign;
|
|
15092
|
-
}
|
|
15093
|
-
getAlignMapBaseline() {
|
|
15094
|
-
return Text.alignMapBaseline;
|
|
15095
|
-
}
|
|
15096
15097
|
}
|
|
15097
15098
|
Text.NOWORK_ANIMATE_ATTR = Object.assign({
|
|
15098
15099
|
ellipsis: 1,
|
|
@@ -15171,10 +15172,7 @@
|
|
|
15171
15172
|
const clip = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
|
|
15172
15173
|
linesLayout.push({
|
|
15173
15174
|
str: clip.str,
|
|
15174
|
-
width: clip.width
|
|
15175
|
-
ascent: 0,
|
|
15176
|
-
descent: 0,
|
|
15177
|
-
keepCenterInLine: !1
|
|
15175
|
+
width: clip.width
|
|
15178
15176
|
});
|
|
15179
15177
|
break;
|
|
15180
15178
|
}
|
|
@@ -15188,10 +15186,7 @@
|
|
|
15188
15186
|
}
|
|
15189
15187
|
if (linesLayout.push({
|
|
15190
15188
|
str: clip.str,
|
|
15191
|
-
width: clip.width
|
|
15192
|
-
ascent: 0,
|
|
15193
|
-
descent: 0,
|
|
15194
|
-
keepCenterInLine: !1
|
|
15189
|
+
width: clip.width
|
|
15195
15190
|
}), clip.str.length === str.length) ;else if (needCut) {
|
|
15196
15191
|
const newStr = str.substring(clip.str.length);
|
|
15197
15192
|
lines.splice(i + 1, 0, newStr);
|
|
@@ -15210,19 +15205,13 @@
|
|
|
15210
15205
|
const clip = layoutObj.textMeasure.clipTextWithSuffix(lines[i], layoutObj.textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
|
|
15211
15206
|
linesLayout.push({
|
|
15212
15207
|
str: clip.str,
|
|
15213
|
-
width: clip.width
|
|
15214
|
-
ascent: 0,
|
|
15215
|
-
descent: 0,
|
|
15216
|
-
keepCenterInLine: !1
|
|
15208
|
+
width: clip.width
|
|
15217
15209
|
}), lineWidth = Math.max(lineWidth, clip.width);
|
|
15218
15210
|
break;
|
|
15219
15211
|
}
|
|
15220
15212
|
text = lines[i], width = layoutObj.textMeasure.measureTextWidth(text, layoutObj.textOptions, "break-word" === wordBreak), lineWidth = Math.max(lineWidth, width), linesLayout.push({
|
|
15221
15213
|
str: text,
|
|
15222
|
-
width: width
|
|
15223
|
-
ascent: 0,
|
|
15224
|
-
descent: 0,
|
|
15225
|
-
keepCenterInLine: !1
|
|
15214
|
+
width: width
|
|
15226
15215
|
});
|
|
15227
15216
|
}
|
|
15228
15217
|
bboxWH[0] = lineWidth;
|
|
@@ -15266,9 +15255,6 @@
|
|
|
15266
15255
|
bounds.x1 = -halfS, bounds.x2 = halfS, bounds.y1 = -halfS, bounds.y2 = halfS;
|
|
15267
15256
|
} else bounds.x1 = -size[0] / 2, bounds.x2 = size[0] / 2, bounds.y1 = -size[1] / 2, bounds.y2 = size[1] / 2;
|
|
15268
15257
|
}
|
|
15269
|
-
parseSize(size) {
|
|
15270
|
-
return isNumber$1(size) ? size : Math.min(size[0], size[1]);
|
|
15271
|
-
}
|
|
15272
15258
|
}
|
|
15273
15259
|
|
|
15274
15260
|
function circle(ctx, r, x, y, z) {
|
|
@@ -15279,13 +15265,13 @@
|
|
|
15279
15265
|
super(...arguments), this.type = "circle", this.pathStr = "M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0";
|
|
15280
15266
|
}
|
|
15281
15267
|
draw(ctx, size, x, y, z) {
|
|
15282
|
-
return circle(ctx,
|
|
15268
|
+
return circle(ctx, size / 2, x, y, z);
|
|
15283
15269
|
}
|
|
15284
15270
|
drawOffset(ctx, size, x, y, offset, z) {
|
|
15285
|
-
return circle(ctx,
|
|
15271
|
+
return circle(ctx, size / 2 + offset, x, y, z);
|
|
15286
15272
|
}
|
|
15287
15273
|
drawToSvgPath(size, x, y, z) {
|
|
15288
|
-
const r =
|
|
15274
|
+
const r = size / 2;
|
|
15289
15275
|
return `M ${x - r}, ${y} a ${r},${r} 0 1,0 ${2 * r},0 a ${r},${r} 0 1,0 -${2 * r},0`;
|
|
15290
15276
|
}
|
|
15291
15277
|
}
|
|
@@ -15302,10 +15288,10 @@
|
|
|
15302
15288
|
super(...arguments), this.type = "cross", this.pathStr = "M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z";
|
|
15303
15289
|
}
|
|
15304
15290
|
draw(ctx, size, x, y, z) {
|
|
15305
|
-
return cross(ctx,
|
|
15291
|
+
return cross(ctx, size / 6, x, y, z);
|
|
15306
15292
|
}
|
|
15307
15293
|
drawOffset(ctx, size, x, y, offset, z) {
|
|
15308
|
-
return crossOffset(ctx,
|
|
15294
|
+
return crossOffset(ctx, size / 6, x, y, offset, z);
|
|
15309
15295
|
}
|
|
15310
15296
|
}
|
|
15311
15297
|
var cross$1 = new CrossSymbol();
|
|
@@ -15318,13 +15304,13 @@
|
|
|
15318
15304
|
super(...arguments), this.type = "diamond", this.pathStr = "M-0.5,0L0,-0.5L0.5,0L0,0.5Z";
|
|
15319
15305
|
}
|
|
15320
15306
|
draw(ctx, size, x, y, z) {
|
|
15321
|
-
return diamond(ctx,
|
|
15307
|
+
return diamond(ctx, size / 2, x, y, z);
|
|
15322
15308
|
}
|
|
15323
15309
|
drawFitDir(ctx, size, x, y, z) {
|
|
15324
|
-
return diamond(ctx,
|
|
15310
|
+
return diamond(ctx, size / 2, x, y, z);
|
|
15325
15311
|
}
|
|
15326
15312
|
drawOffset(ctx, size, x, y, offset, z) {
|
|
15327
|
-
return diamond(ctx,
|
|
15313
|
+
return diamond(ctx, size / 2 + offset, x, y, z);
|
|
15328
15314
|
}
|
|
15329
15315
|
}
|
|
15330
15316
|
var diamond$1 = new DiamondSymbol();
|
|
@@ -15338,10 +15324,10 @@
|
|
|
15338
15324
|
super(...arguments), this.type = "square", this.pathStr = "M-0.5,-0.5h1v1h-1Z";
|
|
15339
15325
|
}
|
|
15340
15326
|
draw(ctx, size, x, y) {
|
|
15341
|
-
return square(ctx,
|
|
15327
|
+
return square(ctx, size / 2, x, y);
|
|
15342
15328
|
}
|
|
15343
15329
|
drawOffset(ctx, size, x, y, offset) {
|
|
15344
|
-
return square(ctx,
|
|
15330
|
+
return square(ctx, size / 2 + offset, x, y);
|
|
15345
15331
|
}
|
|
15346
15332
|
}
|
|
15347
15333
|
var square$1 = new SquareSymbol();
|
|
@@ -15355,10 +15341,10 @@
|
|
|
15355
15341
|
super(...arguments), this.type = "triangleUp", this.pathStr = "M0.5,0.5 L-0.5,0.5 L0,-0.5 Z";
|
|
15356
15342
|
}
|
|
15357
15343
|
draw(ctx, size, x, y) {
|
|
15358
|
-
return trianglUpOffset(ctx,
|
|
15344
|
+
return trianglUpOffset(ctx, size / 2, x, y);
|
|
15359
15345
|
}
|
|
15360
15346
|
drawOffset(ctx, size, x, y, offset) {
|
|
15361
|
-
return trianglUpOffset(ctx,
|
|
15347
|
+
return trianglUpOffset(ctx, size / 2, x, y, offset);
|
|
15362
15348
|
}
|
|
15363
15349
|
}
|
|
15364
15350
|
var triangleUp = new TriangleUpSymbol();
|
|
@@ -15390,10 +15376,10 @@
|
|
|
15390
15376
|
super(...arguments), this.type = "star", this.pathStr = "M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z";
|
|
15391
15377
|
}
|
|
15392
15378
|
draw(ctx, size, transX, transY) {
|
|
15393
|
-
return star(ctx,
|
|
15379
|
+
return star(ctx, size / 2, transX, transY);
|
|
15394
15380
|
}
|
|
15395
15381
|
drawOffset(ctx, size, transX, transY, offset) {
|
|
15396
|
-
return star(ctx,
|
|
15382
|
+
return star(ctx, size / 2 + offset, transX, transY);
|
|
15397
15383
|
}
|
|
15398
15384
|
}
|
|
15399
15385
|
var star$1 = new StarSymbol();
|
|
@@ -15411,10 +15397,10 @@
|
|
|
15411
15397
|
super(...arguments), this.type = "arrow", this.pathStr = "M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z";
|
|
15412
15398
|
}
|
|
15413
15399
|
draw(ctx, size, transX, transY) {
|
|
15414
|
-
return arrow(ctx,
|
|
15400
|
+
return arrow(ctx, size / 2, transX, transY);
|
|
15415
15401
|
}
|
|
15416
15402
|
drawOffset(ctx, size, transX, transY, offset) {
|
|
15417
|
-
return arrow(ctx,
|
|
15403
|
+
return arrow(ctx, size / 2 + offset, transX, transY);
|
|
15418
15404
|
}
|
|
15419
15405
|
}
|
|
15420
15406
|
var arrow$1 = new ArrowSymbol();
|
|
@@ -15428,10 +15414,10 @@
|
|
|
15428
15414
|
super(...arguments), this.type = "wedge", this.pathStr = "M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z";
|
|
15429
15415
|
}
|
|
15430
15416
|
draw(ctx, size, transX, transY) {
|
|
15431
|
-
return wedge(ctx,
|
|
15417
|
+
return wedge(ctx, size / 2, transX, transY);
|
|
15432
15418
|
}
|
|
15433
15419
|
drawOffset(ctx, size, transX, transY, offset) {
|
|
15434
|
-
return wedge(ctx,
|
|
15420
|
+
return wedge(ctx, size / 2 + offset, transX, transY);
|
|
15435
15421
|
}
|
|
15436
15422
|
}
|
|
15437
15423
|
var wedge$1 = new WedgeSymbol();
|
|
@@ -15444,10 +15430,10 @@
|
|
|
15444
15430
|
super(...arguments), this.type = "stroke", this.pathStr = "";
|
|
15445
15431
|
}
|
|
15446
15432
|
draw(ctx, size, transX, transY) {
|
|
15447
|
-
return stroke(ctx,
|
|
15433
|
+
return stroke(ctx, size / 2, transX, transY);
|
|
15448
15434
|
}
|
|
15449
15435
|
drawOffset(ctx, size, transX, transY, offset) {
|
|
15450
|
-
return stroke(ctx,
|
|
15436
|
+
return stroke(ctx, size / 2 + offset, transX, transY);
|
|
15451
15437
|
}
|
|
15452
15438
|
}
|
|
15453
15439
|
var stroke$1 = new StrokeSymbol();
|
|
@@ -15469,10 +15455,10 @@
|
|
|
15469
15455
|
super(...arguments), this.type = "wye", this.pathStr = "M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z";
|
|
15470
15456
|
}
|
|
15471
15457
|
draw(ctx, size, transX, transY) {
|
|
15472
|
-
return wye(ctx,
|
|
15458
|
+
return wye(ctx, size / 2, transX, transY);
|
|
15473
15459
|
}
|
|
15474
15460
|
drawOffset(ctx, size, transX, transY, offset) {
|
|
15475
|
-
return wye(ctx,
|
|
15461
|
+
return wye(ctx, size / 2 + offset, transX, transY);
|
|
15476
15462
|
}
|
|
15477
15463
|
}
|
|
15478
15464
|
var wye$1 = new WyeSymbol();
|
|
@@ -15485,10 +15471,10 @@
|
|
|
15485
15471
|
super(...arguments), this.type = "triangleLeft", this.pathStr = "M-0.5,0 L0.5,0.5 L0.5,-0.5 Z";
|
|
15486
15472
|
}
|
|
15487
15473
|
draw(ctx, size, x, y) {
|
|
15488
|
-
return trianglLeftOffset(ctx,
|
|
15474
|
+
return trianglLeftOffset(ctx, size / 2, x, y, 0);
|
|
15489
15475
|
}
|
|
15490
15476
|
drawOffset(ctx, size, x, y, offset) {
|
|
15491
|
-
return trianglLeftOffset(ctx,
|
|
15477
|
+
return trianglLeftOffset(ctx, size / 2, x, y, offset);
|
|
15492
15478
|
}
|
|
15493
15479
|
}
|
|
15494
15480
|
var triangleLeft = new TriangleLeftSymbol();
|
|
@@ -15502,10 +15488,10 @@
|
|
|
15502
15488
|
super(...arguments), this.type = "triangleRight", this.pathStr = "M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z";
|
|
15503
15489
|
}
|
|
15504
15490
|
draw(ctx, size, x, y) {
|
|
15505
|
-
return trianglRightOffset(ctx,
|
|
15491
|
+
return trianglRightOffset(ctx, size / 2, x, y);
|
|
15506
15492
|
}
|
|
15507
15493
|
drawOffset(ctx, size, x, y, offset) {
|
|
15508
|
-
return trianglRightOffset(ctx,
|
|
15494
|
+
return trianglRightOffset(ctx, size / 2, x, y, offset);
|
|
15509
15495
|
}
|
|
15510
15496
|
}
|
|
15511
15497
|
var triangleRight = new TriangleRightSymbol();
|
|
@@ -15519,10 +15505,10 @@
|
|
|
15519
15505
|
super(...arguments), this.type = "triangleDown", this.pathStr = "M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z";
|
|
15520
15506
|
}
|
|
15521
15507
|
draw(ctx, size, x, y) {
|
|
15522
|
-
return trianglDownOffset(ctx,
|
|
15508
|
+
return trianglDownOffset(ctx, size / 2, x, y);
|
|
15523
15509
|
}
|
|
15524
15510
|
drawOffset(ctx, size, x, y, offset) {
|
|
15525
|
-
return trianglDownOffset(ctx,
|
|
15511
|
+
return trianglDownOffset(ctx, size / 2, x, y, offset);
|
|
15526
15512
|
}
|
|
15527
15513
|
}
|
|
15528
15514
|
var triangleDown = new TriangleDownSymbol();
|
|
@@ -15537,10 +15523,10 @@
|
|
|
15537
15523
|
super(...arguments), this.type = "thinTriangle", this.pathStr = "M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z";
|
|
15538
15524
|
}
|
|
15539
15525
|
draw(ctx, size, x, y) {
|
|
15540
|
-
return thinTriangle(ctx,
|
|
15526
|
+
return thinTriangle(ctx, size / 2 / sqrt3, x, y);
|
|
15541
15527
|
}
|
|
15542
15528
|
drawOffset(ctx, size, x, y, offset) {
|
|
15543
|
-
return thinTriangle(ctx,
|
|
15529
|
+
return thinTriangle(ctx, size / 2 / sqrt3 + offset, x, y);
|
|
15544
15530
|
}
|
|
15545
15531
|
}
|
|
15546
15532
|
var thinTriangle$1 = new ThinTriangleSymbol();
|
|
@@ -15554,10 +15540,10 @@
|
|
|
15554
15540
|
super(...arguments), this.type = "arrow2Left", this.pathStr = "M 0.25 -0.5 L -0.25 0 l 0.25 0.5";
|
|
15555
15541
|
}
|
|
15556
15542
|
draw(ctx, size, transX, transY) {
|
|
15557
|
-
return arrow2Left(ctx,
|
|
15543
|
+
return arrow2Left(ctx, size / 4, transX, transY);
|
|
15558
15544
|
}
|
|
15559
15545
|
drawOffset(ctx, size, transX, transY, offset) {
|
|
15560
|
-
return arrow2Left(ctx,
|
|
15546
|
+
return arrow2Left(ctx, size / 4 + offset, transX, transY);
|
|
15561
15547
|
}
|
|
15562
15548
|
}
|
|
15563
15549
|
var arrow2Left$1 = new Arrow2LeftSymbol();
|
|
@@ -15571,10 +15557,10 @@
|
|
|
15571
15557
|
super(...arguments), this.type = "arrow2Right", this.pathStr = "M -0.25 -0.5 l 0.25 0 l -0.25 0.5";
|
|
15572
15558
|
}
|
|
15573
15559
|
draw(ctx, size, transX, transY) {
|
|
15574
|
-
return arrow2Right(ctx,
|
|
15560
|
+
return arrow2Right(ctx, size / 4, transX, transY);
|
|
15575
15561
|
}
|
|
15576
15562
|
drawOffset(ctx, size, transX, transY, offset) {
|
|
15577
|
-
return arrow2Right(ctx,
|
|
15563
|
+
return arrow2Right(ctx, size / 4 + offset, transX, transY);
|
|
15578
15564
|
}
|
|
15579
15565
|
}
|
|
15580
15566
|
var arrow2Right$1 = new Arrow2RightSymbol();
|
|
@@ -15588,10 +15574,10 @@
|
|
|
15588
15574
|
super(...arguments), this.type = "arrow2Up", this.pathStr = "M -0.5 0.25 L 0 -0.25 l 0.5 0.25";
|
|
15589
15575
|
}
|
|
15590
15576
|
draw(ctx, size, transX, transY) {
|
|
15591
|
-
return arrow2Up(ctx,
|
|
15577
|
+
return arrow2Up(ctx, size / 4, transX, transY);
|
|
15592
15578
|
}
|
|
15593
15579
|
drawOffset(ctx, size, transX, transY, offset) {
|
|
15594
|
-
return arrow2Up(ctx,
|
|
15580
|
+
return arrow2Up(ctx, size / 4 + offset, transX, transY);
|
|
15595
15581
|
}
|
|
15596
15582
|
}
|
|
15597
15583
|
var arrow2Up$1 = new Arrow2UpSymbol();
|
|
@@ -15605,10 +15591,10 @@
|
|
|
15605
15591
|
super(...arguments), this.type = "arrow2Down", this.pathStr = "M -0.5 -0.25 L 0 0.25 l 0.5 -0.25";
|
|
15606
15592
|
}
|
|
15607
15593
|
draw(ctx, size, transX, transY) {
|
|
15608
|
-
return arrow2Down(ctx,
|
|
15594
|
+
return arrow2Down(ctx, size / 4, transX, transY);
|
|
15609
15595
|
}
|
|
15610
15596
|
drawOffset(ctx, size, transX, transY, offset) {
|
|
15611
|
-
return arrow2Down(ctx,
|
|
15597
|
+
return arrow2Down(ctx, size / 4 + offset, transX, transY);
|
|
15612
15598
|
}
|
|
15613
15599
|
}
|
|
15614
15600
|
var arrow2Down$1 = new Arrow2DownSymbol();
|
|
@@ -15621,13 +15607,13 @@
|
|
|
15621
15607
|
super(...arguments), this.type = "lineV", this.pathStr = "M0,-0.5L0,0.5";
|
|
15622
15608
|
}
|
|
15623
15609
|
draw(ctx, size, x, y, z) {
|
|
15624
|
-
return lineV(ctx,
|
|
15610
|
+
return lineV(ctx, size / 2, x, y);
|
|
15625
15611
|
}
|
|
15626
15612
|
drawOffset(ctx, size, x, y, offset, z) {
|
|
15627
|
-
return lineV(ctx,
|
|
15613
|
+
return lineV(ctx, size / 2 + offset, x, y);
|
|
15628
15614
|
}
|
|
15629
15615
|
drawToSvgPath(size, x, y, z) {
|
|
15630
|
-
const r =
|
|
15616
|
+
const r = size / 2;
|
|
15631
15617
|
return `M ${x}, ${y - r} L ${x},${y + r}`;
|
|
15632
15618
|
}
|
|
15633
15619
|
}
|
|
@@ -15641,13 +15627,13 @@
|
|
|
15641
15627
|
super(...arguments), this.type = "lineH", this.pathStr = "M-0.5,0L0.5,0";
|
|
15642
15628
|
}
|
|
15643
15629
|
draw(ctx, size, x, y, z) {
|
|
15644
|
-
return lineH(ctx,
|
|
15630
|
+
return lineH(ctx, size / 2, x, y);
|
|
15645
15631
|
}
|
|
15646
15632
|
drawOffset(ctx, size, x, y, offset, z) {
|
|
15647
|
-
return lineH(ctx,
|
|
15633
|
+
return lineH(ctx, size / 2 + offset, x, y);
|
|
15648
15634
|
}
|
|
15649
15635
|
drawToSvgPath(size, x, y, z) {
|
|
15650
|
-
const r =
|
|
15636
|
+
const r = size / 2;
|
|
15651
15637
|
return `M ${x - r}, ${y} L ${x + r},${y}`;
|
|
15652
15638
|
}
|
|
15653
15639
|
}
|
|
@@ -15661,13 +15647,13 @@
|
|
|
15661
15647
|
super(...arguments), this.type = "close", this.pathStr = "M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5";
|
|
15662
15648
|
}
|
|
15663
15649
|
draw(ctx, size, x, y, z) {
|
|
15664
|
-
return close(ctx,
|
|
15650
|
+
return close(ctx, size / 2, x, y);
|
|
15665
15651
|
}
|
|
15666
15652
|
drawOffset(ctx, size, x, y, offset, z) {
|
|
15667
|
-
return close(ctx,
|
|
15653
|
+
return close(ctx, size / 2 + offset, x, y);
|
|
15668
15654
|
}
|
|
15669
15655
|
drawToSvgPath(size, x, y, z) {
|
|
15670
|
-
const r =
|
|
15656
|
+
const r = size / 2;
|
|
15671
15657
|
return `M ${x - r}, ${y - r} L ${x + r},${y + r} M ${x + r}, ${y - r} L ${x - r},${y + r}`;
|
|
15672
15658
|
}
|
|
15673
15659
|
}
|
|
@@ -15701,18 +15687,15 @@
|
|
|
15701
15687
|
this.pathStr = "", this.type = type, isArray$1(path) ? this.svgCache = path : this.path = path, this.isSvg = isSvg;
|
|
15702
15688
|
}
|
|
15703
15689
|
drawOffset(ctx, size, x, y, offset, z, cb) {
|
|
15704
|
-
return
|
|
15690
|
+
return this.isSvg ? !!this.svgCache && (this.svgCache.forEach(item => {
|
|
15705
15691
|
ctx.beginPath(), renderCommandList(item.path.commandList, ctx, x, y, size, size), cb && cb(item.path, item.attribute);
|
|
15706
15692
|
}), !1) : (renderCommandList(this.path.commandList, ctx, x, y, size + offset, size + offset), !1);
|
|
15707
15693
|
}
|
|
15708
15694
|
draw(ctx, size, x, y, z, cb) {
|
|
15709
|
-
return
|
|
15710
|
-
}
|
|
15711
|
-
parseSize(size) {
|
|
15712
|
-
return isNumber$1(size) ? size : Math.min(size[0], size[1]);
|
|
15695
|
+
return this.drawOffset(ctx, size, x, y, 0, z, cb);
|
|
15713
15696
|
}
|
|
15714
15697
|
bounds(size, bounds) {
|
|
15715
|
-
if (
|
|
15698
|
+
if (this.isSvg) {
|
|
15716
15699
|
if (!this.svgCache) return;
|
|
15717
15700
|
return bounds.clear(), void this.svgCache.forEach(_ref => {
|
|
15718
15701
|
let {
|
|
@@ -16395,11 +16378,7 @@
|
|
|
16395
16378
|
case "sub":
|
|
16396
16379
|
baseline += this.descent / 2;
|
|
16397
16380
|
}
|
|
16398
|
-
"vertical" === direction && (ctx.save(), ctx.rotateAbout(Math.PI / 2, left, baseline), ctx.translate(-this.heightOrigin || -this.lineHeight / 2, -this.descent / 2), ctx.translate(left, baseline), left = 0, baseline = 0);
|
|
16399
|
-
const {
|
|
16400
|
-
lineWidth = 1
|
|
16401
|
-
} = this.character;
|
|
16402
|
-
this.character.stroke && lineWidth && (applyStrokeStyle(ctx, this.character), ctx.strokeText(text, left, baseline)), applyFillStyle(ctx, this.character), this.character.fill && ctx.fillText(text, left, baseline), this.character.fill && ("boolean" == typeof this.character.lineThrough || "boolean" == typeof this.character.underline ? (this.character.underline && ctx.fillRect(left, 1 + baseline, this.widthOrigin || this.width, this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1), this.character.lineThrough && ctx.fillRect(left, 1 + baseline - this.ascent / 2, this.widthOrigin || this.width, this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1)) : "underline" === this.character.textDecoration ? ctx.fillRect(left, 1 + baseline, this.widthOrigin || this.width, this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1) : "line-through" === this.character.textDecoration && ctx.fillRect(left, 1 + baseline - this.ascent / 2, this.widthOrigin || this.width, this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1)), "vertical" === direction && ctx.restore();
|
|
16381
|
+
"vertical" === direction && (ctx.save(), ctx.rotateAbout(Math.PI / 2, left, baseline), ctx.translate(-this.heightOrigin || -this.lineHeight / 2, -this.descent / 2), ctx.translate(left, baseline), left = 0, baseline = 0), this.character.stroke && (applyStrokeStyle(ctx, this.character), ctx.strokeText(text, left, baseline)), applyFillStyle(ctx, this.character), this.character.fill && ctx.fillText(text, left, baseline), this.character.fill && ("boolean" == typeof this.character.lineThrough || "boolean" == typeof this.character.underline ? (this.character.underline && ctx.fillRect(left, 1 + baseline, this.widthOrigin || this.width, this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1), this.character.lineThrough && ctx.fillRect(left, 1 + baseline - this.ascent / 2, this.widthOrigin || this.width, this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1)) : "underline" === this.character.textDecoration ? ctx.fillRect(left, 1 + baseline, this.widthOrigin || this.width, this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1) : "line-through" === this.character.textDecoration && ctx.fillRect(left, 1 + baseline - this.ascent / 2, this.widthOrigin || this.width, this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1)), "vertical" === direction && ctx.restore();
|
|
16403
16382
|
}
|
|
16404
16383
|
getWidthWithEllips(direction) {
|
|
16405
16384
|
let text = this.text;
|
|
@@ -18616,7 +18595,7 @@
|
|
|
18616
18595
|
constructor() {
|
|
18617
18596
|
let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
18618
18597
|
var _a;
|
|
18619
|
-
super({}), this.
|
|
18598
|
+
super({}), this._onVisibleChange = visible => {
|
|
18620
18599
|
if (!(this._skipRender < 0)) if (visible) {
|
|
18621
18600
|
if (this.dirtyBounds) {
|
|
18622
18601
|
const b = this.window.getViewBox();
|
|
@@ -18627,10 +18606,7 @@
|
|
|
18627
18606
|
}, this.beforeRender = stage => {
|
|
18628
18607
|
this._beforeRender && this._beforeRender(stage);
|
|
18629
18608
|
}, this.afterRender = stage => {
|
|
18630
|
-
this.renderCount++, this._afterRender && this._afterRender(stage), this._afterNextRenderCbs && this._afterNextRenderCbs.forEach(cb => cb(stage)), this._afterNextRenderCbs = null
|
|
18631
|
-
}, this.afterTickCb = () => {
|
|
18632
|
-
var _a;
|
|
18633
|
-
this.tickedBeforeRender = !0, "performance" === (null === (_a = this.params.optimize) || void 0 === _a ? void 0 : _a.tickRenderMode) || "rendering" !== this.state && this.render();
|
|
18609
|
+
this.renderCount++, this._afterRender && this._afterRender(stage), this._afterNextRenderCbs && this._afterNextRenderCbs.forEach(cb => cb(stage)), this._afterNextRenderCbs = null;
|
|
18634
18610
|
}, this.params = params, this.theme = new Theme(), this.hooks = {
|
|
18635
18611
|
beforeRender: new SyncHook(["stage"]),
|
|
18636
18612
|
afterRender: new SyncHook(["stage"])
|
|
@@ -18647,7 +18623,7 @@
|
|
|
18647
18623
|
main: !0
|
|
18648
18624
|
})), this.nextFrameRenderLayerSet = new Set(), this.willNextFrameRender = !1, this.stage = this, this.renderStyle = params.renderStyle, params.autoRender && this.enableAutoRender(), params.autoRefresh && this.enableAutoRefresh(), !1 === params.disableDirtyBounds && this.enableDirtyBounds(), params.enableHtmlAttribute && this.enableHtmlAttribute(params.enableHtmlAttribute), params.ReactDOM && this.enableReactAttribute(params.ReactDOM), params.enableLayout && this.enableLayout(), this.hooks.beforeRender.tap("constructor", this.beforeRender), this.hooks.afterRender.tap("constructor", this.afterRender), this._beforeRender = params.beforeRender, this._afterRender = params.afterRender, this.ticker = params.ticker || defaultTicker, this.supportInteractiveLayer = !1 !== params.interactiveLayer, this.timeline = new DefaultTimeline(), this.ticker.addTimeline(this.timeline), this.timeline.pause(), params.optimize || (params.optimize = {}), this.optmize(params.optimize), params.background && isString$1(this._background) && this._background.includes("/") && this.setAttributes({
|
|
18649
18625
|
background: this._background
|
|
18650
|
-
})
|
|
18626
|
+
});
|
|
18651
18627
|
}
|
|
18652
18628
|
pauseRender() {
|
|
18653
18629
|
let sr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1;
|
|
@@ -18876,7 +18852,7 @@
|
|
|
18876
18852
|
if ("released" === this.releaseStatus) return;
|
|
18877
18853
|
this.ticker.start(), this.timeline.resume();
|
|
18878
18854
|
const state = this.state;
|
|
18879
|
-
this.state = "rendering", this.
|
|
18855
|
+
this.state = "rendering", this.layerService.prepareStageLayer(this), this._skipRender || (this.lastRenderparams = params, this.hooks.beforeRender.call(this), this._skipRender || (this.renderLayerList(this.children), this.combineLayersToWindow(), this.nextFrameRenderLayerSet.clear()), this.hooks.afterRender.call(this)), this.state = state, this._skipRender && this._skipRender++;
|
|
18880
18856
|
}
|
|
18881
18857
|
combineLayersToWindow() {
|
|
18882
18858
|
if ("harmony" === this.global.env) {
|
|
@@ -18982,7 +18958,7 @@
|
|
|
18982
18958
|
layer.release();
|
|
18983
18959
|
}), this.interactiveLayer && (this.interactiveLayer.forEachChildren(item => {
|
|
18984
18960
|
item.setStage && item.setStage(null, null), this.interactiveLayer.removeChild(item);
|
|
18985
|
-
}), this.interactiveLayer.release()), this.window.release(), this.ticker.remTimeline(this.timeline), this.
|
|
18961
|
+
}), this.interactiveLayer.release()), this.window.release(), this.ticker.remTimeline(this.timeline), this.renderService.renderTreeRoots = [];
|
|
18986
18962
|
}
|
|
18987
18963
|
setStage(stage) {}
|
|
18988
18964
|
dirty(b, matrix) {
|
|
@@ -19060,6 +19036,8 @@
|
|
|
19060
19036
|
return new Stage(params);
|
|
19061
19037
|
}
|
|
19062
19038
|
|
|
19039
|
+
const strCommandMap = ["arc", "arcTo", "bezierCurveTo", "closePath", "ellipse", "lineTo", "moveTo", "quadraticCurveTo", "rect"];
|
|
19040
|
+
|
|
19063
19041
|
var __decorate$1d = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
19064
19042
|
var d,
|
|
19065
19043
|
c = arguments.length,
|
|
@@ -23680,9 +23658,11 @@
|
|
|
23680
23658
|
name: name,
|
|
23681
23659
|
id: id,
|
|
23682
23660
|
attribute: attribute,
|
|
23683
|
-
stateProxy: stateProxy
|
|
23661
|
+
stateProxy: stateProxy,
|
|
23662
|
+
animation: animation,
|
|
23663
|
+
timeline: timeline
|
|
23684
23664
|
} = _a,
|
|
23685
|
-
props = __rest(_a, ["key", "name", "id", "attribute", "stateProxy"]);
|
|
23665
|
+
props = __rest(_a, ["key", "name", "id", "attribute", "stateProxy", "animation", "timeline"]);
|
|
23686
23666
|
let c = type;
|
|
23687
23667
|
isString$1(type) && (c = graphicCreator[type]);
|
|
23688
23668
|
const childrenList = [];
|
|
@@ -23691,7 +23671,13 @@
|
|
|
23691
23671
|
}
|
|
23692
23672
|
children.length && flatten(1 === children.length ? children[0] : children, childrenList);
|
|
23693
23673
|
const g = "Group" === c.name ? new c(attribute) : c(config);
|
|
23694
|
-
|
|
23674
|
+
if (parseToGraphic$1(g, childrenList, props), stateProxy && (g.stateProxy = stateProxy), name && (g.name = name), isArray$1(animation)) {
|
|
23675
|
+
const animate = g.animate();
|
|
23676
|
+
timeline && animate.setTimeline(timeline), animation.forEach(item => {
|
|
23677
|
+
animate[item[0]](...item.slice(1));
|
|
23678
|
+
});
|
|
23679
|
+
}
|
|
23680
|
+
return g;
|
|
23695
23681
|
}
|
|
23696
23682
|
function parseToGraphic$1(g, childrenList, props) {
|
|
23697
23683
|
let out,
|
|
@@ -23959,7 +23945,7 @@
|
|
|
23959
23945
|
startTime: startTime,
|
|
23960
23946
|
startPoints: startPoints
|
|
23961
23947
|
} = this;
|
|
23962
|
-
if (
|
|
23948
|
+
if (eventType) return eventType;
|
|
23963
23949
|
let type;
|
|
23964
23950
|
return type = clock.now() - startTime > this.config.press.time && calcDistance(startPoints[0], point) < this.config.press.threshold ? "press" : "pan", this.eventType = type, type;
|
|
23965
23951
|
}
|
|
@@ -24491,10 +24477,9 @@
|
|
|
24491
24477
|
lineJoin = defaultParams.lineJoin,
|
|
24492
24478
|
lineDash = defaultParams.lineDash,
|
|
24493
24479
|
lineCap = defaultParams.lineCap,
|
|
24494
|
-
miterLimit = defaultParams.miterLimit
|
|
24495
|
-
keepStrokeScale = defaultParams.keepStrokeScale
|
|
24480
|
+
miterLimit = defaultParams.miterLimit
|
|
24496
24481
|
} = attribute;
|
|
24497
|
-
_context.lineWidth =
|
|
24482
|
+
_context.lineWidth = getScaledStroke(this, lineWidth, this.dpr), _context.strokeStyle = createColor(this, stroke, params, offsetX, offsetY), _context.lineJoin = lineJoin, lineDash && _context.setLineDash(lineDash), _context.lineCap = lineCap, _context.miterLimit = miterLimit;
|
|
24498
24483
|
}
|
|
24499
24484
|
}
|
|
24500
24485
|
setTextStyleWithoutAlignBaseline(params, defaultParams, z) {
|
|
@@ -24918,7 +24903,7 @@
|
|
|
24918
24903
|
function createImageElement$1(src) {
|
|
24919
24904
|
let isSvg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
|
24920
24905
|
const img = document.createElement("img");
|
|
24921
|
-
if (img.crossOrigin = "anonymous", isSvg) {
|
|
24906
|
+
if (application.global.isImageAnonymous && (img.crossOrigin = "anonymous"), isSvg) {
|
|
24922
24907
|
const data = new Blob([src], {
|
|
24923
24908
|
type: "image/svg+xml"
|
|
24924
24909
|
});
|
|
@@ -25394,9 +25379,8 @@
|
|
|
25394
25379
|
return this.canvasRenderer.drawShape(graphic, pickContext, x, y, {}, null, (context, arcAttribute, themeAttribute) => !!picked || (picked = context.isPointInPath(point.x, point.y), picked), (context, arcAttribute, themeAttribute) => {
|
|
25395
25380
|
if (picked) return !0;
|
|
25396
25381
|
const lineWidth = arcAttribute.lineWidth || themeAttribute.lineWidth,
|
|
25397
|
-
pickStrokeBuffer = arcAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer
|
|
25398
|
-
|
|
25399
|
-
return pickContext.lineWidth = keepStrokeScale ? lineWidth + pickStrokeBuffer : getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(point.x, point.y), picked;
|
|
25382
|
+
pickStrokeBuffer = arcAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer;
|
|
25383
|
+
return pickContext.lineWidth = getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(point.x, point.y), picked;
|
|
25400
25384
|
}), pickContext.highPerformanceRestore(), picked;
|
|
25401
25385
|
}
|
|
25402
25386
|
}
|
|
@@ -25669,9 +25653,8 @@
|
|
|
25669
25653
|
if (!onlyTranslate || rect.shadowRoot || isNumber$1(cornerRadius, !0) && 0 !== cornerRadius || isArray$1(cornerRadius) && cornerRadius.some(num => 0 !== num)) picked = !1, this.canvasRenderer.drawShape(rect, pickContext, x, y, {}, null, (context, rectAttribute, themeAttribute) => !!picked || (picked = context.isPointInPath(point.x, point.y), picked), (context, rectAttribute, themeAttribute) => {
|
|
25670
25654
|
if (picked) return !0;
|
|
25671
25655
|
const lineWidth = rectAttribute.lineWidth || themeAttribute.lineWidth,
|
|
25672
|
-
pickStrokeBuffer = rectAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer
|
|
25673
|
-
|
|
25674
|
-
return pickContext.lineWidth = keepStrokeScale ? lineWidth + pickStrokeBuffer : getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(point.x, point.y), picked;
|
|
25656
|
+
pickStrokeBuffer = rectAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer;
|
|
25657
|
+
return pickContext.lineWidth = getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(point.x, point.y), picked;
|
|
25675
25658
|
});else {
|
|
25676
25659
|
const {
|
|
25677
25660
|
fill = rectAttribute.fill,
|
|
@@ -25985,10 +25968,9 @@
|
|
|
25985
25968
|
lineJoin = defaultParams.lineJoin,
|
|
25986
25969
|
lineDash = defaultParams.lineDash,
|
|
25987
25970
|
lineCap = defaultParams.lineCap,
|
|
25988
|
-
miterLimit = defaultParams.miterLimit
|
|
25989
|
-
keepStrokeScale = defaultParams.keepStrokeScale
|
|
25971
|
+
miterLimit = defaultParams.miterLimit
|
|
25990
25972
|
} = attribute;
|
|
25991
|
-
_context.globalAlpha = strokeOpacity * opacity * this.baseGlobalAlpha, _context.lineWidth =
|
|
25973
|
+
_context.globalAlpha = strokeOpacity * opacity * this.baseGlobalAlpha, _context.lineWidth = getScaledStroke(this, lineWidth, this.dpr), _context.strokeStyle = createColor(this, stroke, params, offsetX, offsetY), _context.lineJoin = lineJoin, 0 === lineDash[0] && 0 === lineDash[1] || lineDash && _context.setLineDash(lineDash), _context.lineCap = lineCap, _context.miterLimit = miterLimit;
|
|
25992
25974
|
}
|
|
25993
25975
|
}
|
|
25994
25976
|
measureText(text) {
|
|
@@ -26616,10 +26598,9 @@
|
|
|
26616
26598
|
lineJoin = defaultParams.lineJoin,
|
|
26617
26599
|
lineDash = defaultParams.lineDash,
|
|
26618
26600
|
lineCap = defaultParams.lineCap,
|
|
26619
|
-
miterLimit = defaultParams.miterLimit
|
|
26620
|
-
keepStrokeScale = defaultParams.keepStrokeScale
|
|
26601
|
+
miterLimit = defaultParams.miterLimit
|
|
26621
26602
|
} = attribute;
|
|
26622
|
-
_context.setGlobalAlpha(strokeOpacity * opacity), _context.setLineWidth(
|
|
26603
|
+
_context.setGlobalAlpha(strokeOpacity * opacity), _context.setLineWidth(getScaledStroke(this, lineWidth, this.dpr)), _context.setStrokeStyle(createColor(this, stroke, params, offsetX, offsetY)), _context.setLineJoin(lineJoin), lineDash && _context.setLineDash(lineDash), _context.setLineCap(lineCap), _context.setMiterLimit(miterLimit);
|
|
26623
26604
|
}
|
|
26624
26605
|
}
|
|
26625
26606
|
setTextStyleWithoutAlignBaseline(params, defaultParams) {
|
|
@@ -27659,10 +27640,9 @@
|
|
|
27659
27640
|
lineJoin = defaultParams.lineJoin,
|
|
27660
27641
|
lineDash = defaultParams.lineDash,
|
|
27661
27642
|
lineCap = defaultParams.lineCap,
|
|
27662
|
-
miterLimit = defaultParams.miterLimit
|
|
27663
|
-
keepStrokeScale = defaultParams.keepStrokeScale
|
|
27643
|
+
miterLimit = defaultParams.miterLimit
|
|
27664
27644
|
} = attribute;
|
|
27665
|
-
_context.globalAlpha = strokeOpacity * opacity * this.baseGlobalAlpha, _context.lineWidth =
|
|
27645
|
+
_context.globalAlpha = strokeOpacity * opacity * this.baseGlobalAlpha, _context.lineWidth = getScaledStroke(this, lineWidth, this.dpr), _context.strokeStyle = createColor(this, stroke, params, offsetX, offsetY), _context.lineJoin = lineJoin, 0 === lineDash[0] && 0 === lineDash[1] || lineDash && _context.setLineDash(lineDash), _context.lineCap = lineCap, _context.miterLimit = miterLimit;
|
|
27666
27646
|
}
|
|
27667
27647
|
}
|
|
27668
27648
|
measureText(text) {
|
|
@@ -28069,9 +28049,8 @@
|
|
|
28069
28049
|
return this.canvasRenderer.drawShape(graphic, pickContext, x, y, {}, null, context => !!picked || (picked = context.isPointInPath(pickPoint.x, pickPoint.y), picked), (context, lineAttribute, themeAttribute) => {
|
|
28070
28050
|
if (picked) return !0;
|
|
28071
28051
|
const lineWidth = lineAttribute.lineWidth || themeAttribute.lineWidth,
|
|
28072
|
-
pickStrokeBuffer = lineAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer
|
|
28073
|
-
|
|
28074
|
-
return pickContext.lineWidth = keepStrokeScale ? lineWidth + pickStrokeBuffer : getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(pickPoint.x, pickPoint.y), picked;
|
|
28052
|
+
pickStrokeBuffer = lineAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer;
|
|
28053
|
+
return pickContext.lineWidth = getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(pickPoint.x, pickPoint.y), picked;
|
|
28075
28054
|
}), this.canvasRenderer.z = 0, pickContext.modelMatrix !== lastModelMatrix && mat4Allocate.free(pickContext.modelMatrix), pickContext.modelMatrix = lastModelMatrix, pickContext.highPerformanceRestore(), picked;
|
|
28076
28055
|
}
|
|
28077
28056
|
}
|
|
@@ -28206,9 +28185,8 @@
|
|
|
28206
28185
|
return this.canvasRenderer.drawShape(symbol, pickContext, x, y, {}, null, (context, symbolAttribute, themeAttribute) => !!picked || (picked = context.isPointInPath(pickPoint.x, pickPoint.y), picked), (context, symbolAttribute, themeAttribute) => {
|
|
28207
28186
|
if (picked) return !0;
|
|
28208
28187
|
const lineWidth = symbolAttribute.lineWidth || themeAttribute.lineWidth,
|
|
28209
|
-
pickStrokeBuffer = symbolAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer
|
|
28210
|
-
|
|
28211
|
-
return pickContext.lineWidth = keepStrokeScale ? lineWidth + pickStrokeBuffer : getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(pickPoint.x, pickPoint.y), picked;
|
|
28188
|
+
pickStrokeBuffer = symbolAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer;
|
|
28189
|
+
return pickContext.lineWidth = getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(pickPoint.x, pickPoint.y), picked;
|
|
28212
28190
|
}), this.canvasRenderer.z = 0, pickContext.modelMatrix !== lastModelMatrix && mat4Allocate.free(pickContext.modelMatrix), pickContext.modelMatrix = lastModelMatrix, pickContext.highPerformanceRestore(), picked;
|
|
28213
28191
|
}
|
|
28214
28192
|
};
|
|
@@ -28645,7 +28623,7 @@
|
|
|
28645
28623
|
|
|
28646
28624
|
const roughModule = _roughModule;
|
|
28647
28625
|
|
|
28648
|
-
const version = "0.21.0-alpha.
|
|
28626
|
+
const version = "0.21.0-alpha.13";
|
|
28649
28627
|
preLoadAllModule();
|
|
28650
28628
|
if (isBrowserEnv()) {
|
|
28651
28629
|
loadBrowserEnv(container);
|