@visactor/vrender 0.21.0-alpha.3 → 0.21.0-beta.0
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 +10 -11
- package/cjs/index.js.map +1 -1
- package/dist/index.es.js +482 -379
- package/dist/index.js +482 -379
- 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 +5 -5
package/dist/index.es.js
CHANGED
|
@@ -3913,7 +3913,6 @@ const DefaultStrokeStyle = Object.assign({
|
|
|
3913
3913
|
const DefaultTextStyle = {
|
|
3914
3914
|
text: "",
|
|
3915
3915
|
maxLineWidth: 1 / 0,
|
|
3916
|
-
maxWidth: 1 / 0,
|
|
3917
3916
|
textAlign: "left",
|
|
3918
3917
|
textBaseline: "alphabetic",
|
|
3919
3918
|
fontSize: 16,
|
|
@@ -3991,7 +3990,8 @@ const DefaultAttribute = Object.assign(Object.assign(Object.assign({
|
|
|
3991
3990
|
globalZIndex: 1,
|
|
3992
3991
|
globalCompositeOperation: "",
|
|
3993
3992
|
overflow: "hidden",
|
|
3994
|
-
shadowPickMode: "graphic"
|
|
3993
|
+
shadowPickMode: "graphic",
|
|
3994
|
+
keepStrokeScale: !1
|
|
3995
3995
|
}, DefaultDebugAttribute), DefaultStyle), DefaultTransform);
|
|
3996
3996
|
function addAttributeToPrototype(obj, c, keys) {
|
|
3997
3997
|
keys.forEach(key => {
|
|
@@ -4266,32 +4266,10 @@ let ATextMeasure = class {
|
|
|
4266
4266
|
configure(service, env) {
|
|
4267
4267
|
this.canvas = service.canvas, this.context = service.context, service.bindTextMeasure(this);
|
|
4268
4268
|
}
|
|
4269
|
-
|
|
4269
|
+
measureTextWidth(text, options) {
|
|
4270
|
+
if (!this.context) return this.estimate(text, options).width;
|
|
4270
4271
|
this.context.setTextStyleWithoutAlignBaseline(options);
|
|
4271
|
-
|
|
4272
|
-
return compatible ? this.compatibleMetrics(metrics, options) : metrics;
|
|
4273
|
-
}
|
|
4274
|
-
_measureTextWithAlignBaseline(text, options, compatible) {
|
|
4275
|
-
this.context.setTextStyle(options);
|
|
4276
|
-
const metrics = this.context.measureText(text);
|
|
4277
|
-
return compatible ? this.compatibleMetrics(metrics, options) : metrics;
|
|
4278
|
-
}
|
|
4279
|
-
compatibleMetrics(metrics, options) {
|
|
4280
|
-
if (null == metrics.actualBoundingBoxAscent || null == metrics.actualBoundingBoxDescent || null == metrics.fontBoundingBoxAscent || null == metrics.fontBoundingBoxDescent) {
|
|
4281
|
-
const {
|
|
4282
|
-
ascent: ascent,
|
|
4283
|
-
descent: descent
|
|
4284
|
-
} = this.measureTextBoundADscentEstimate(options);
|
|
4285
|
-
metrics.actualBoundingBoxAscent = ascent, metrics.actualBoundingBoxDescent = descent, metrics.fontBoundingBoxAscent = ascent, metrics.fontBoundingBoxDescent = descent;
|
|
4286
|
-
}
|
|
4287
|
-
if (null == metrics.actualBoundingBoxLeft || null == metrics.actualBoundingBoxRight) {
|
|
4288
|
-
const {
|
|
4289
|
-
left: left,
|
|
4290
|
-
right: right
|
|
4291
|
-
} = this.measureTextBoundLeftRightEstimate(options);
|
|
4292
|
-
metrics.actualBoundingBoxLeft = left, metrics.actualBoundingBoxRight = right;
|
|
4293
|
-
}
|
|
4294
|
-
return metrics;
|
|
4272
|
+
return this.context.measureText(text).width;
|
|
4295
4273
|
}
|
|
4296
4274
|
estimate(text, _ref) {
|
|
4297
4275
|
let {
|
|
@@ -4305,85 +4283,19 @@ let ATextMeasure = class {
|
|
|
4305
4283
|
height: fontSize
|
|
4306
4284
|
};
|
|
4307
4285
|
}
|
|
4308
|
-
|
|
4309
|
-
return this.context ? (textMeasure = null != textMeasure ? textMeasure : this._measureTextWithoutAlignBaseline(text, options)).width : this.estimate(text, options).width;
|
|
4310
|
-
}
|
|
4311
|
-
measureTextBoundsWidth(text, options, textMeasure) {
|
|
4312
|
-
return this.context ? (textMeasure = null != textMeasure ? textMeasure : this._measureTextWithoutAlignBaseline(text, options)).width : this.estimate(text, options).width;
|
|
4313
|
-
}
|
|
4314
|
-
measureTextBoundsLeftRight(text, options, textMeasure) {
|
|
4315
|
-
return this.context ? {
|
|
4316
|
-
left: (textMeasure = null != textMeasure ? textMeasure : this._measureTextWithAlignBaseline(text, options, !0)).actualBoundingBoxLeft,
|
|
4317
|
-
right: textMeasure.actualBoundingBoxRight
|
|
4318
|
-
} : this.measureTextBoundLeftRightEstimate(options);
|
|
4319
|
-
}
|
|
4320
|
-
measureTextPixelHeight(text, options, textMeasure) {
|
|
4286
|
+
measureTextPixelHeight(text, options) {
|
|
4321
4287
|
var _a;
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
return
|
|
4326
|
-
ascent: (textMeasure = null != textMeasure ? textMeasure : this._measureTextWithAlignBaseline(text, options, !0)).actualBoundingBoxAscent,
|
|
4327
|
-
descent: textMeasure.actualBoundingBoxDescent
|
|
4328
|
-
} : this.measureTextBoundADscentEstimate(options);
|
|
4329
|
-
}
|
|
4330
|
-
measureTextBoundHieght(text, options, textMeasure) {
|
|
4331
|
-
var _a;
|
|
4332
|
-
return this.context ? (textMeasure = null != textMeasure ? textMeasure : this._measureTextWithoutAlignBaseline(text, options, !0), Math.abs(textMeasure.fontBoundingBoxAscent - textMeasure.fontBoundingBoxDescent)) : null !== (_a = options.fontSize) && void 0 !== _a ? _a : DefaultTextStyle.fontSize;
|
|
4333
|
-
}
|
|
4334
|
-
measureTextBoundADscent(text, options, textMeasure) {
|
|
4335
|
-
return this.context ? {
|
|
4336
|
-
ascent: (textMeasure = null != textMeasure ? textMeasure : this._measureTextWithAlignBaseline(text, options, !0)).fontBoundingBoxAscent,
|
|
4337
|
-
descent: textMeasure.fontBoundingBoxDescent
|
|
4338
|
-
} : this.measureTextBoundADscentEstimate(options);
|
|
4339
|
-
}
|
|
4340
|
-
measureTextBoundADscentEstimate(options) {
|
|
4341
|
-
var _a;
|
|
4342
|
-
const fontSize = null !== (_a = options.fontSize) && void 0 !== _a ? _a : DefaultTextStyle.fontSize,
|
|
4343
|
-
{
|
|
4344
|
-
textBaseline: textBaseline
|
|
4345
|
-
} = options;
|
|
4346
|
-
return "bottom" === textBaseline ? {
|
|
4347
|
-
ascent: fontSize,
|
|
4348
|
-
descent: 0
|
|
4349
|
-
} : "middle" === textBaseline ? {
|
|
4350
|
-
ascent: fontSize / 2,
|
|
4351
|
-
descent: fontSize / 2
|
|
4352
|
-
} : "alphabetic" === textBaseline ? {
|
|
4353
|
-
ascent: .79 * fontSize,
|
|
4354
|
-
descent: .21 * fontSize
|
|
4355
|
-
} : {
|
|
4356
|
-
ascent: 0,
|
|
4357
|
-
descent: fontSize
|
|
4358
|
-
};
|
|
4288
|
+
if (!this.context) return null !== (_a = options.fontSize) && void 0 !== _a ? _a : DefaultTextStyle.fontSize;
|
|
4289
|
+
this.context.setTextStyleWithoutAlignBaseline(options);
|
|
4290
|
+
const textMeasure = this.context.measureText(text);
|
|
4291
|
+
return Math.abs(textMeasure.actualBoundingBoxAscent - textMeasure.actualBoundingBoxDescent);
|
|
4359
4292
|
}
|
|
4360
|
-
|
|
4293
|
+
measureTextBoundHieght(text, options) {
|
|
4361
4294
|
var _a;
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
return "center" === textAlign ? {
|
|
4367
|
-
left: fontSize / 2,
|
|
4368
|
-
right: fontSize / 2
|
|
4369
|
-
} : "right" === textAlign || "end" === textAlign ? {
|
|
4370
|
-
left: fontSize,
|
|
4371
|
-
right: 0
|
|
4372
|
-
} : {
|
|
4373
|
-
left: 0,
|
|
4374
|
-
right: fontSize
|
|
4375
|
-
};
|
|
4376
|
-
}
|
|
4377
|
-
measureTextPixelADscentAndWidth(text, options) {
|
|
4378
|
-
if (!this.context) return Object.assign(Object.assign({}, this.measureTextBoundADscentEstimate(options)), {
|
|
4379
|
-
width: this.estimate(text, options).width
|
|
4380
|
-
});
|
|
4381
|
-
const out = this._measureTextWithoutAlignBaseline(text, options, !0);
|
|
4382
|
-
return {
|
|
4383
|
-
ascent: out.actualBoundingBoxAscent,
|
|
4384
|
-
descent: out.actualBoundingBoxDescent,
|
|
4385
|
-
width: out.width
|
|
4386
|
-
};
|
|
4295
|
+
if (!this.context) return null !== (_a = options.fontSize) && void 0 !== _a ? _a : DefaultTextStyle.fontSize;
|
|
4296
|
+
this.context.setTextStyleWithoutAlignBaseline(options);
|
|
4297
|
+
const textMeasure = this.context.measureText(text);
|
|
4298
|
+
return Math.abs(textMeasure.fontBoundingBoxAscent - textMeasure.fontBoundingBoxDescent);
|
|
4387
4299
|
}
|
|
4388
4300
|
measureText(text, options) {
|
|
4389
4301
|
return this.context ? (this.context.setTextStyleWithoutAlignBaseline(options), this.context.measureText(text)) : this.estimate(text, options);
|
|
@@ -6495,7 +6407,7 @@ class TimeOutTickHandler {
|
|
|
6495
6407
|
}
|
|
6496
6408
|
}
|
|
6497
6409
|
|
|
6498
|
-
class DefaultTicker {
|
|
6410
|
+
class DefaultTicker extends EventEmitter {
|
|
6499
6411
|
set mode(m) {
|
|
6500
6412
|
this._mode !== m && (this._mode = m, this.setupTickHandler());
|
|
6501
6413
|
}
|
|
@@ -6504,17 +6416,17 @@ class DefaultTicker {
|
|
|
6504
6416
|
}
|
|
6505
6417
|
constructor() {
|
|
6506
6418
|
let timelines = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
6507
|
-
this.handleTick = (handler, params) => {
|
|
6419
|
+
super(), this.handleTick = (handler, params) => {
|
|
6508
6420
|
const {
|
|
6509
6421
|
once = !1
|
|
6510
6422
|
} = null != params ? params : {};
|
|
6511
|
-
this.ifCanStop() ? this.stop() : (this._handlerTick(
|
|
6512
|
-
}, this._handlerTick =
|
|
6423
|
+
this.ifCanStop() ? this.stop() : (this._handlerTick(), once || handler.tick(this.interval, this.handleTick));
|
|
6424
|
+
}, this._handlerTick = () => {
|
|
6513
6425
|
const time = this.tickerHandler.getTime();
|
|
6514
6426
|
let delta = 0;
|
|
6515
6427
|
this.lastFrameTime >= 0 && (delta = time - this.lastFrameTime), this.lastFrameTime = time, this.status === STATUS$1.RUNNING && (this.tickCounts++, this.timelines.forEach(t => {
|
|
6516
6428
|
t.tick(delta);
|
|
6517
|
-
}));
|
|
6429
|
+
}), this.emit("afterTick"));
|
|
6518
6430
|
}, this.init(), this.lastFrameTime = -1, this.tickCounts = 0, this.timelines = timelines, this.autoStop = !0;
|
|
6519
6431
|
}
|
|
6520
6432
|
init() {
|
|
@@ -6610,6 +6522,9 @@ class DefaultTicker {
|
|
|
6610
6522
|
stop() {
|
|
6611
6523
|
this.status = STATUS$1.INITIAL, this.setupTickHandler(), this.lastFrameTime = -1;
|
|
6612
6524
|
}
|
|
6525
|
+
trySyncTickStatus() {
|
|
6526
|
+
this.status === STATUS$1.RUNNING && this._handlerTick();
|
|
6527
|
+
}
|
|
6613
6528
|
}
|
|
6614
6529
|
|
|
6615
6530
|
class ManualTickHandler {
|
|
@@ -7751,7 +7666,7 @@ class TagPointsUpdate extends ACustomAnimate {
|
|
|
7751
7666
|
lastMatchedIndex = i, lastMatchedPoint = tagMap.get(this.toPoints[i].context);
|
|
7752
7667
|
break;
|
|
7753
7668
|
}
|
|
7754
|
-
"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);
|
|
7669
|
+
"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], 1 === this.clipRange && (this.shrinkClipRange = this.toPoints[lastMatchedIndex][this.clipRangeByDimension] / this.fromPoints[this.fromPoints.length - 1][this.clipRangeByDimension]), isValidNumber$1(this.clipRange) ? this.clipRange = clamp$1(this.clipRange, 0, 1) : this.clipRange = 0) : this.clipRange = 0);
|
|
7755
7670
|
let prevMatchedPoint = this.toPoints[0];
|
|
7756
7671
|
this.interpolatePoints = this.toPoints.map((point, index) => {
|
|
7757
7672
|
const matchedPoint = tagMap.get(point.context);
|
|
@@ -7763,11 +7678,19 @@ class TagPointsUpdate extends ACustomAnimate {
|
|
|
7763
7678
|
return newPoint.defined = toPoint.defined, newPoint.context = toPoint.context, newPoint;
|
|
7764
7679
|
});
|
|
7765
7680
|
}
|
|
7681
|
+
onFirstRun() {
|
|
7682
|
+
const lastClipRange = this.target.attribute.clipRange;
|
|
7683
|
+
isValidNumber$1(lastClipRange * this.clipRange) && (this.clipRange *= lastClipRange);
|
|
7684
|
+
}
|
|
7766
7685
|
onUpdate(end, ratio, out) {
|
|
7767
7686
|
if (this.points = this.points.map((point, index) => {
|
|
7768
7687
|
const newPoint = pointInterpolation(this.interpolatePoints[index][0], this.interpolatePoints[index][1], ratio);
|
|
7769
7688
|
return newPoint.context = point.context, newPoint;
|
|
7770
|
-
}), this.clipRange
|
|
7689
|
+
}), this.clipRange) {
|
|
7690
|
+
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));
|
|
7691
|
+
out.clipRange = this.clipRange + (1 - this.clipRange) * ratio;
|
|
7692
|
+
}
|
|
7693
|
+
if (this.segmentsCache && this.to.segments) {
|
|
7771
7694
|
let start = 0;
|
|
7772
7695
|
out.segments = this.to.segments.map((segment, index) => {
|
|
7773
7696
|
const end = start + this.segmentsCache[index],
|
|
@@ -12121,7 +12044,8 @@ class DefaultArcRenderContribution {
|
|
|
12121
12044
|
x: originX = arcAttribute.x,
|
|
12122
12045
|
y: originY = arcAttribute.y,
|
|
12123
12046
|
scaleX = arcAttribute.scaleX,
|
|
12124
|
-
scaleY = arcAttribute.scaleY
|
|
12047
|
+
scaleY = arcAttribute.scaleY,
|
|
12048
|
+
keepStrokeScale = arcAttribute.keepStrokeScale
|
|
12125
12049
|
} = arc.attribute;
|
|
12126
12050
|
let {
|
|
12127
12051
|
innerRadius = arcAttribute.innerRadius,
|
|
@@ -12133,7 +12057,7 @@ class DefaultArcRenderContribution {
|
|
|
12133
12057
|
{
|
|
12134
12058
|
distance = arcAttribute[key].distance
|
|
12135
12059
|
} = borderStyle,
|
|
12136
|
-
d = getScaledStroke(context, distance, context.dpr),
|
|
12060
|
+
d = keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr),
|
|
12137
12061
|
deltaAngle = distance / outerRadius,
|
|
12138
12062
|
sign = "outerBorder" === key ? 1 : -1;
|
|
12139
12063
|
if (arc.setAttributes({
|
|
@@ -12178,14 +12102,15 @@ class DefaultCircleRenderContribution {
|
|
|
12178
12102
|
x: originX = circleAttribute.x,
|
|
12179
12103
|
y: originY = circleAttribute.y,
|
|
12180
12104
|
scaleX = circleAttribute.scaleX,
|
|
12181
|
-
scaleY = circleAttribute.scaleY
|
|
12105
|
+
scaleY = circleAttribute.scaleY,
|
|
12106
|
+
keepStrokeScale = circleAttribute.keepStrokeScale
|
|
12182
12107
|
} = circle.attribute,
|
|
12183
12108
|
renderBorder = (borderStyle, key) => {
|
|
12184
12109
|
const doStroke = !(!borderStyle || !borderStyle.stroke),
|
|
12185
12110
|
{
|
|
12186
12111
|
distance = circleAttribute[key].distance
|
|
12187
12112
|
} = borderStyle,
|
|
12188
|
-
d = getScaledStroke(context, distance, context.dpr),
|
|
12113
|
+
d = keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr),
|
|
12189
12114
|
sign = "outerBorder" === key ? 1 : -1;
|
|
12190
12115
|
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) {
|
|
12191
12116
|
const lastOpacity = circleAttribute[key].opacity;
|
|
@@ -12304,7 +12229,8 @@ class DefaultRectRenderContribution {
|
|
|
12304
12229
|
scaleX = rectAttribute.scaleX,
|
|
12305
12230
|
scaleY = rectAttribute.scaleY,
|
|
12306
12231
|
x1: x1,
|
|
12307
|
-
y1: y1
|
|
12232
|
+
y1: y1,
|
|
12233
|
+
keepStrokeScale = rectAttribute.keepStrokeScale
|
|
12308
12234
|
} = rect.attribute;
|
|
12309
12235
|
let {
|
|
12310
12236
|
width: width,
|
|
@@ -12317,7 +12243,7 @@ class DefaultRectRenderContribution {
|
|
|
12317
12243
|
{
|
|
12318
12244
|
distance = rectAttribute[key].distance
|
|
12319
12245
|
} = borderStyle,
|
|
12320
|
-
d = getScaledStroke(context, distance, context.dpr),
|
|
12246
|
+
d = keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr),
|
|
12321
12247
|
nextX = x + sign * d,
|
|
12322
12248
|
nextY = y + sign * d,
|
|
12323
12249
|
dw = 2 * d;
|
|
@@ -12474,14 +12400,15 @@ class DefaultSymbolRenderContribution {
|
|
|
12474
12400
|
x: originX = symbolAttribute.x,
|
|
12475
12401
|
y: originY = symbolAttribute.y,
|
|
12476
12402
|
scaleX = symbolAttribute.scaleX,
|
|
12477
|
-
scaleY = symbolAttribute.scaleY
|
|
12403
|
+
scaleY = symbolAttribute.scaleY,
|
|
12404
|
+
keepStrokeScale = symbolAttribute.keepStrokeScale
|
|
12478
12405
|
} = symbol.attribute,
|
|
12479
12406
|
renderBorder = (borderStyle, key) => {
|
|
12480
12407
|
const doStroke = !(!borderStyle || !borderStyle.stroke),
|
|
12481
12408
|
{
|
|
12482
12409
|
distance = symbolAttribute[key].distance
|
|
12483
12410
|
} = borderStyle,
|
|
12484
|
-
d = getScaledStroke(context, distance, context.dpr),
|
|
12411
|
+
d = keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr),
|
|
12485
12412
|
sign = "outerBorder" === key ? 1 : -1;
|
|
12486
12413
|
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) {
|
|
12487
12414
|
const lastOpacity = symbolAttribute[key].opacity;
|
|
@@ -13790,50 +13717,77 @@ let DefaultCanvasTextRender = class extends BaseRender {
|
|
|
13790
13717
|
}
|
|
13791
13718
|
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());
|
|
13792
13719
|
};
|
|
13793
|
-
if (
|
|
13794
|
-
|
|
13795
|
-
|
|
13796
|
-
|
|
13797
|
-
|
|
13798
|
-
|
|
13799
|
-
|
|
13800
|
-
|
|
13801
|
-
|
|
13802
|
-
|
|
13803
|
-
context
|
|
13804
|
-
|
|
13805
|
-
|
|
13806
|
-
|
|
13720
|
+
if (text.isMultiLine) {
|
|
13721
|
+
if (context.setTextStyleWithoutAlignBaseline(text.attribute, textAttribute, z), "horizontal" === direction) {
|
|
13722
|
+
const {
|
|
13723
|
+
multilineLayout: multilineLayout
|
|
13724
|
+
} = text;
|
|
13725
|
+
if (!multilineLayout) return void context.highPerformanceRestore();
|
|
13726
|
+
const {
|
|
13727
|
+
xOffset: xOffset,
|
|
13728
|
+
yOffset: yOffset
|
|
13729
|
+
} = multilineLayout.bbox;
|
|
13730
|
+
doStroke && (strokeCb ? strokeCb(context, text.attribute, textAttribute) : sVisible && (context.setStrokeStyle(text, text.attribute, originX - x, originY - y, textAttribute), multilineLayout.lines.forEach(line => {
|
|
13731
|
+
context.strokeText(line.str, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y, z);
|
|
13732
|
+
}))), doFill && (fillCb ? fillCb(context, text.attribute, textAttribute) : fVisible && (context.setCommonStyle(text, text.attribute, originX - x, originY - y, textAttribute), multilineLayout.lines.forEach(line => {
|
|
13733
|
+
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, {
|
|
13734
|
+
width: line.width
|
|
13735
|
+
});
|
|
13736
|
+
})));
|
|
13737
|
+
} else {
|
|
13738
|
+
text.tryUpdateAABBBounds();
|
|
13739
|
+
const cache = text.cache,
|
|
13740
|
+
{
|
|
13741
|
+
verticalList: verticalList
|
|
13742
|
+
} = cache;
|
|
13743
|
+
context.textAlign = "left", context.textBaseline = "top";
|
|
13744
|
+
const totalHeight = lineHeight * verticalList.length;
|
|
13745
|
+
let totalW = 0;
|
|
13746
|
+
verticalList.forEach(verticalData => {
|
|
13747
|
+
const _w = verticalData.reduce((a, b) => a + (b.width || 0), 0);
|
|
13748
|
+
totalW = max(_w, totalW);
|
|
13807
13749
|
});
|
|
13808
|
-
|
|
13750
|
+
let offsetY = 0,
|
|
13751
|
+
offsetX = 0;
|
|
13752
|
+
"bottom" === textBaseline ? offsetX = -totalHeight : "middle" === textBaseline && (offsetX = -totalHeight / 2), "center" === textAlign ? offsetY -= totalW / 2 : "right" === textAlign && (offsetY -= totalW), verticalList.forEach((verticalData, i) => {
|
|
13753
|
+
const currentW = verticalData.reduce((a, b) => a + (b.width || 0), 0),
|
|
13754
|
+
dw = totalW - currentW;
|
|
13755
|
+
let currentOffsetY = offsetY;
|
|
13756
|
+
"center" === textAlign ? currentOffsetY += dw / 2 : "right" === textAlign && (currentOffsetY += dw), verticalData.forEach(item => {
|
|
13757
|
+
const {
|
|
13758
|
+
text: text,
|
|
13759
|
+
width: width,
|
|
13760
|
+
direction: direction
|
|
13761
|
+
} = item;
|
|
13762
|
+
drawText(text, totalHeight - (i + 1) * lineHeight + offsetX, currentOffsetY, direction), currentOffsetY += width;
|
|
13763
|
+
});
|
|
13764
|
+
});
|
|
13765
|
+
}
|
|
13766
|
+
} else if ("horizontal" === direction) {
|
|
13767
|
+
context.setTextStyle(text.attribute, textAttribute, z);
|
|
13768
|
+
const t = text.clipedText;
|
|
13769
|
+
let dy = 0;
|
|
13770
|
+
lineHeight !== fontSize && ("top" === textBaseline ? dy = (lineHeight - fontSize) / 2 : "middle" === textBaseline || "bottom" === textBaseline && (dy = -(lineHeight - fontSize) / 2)), drawText(t, 0, dy, 0);
|
|
13809
13771
|
} else {
|
|
13810
13772
|
text.tryUpdateAABBBounds();
|
|
13811
|
-
const cache = text.cache
|
|
13812
|
-
|
|
13773
|
+
const cache = text.cache;
|
|
13774
|
+
if (cache) {
|
|
13775
|
+
context.setTextStyleWithoutAlignBaseline(text.attribute, textAttribute, z);
|
|
13776
|
+
const {
|
|
13813
13777
|
verticalList: verticalList
|
|
13814
13778
|
} = cache;
|
|
13815
|
-
|
|
13816
|
-
|
|
13817
|
-
|
|
13818
|
-
|
|
13819
|
-
const _w = verticalData.reduce((a, b) => a + (b.width || 0), 0);
|
|
13820
|
-
totalW = max(_w, totalW);
|
|
13821
|
-
});
|
|
13822
|
-
let offsetY = 0,
|
|
13823
|
-
offsetX = 0;
|
|
13824
|
-
"bottom" === textBaseline ? offsetX = -totalHeight : "middle" === textBaseline && (offsetX = -totalHeight / 2), "center" === textAlign ? offsetY -= totalW / 2 : "right" === textAlign && (offsetY -= totalW), verticalList.forEach((verticalData, i) => {
|
|
13825
|
-
const currentW = verticalData.reduce((a, b) => a + (b.width || 0), 0),
|
|
13826
|
-
dw = totalW - currentW;
|
|
13827
|
-
let currentOffsetY = offsetY;
|
|
13828
|
-
"center" === textAlign ? currentOffsetY += dw / 2 : "right" === textAlign && (currentOffsetY += dw), verticalData.forEach(item => {
|
|
13779
|
+
let offsetY = 0;
|
|
13780
|
+
const totalW = verticalList[0].reduce((a, b) => a + (b.width || 0), 0);
|
|
13781
|
+
let offsetX = 0;
|
|
13782
|
+
"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 => {
|
|
13829
13783
|
const {
|
|
13830
13784
|
text: text,
|
|
13831
13785
|
width: width,
|
|
13832
13786
|
direction: direction
|
|
13833
13787
|
} = item;
|
|
13834
|
-
drawText(text,
|
|
13788
|
+
drawText(text, offsetX, offsetY, direction), offsetY += width;
|
|
13835
13789
|
});
|
|
13836
|
-
}
|
|
13790
|
+
}
|
|
13837
13791
|
}
|
|
13838
13792
|
transform3dMatrixToContextMatrix && this.restoreTransformUseContext2d(text, textAttribute, z, context), this.afterRenderStep(text, context, x, y, doFill, doStroke, fVisible, sVisible, textAttribute, drawContext, fillCb, strokeCb);
|
|
13839
13793
|
}
|
|
@@ -14566,6 +14520,28 @@ class CanvasTextLayout {
|
|
|
14566
14520
|
}
|
|
14567
14521
|
return bbox.yOffset = "top" === textBaseline ? 0 : "middle" === textBaseline ? bbox.height / -2 : "alphabetic" === textBaseline ? -.79 * bbox.height : -bbox.height, bbox;
|
|
14568
14522
|
}
|
|
14523
|
+
GetLayout(str, width, height, textAlign, textBaseline, lineHeight, suffix, wordBreak, suffixPosition) {
|
|
14524
|
+
const linesLayout = [],
|
|
14525
|
+
bboxWH = [width, height],
|
|
14526
|
+
bboxOffset = [0, 0];
|
|
14527
|
+
for (; str.length > 0;) {
|
|
14528
|
+
const {
|
|
14529
|
+
str: clipText
|
|
14530
|
+
} = this.textMeasure.clipTextWithSuffix(str, this.textOptions, width, suffix, wordBreak, suffixPosition);
|
|
14531
|
+
linesLayout.push({
|
|
14532
|
+
str: clipText,
|
|
14533
|
+
width: this.textMeasure.measureTextWidth(clipText, this.textOptions)
|
|
14534
|
+
}), str = str.substring(clipText.length);
|
|
14535
|
+
}
|
|
14536
|
+
"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]));
|
|
14537
|
+
const bbox = {
|
|
14538
|
+
xOffset: bboxOffset[0],
|
|
14539
|
+
yOffset: bboxOffset[1],
|
|
14540
|
+
width: bboxWH[0],
|
|
14541
|
+
height: bboxWH[1]
|
|
14542
|
+
};
|
|
14543
|
+
return this.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline, lineHeight);
|
|
14544
|
+
}
|
|
14569
14545
|
GetLayoutByLines(lines, textAlign, textBaseline, lineHeight) {
|
|
14570
14546
|
let suffix = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : "";
|
|
14571
14547
|
let wordBreak = arguments.length > 5 ? arguments[5] : undefined;
|
|
@@ -14576,29 +14552,18 @@ class CanvasTextLayout {
|
|
|
14576
14552
|
bboxWH = [0, 0];
|
|
14577
14553
|
if ("number" == typeof lineWidth && lineWidth !== 1 / 0) {
|
|
14578
14554
|
let width;
|
|
14579
|
-
for (let i = 0, len = lines.length; i < len; i++) {
|
|
14580
|
-
|
|
14581
|
-
width
|
|
14582
|
-
|
|
14583
|
-
width: width,
|
|
14584
|
-
ascent: metrics.ascent,
|
|
14585
|
-
descent: metrics.descent
|
|
14586
|
-
});
|
|
14587
|
-
}
|
|
14555
|
+
for (let i = 0, len = lines.length; i < len; i++) width = Math.min(this.textMeasure.measureTextWidth(lines[i], this.textOptions), lineWidth), linesLayout.push({
|
|
14556
|
+
str: this.textMeasure.clipTextWithSuffix(lines[i], this.textOptions, width, suffix, wordBreak, suffixPosition).str,
|
|
14557
|
+
width: width
|
|
14558
|
+
});
|
|
14588
14559
|
bboxWH[0] = lineWidth;
|
|
14589
14560
|
} else {
|
|
14590
14561
|
let width, text;
|
|
14591
14562
|
lineWidth = 0;
|
|
14592
|
-
for (let i = 0, len = lines.length; i < len; i++) {
|
|
14593
|
-
text
|
|
14594
|
-
|
|
14595
|
-
|
|
14596
|
-
str: text,
|
|
14597
|
-
width: width,
|
|
14598
|
-
ascent: metrics.ascent,
|
|
14599
|
-
descent: metrics.descent
|
|
14600
|
-
});
|
|
14601
|
-
}
|
|
14563
|
+
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({
|
|
14564
|
+
str: text,
|
|
14565
|
+
width: width
|
|
14566
|
+
});
|
|
14602
14567
|
bboxWH[0] = lineWidth;
|
|
14603
14568
|
}
|
|
14604
14569
|
bboxWH[1] = linesLayout.length * lineHeight, bboxWH[0] = linesLayout.reduce((a, b) => Math.max(a, b.width), 0);
|
|
@@ -14627,11 +14592,11 @@ class CanvasTextLayout {
|
|
|
14627
14592
|
};
|
|
14628
14593
|
}
|
|
14629
14594
|
lineOffset(bbox, line, textAlign, textBaseline, lineHeight, origin) {
|
|
14630
|
-
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 / 2 +
|
|
14595
|
+
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;
|
|
14631
14596
|
}
|
|
14632
14597
|
}
|
|
14633
14598
|
|
|
14634
|
-
const TEXT_UPDATE_TAG_KEY = ["text", "maxLineWidth", "
|
|
14599
|
+
const TEXT_UPDATE_TAG_KEY = ["text", "maxLineWidth", "textAlign", "textBaseline", "heightLimit", "lineClamp", "fontSize", "fontFamily", "fontWeight", "ellipsis", "lineHeight", "direction", "wordBreak", "heightLimit", "lineClamp", ...GRAPHIC_UPDATE_TAG_KEY];
|
|
14635
14600
|
class Text extends Graphic {
|
|
14636
14601
|
get font() {
|
|
14637
14602
|
const textTheme = this.getGraphicTheme();
|
|
@@ -14640,22 +14605,26 @@ class Text extends Graphic {
|
|
|
14640
14605
|
get clipedText() {
|
|
14641
14606
|
var _a;
|
|
14642
14607
|
const attribute = this.attribute,
|
|
14643
|
-
textTheme = this.getGraphicTheme()
|
|
14644
|
-
|
|
14645
|
-
|
|
14608
|
+
textTheme = this.getGraphicTheme();
|
|
14609
|
+
if (!this.isSimplify()) return;
|
|
14610
|
+
const {
|
|
14611
|
+
maxLineWidth = textTheme.maxLineWidth
|
|
14612
|
+
} = attribute;
|
|
14613
|
+
return Number.isFinite(maxLineWidth) ? (this.tryUpdateAABBBounds(), this.cache.clipedText) : (null !== (_a = attribute.text) && void 0 !== _a ? _a : textTheme.text).toString();
|
|
14646
14614
|
}
|
|
14647
14615
|
get clipedWidth() {
|
|
14648
|
-
return this.tryUpdateAABBBounds(), this.cache.clipedWidth;
|
|
14616
|
+
if (this.isSimplify()) return this.tryUpdateAABBBounds(), this.cache.clipedWidth;
|
|
14649
14617
|
}
|
|
14650
14618
|
get cliped() {
|
|
14651
14619
|
var _a, _b;
|
|
14652
14620
|
const textTheme = this.getGraphicTheme(),
|
|
14653
14621
|
attribute = this.attribute,
|
|
14654
|
-
|
|
14655
|
-
|
|
14656
|
-
|
|
14657
|
-
|
|
14658
|
-
|
|
14622
|
+
{
|
|
14623
|
+
maxLineWidth = textTheme.maxLineWidth,
|
|
14624
|
+
text: text,
|
|
14625
|
+
whiteSpace = textTheme.whiteSpace
|
|
14626
|
+
} = attribute;
|
|
14627
|
+
if (!Number.isFinite(maxLineWidth)) return !1;
|
|
14659
14628
|
if (this.tryUpdateAABBBounds(), null === (_b = null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData) || void 0 === _b ? void 0 : _b.lines) {
|
|
14660
14629
|
let mergedText = "";
|
|
14661
14630
|
this.cache.layoutData.lines.forEach(item => {
|
|
@@ -14666,7 +14635,10 @@ class Text extends Graphic {
|
|
|
14666
14635
|
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();
|
|
14667
14636
|
}
|
|
14668
14637
|
get multilineLayout() {
|
|
14669
|
-
return this.tryUpdateAABBBounds(), this.cache.layoutData;
|
|
14638
|
+
if (this.isMultiLine) return this.tryUpdateAABBBounds(), this.cache.layoutData;
|
|
14639
|
+
}
|
|
14640
|
+
isSimplify() {
|
|
14641
|
+
return !this.isMultiLine && "vertical" !== this.attribute.direction;
|
|
14670
14642
|
}
|
|
14671
14643
|
get isMultiLine() {
|
|
14672
14644
|
return Array.isArray(this.attribute.text) || "normal" === this.attribute.whiteSpace;
|
|
@@ -14739,63 +14711,8 @@ class Text extends Graphic {
|
|
|
14739
14711
|
}
|
|
14740
14712
|
return application.graphicService.combindShadowAABBBounds(aabbBounds, this), null == attribute.forceBoundsHeight && null == attribute.forceBoundsWidth || application.graphicService.updateHTMLTextAABBBounds(attribute, textTheme, aabbBounds), transformBoundsWithMatrix(aabbBounds, aabbBounds, this.transMatrix), aabbBounds;
|
|
14741
14713
|
}
|
|
14742
|
-
updateSingallineAABBBounds(text) {
|
|
14743
|
-
this.updateMultilineAABBBounds([text]);
|
|
14744
|
-
const layoutData = this.cache.layoutData;
|
|
14745
|
-
if (layoutData) {
|
|
14746
|
-
const line = layoutData.lines[0];
|
|
14747
|
-
this.cache.clipedText = line.str, this.cache.clipedWidth = line.width;
|
|
14748
|
-
}
|
|
14749
|
-
return this._AABBBounds;
|
|
14750
|
-
}
|
|
14751
|
-
updateMultilineAABBBounds(text) {
|
|
14752
|
-
const textTheme = this.getGraphicTheme(),
|
|
14753
|
-
{
|
|
14754
|
-
direction = textTheme.direction,
|
|
14755
|
-
underlineOffset = textTheme.underlineOffset
|
|
14756
|
-
} = this.attribute,
|
|
14757
|
-
b = "horizontal" === direction ? this.updateHorizontalMultilineAABBBounds(text) : this.updateVerticalMultilineAABBBounds(text);
|
|
14758
|
-
return "horizontal" === direction && underlineOffset && this._AABBBounds.add(this._AABBBounds.x1, this._AABBBounds.y2 + underlineOffset), b;
|
|
14759
|
-
}
|
|
14760
|
-
updateHorizontalMultilineAABBBounds(text) {
|
|
14761
|
-
var _a;
|
|
14762
|
-
const textTheme = this.getGraphicTheme(),
|
|
14763
|
-
attribute = this.attribute,
|
|
14764
|
-
{
|
|
14765
|
-
fontFamily = textTheme.fontFamily,
|
|
14766
|
-
textAlign = textTheme.textAlign,
|
|
14767
|
-
textBaseline = textTheme.textBaseline,
|
|
14768
|
-
fontSize = textTheme.fontSize,
|
|
14769
|
-
fontWeight = textTheme.fontWeight,
|
|
14770
|
-
ellipsis = textTheme.ellipsis,
|
|
14771
|
-
maxLineWidth: maxLineWidth,
|
|
14772
|
-
stroke = textTheme.stroke,
|
|
14773
|
-
wrap = textTheme.wrap,
|
|
14774
|
-
ignoreBuf = textTheme.ignoreBuf,
|
|
14775
|
-
lineWidth = textTheme.lineWidth,
|
|
14776
|
-
whiteSpace = textTheme.whiteSpace,
|
|
14777
|
-
suffixPosition = textTheme.suffixPosition
|
|
14778
|
-
} = attribute,
|
|
14779
|
-
buf = ignoreBuf ? 0 : 2,
|
|
14780
|
-
lineHeight = this.getLineHeight(attribute, textTheme) + buf;
|
|
14781
|
-
if ("normal" === whiteSpace || wrap) return this.updateWrapAABBBounds(text);
|
|
14782
|
-
if (!this.shouldUpdateShape() && (null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData)) {
|
|
14783
|
-
const bbox = this.cache.layoutData.bbox;
|
|
14784
|
-
return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
14785
|
-
}
|
|
14786
|
-
const textMeasure = application.graphicUtil.textMeasure,
|
|
14787
|
-
layoutData = new CanvasTextLayout(fontFamily, {
|
|
14788
|
-
fontSize: fontSize,
|
|
14789
|
-
fontWeight: fontWeight,
|
|
14790
|
-
fontFamily: fontFamily
|
|
14791
|
-
}, textMeasure).GetLayoutByLines(text, textAlign, textBaseline, lineHeight, !0 === ellipsis ? textTheme.ellipsis : ellipsis || void 0, !1, maxLineWidth, suffixPosition),
|
|
14792
|
-
{
|
|
14793
|
-
bbox: bbox
|
|
14794
|
-
} = layoutData;
|
|
14795
|
-
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;
|
|
14796
|
-
}
|
|
14797
14714
|
updateWrapAABBBounds(text) {
|
|
14798
|
-
var _a, _b, _c;
|
|
14715
|
+
var _a, _b, _c, _d;
|
|
14799
14716
|
const textTheme = this.getGraphicTheme(),
|
|
14800
14717
|
{
|
|
14801
14718
|
fontFamily = textTheme.fontFamily,
|
|
@@ -14813,19 +14730,18 @@ class Text extends Graphic {
|
|
|
14813
14730
|
heightLimit = 0,
|
|
14814
14731
|
lineClamp: lineClamp
|
|
14815
14732
|
} = this.attribute,
|
|
14816
|
-
|
|
14817
|
-
|
|
14818
|
-
if (!this.shouldUpdateShape() && (null === (
|
|
14733
|
+
lineHeight = null !== (_a = calculateLineHeight(this.attribute.lineHeight, this.attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : this.attribute.fontSize || textTheme.fontSize,
|
|
14734
|
+
buf = ignoreBuf ? 0 : 2;
|
|
14735
|
+
if (!this.shouldUpdateShape() && (null === (_b = this.cache) || void 0 === _b ? void 0 : _b.layoutData)) {
|
|
14819
14736
|
const bbox = this.cache.layoutData.bbox;
|
|
14820
14737
|
return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
14821
14738
|
}
|
|
14822
14739
|
const textMeasure = application.graphicUtil.textMeasure,
|
|
14823
|
-
|
|
14740
|
+
layoutObj = new CanvasTextLayout(fontFamily, {
|
|
14824
14741
|
fontSize: fontSize,
|
|
14825
14742
|
fontWeight: fontWeight,
|
|
14826
14743
|
fontFamily: fontFamily
|
|
14827
|
-
},
|
|
14828
|
-
layoutObj = new CanvasTextLayout(fontFamily, textOptions, textMeasure),
|
|
14744
|
+
}, textMeasure),
|
|
14829
14745
|
lines = isArray$1(text) ? text.map(l => l.toString()) : [text.toString()],
|
|
14830
14746
|
linesLayout = [],
|
|
14831
14747
|
bboxWH = [0, 0];
|
|
@@ -14835,33 +14751,29 @@ class Text extends Graphic {
|
|
|
14835
14751
|
const str = lines[i];
|
|
14836
14752
|
let needCut = !0;
|
|
14837
14753
|
if (i === lineCountLimit - 1) {
|
|
14838
|
-
const clip = textMeasure.clipTextWithSuffix(str, textOptions, maxLineWidth, ellipsis, !1, suffixPosition, i !== lines.length - 1)
|
|
14839
|
-
matrics = textMeasure.measureTextPixelADscentAndWidth(clip.str, textOptions);
|
|
14754
|
+
const clip = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1, suffixPosition, i !== lines.length - 1);
|
|
14840
14755
|
linesLayout.push({
|
|
14841
14756
|
str: clip.str,
|
|
14842
|
-
width: clip.width
|
|
14843
|
-
ascent: matrics.ascent,
|
|
14844
|
-
descent: matrics.descent
|
|
14757
|
+
width: clip.width
|
|
14845
14758
|
});
|
|
14846
14759
|
break;
|
|
14847
14760
|
}
|
|
14848
|
-
const clip = textMeasure.clipText(str, textOptions, maxLineWidth, "break-
|
|
14849
|
-
if ("" !== str && "" === clip.str) {
|
|
14761
|
+
const clip = layoutObj.textMeasure.clipText(str, layoutObj.textOptions, maxLineWidth, "break-all" !== wordBreak, "keep-all" === wordBreak);
|
|
14762
|
+
if ("" !== str && "" === clip.str || clip.wordBreaked) {
|
|
14850
14763
|
if (ellipsis) {
|
|
14851
|
-
const clipEllipsis = textMeasure.clipTextWithSuffix(str, textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
|
|
14852
|
-
clip.str = null !== (
|
|
14764
|
+
const clipEllipsis = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
|
|
14765
|
+
clip.str = null !== (_c = clipEllipsis.str) && void 0 !== _c ? _c : "", clip.width = null !== (_d = clipEllipsis.width) && void 0 !== _d ? _d : 0;
|
|
14853
14766
|
} else clip.str = "", clip.width = 0;
|
|
14854
14767
|
needCut = !1;
|
|
14855
14768
|
}
|
|
14856
|
-
|
|
14857
|
-
if (linesLayout.push({
|
|
14769
|
+
linesLayout.push({
|
|
14858
14770
|
str: clip.str,
|
|
14859
|
-
width: clip.width
|
|
14860
|
-
|
|
14861
|
-
|
|
14862
|
-
|
|
14863
|
-
|
|
14864
|
-
lines.splice(i + 1, 0, newStr);
|
|
14771
|
+
width: clip.width
|
|
14772
|
+
});
|
|
14773
|
+
let cutLength = clip.str.length;
|
|
14774
|
+
if (!clip.wordBreaked || "" !== str && "" === clip.str || (needCut = !0, cutLength = clip.wordBreaked), clip.str.length === str.length) ;else if (needCut) {
|
|
14775
|
+
let newStr = str.substring(cutLength);
|
|
14776
|
+
"keep-all" === wordBreak && (newStr = newStr.replace(/^\s+/g, "")), lines.splice(i + 1, 0, newStr);
|
|
14865
14777
|
}
|
|
14866
14778
|
}
|
|
14867
14779
|
let maxWidth = 0;
|
|
@@ -14874,28 +14786,21 @@ class Text extends Graphic {
|
|
|
14874
14786
|
lineWidth = 0;
|
|
14875
14787
|
for (let i = 0, len = lines.length; i < len; i++) {
|
|
14876
14788
|
if (i === lineCountLimit - 1) {
|
|
14877
|
-
const clip = textMeasure.clipTextWithSuffix(lines[i], textOptions, maxLineWidth, ellipsis, !1, suffixPosition)
|
|
14878
|
-
matrics = textMeasure.measureTextPixelADscentAndWidth(clip.str, textOptions);
|
|
14789
|
+
const clip = layoutObj.textMeasure.clipTextWithSuffix(lines[i], layoutObj.textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
|
|
14879
14790
|
linesLayout.push({
|
|
14880
14791
|
str: clip.str,
|
|
14881
|
-
width: clip.width
|
|
14882
|
-
ascent: matrics.ascent,
|
|
14883
|
-
descent: matrics.descent
|
|
14792
|
+
width: clip.width
|
|
14884
14793
|
}), lineWidth = Math.max(lineWidth, clip.width);
|
|
14885
14794
|
break;
|
|
14886
14795
|
}
|
|
14887
|
-
text = lines[i], width = textMeasure.measureTextWidth(text, textOptions), lineWidth = Math.max(lineWidth, width)
|
|
14888
|
-
const matrics = textMeasure.measureTextPixelADscentAndWidth(text, textOptions);
|
|
14889
|
-
linesLayout.push({
|
|
14796
|
+
text = lines[i], width = layoutObj.textMeasure.measureTextWidth(text, layoutObj.textOptions, "break-word" === wordBreak), lineWidth = Math.max(lineWidth, width), linesLayout.push({
|
|
14890
14797
|
str: text,
|
|
14891
|
-
width: width
|
|
14892
|
-
ascent: matrics.ascent,
|
|
14893
|
-
descent: matrics.descent
|
|
14798
|
+
width: width
|
|
14894
14799
|
});
|
|
14895
14800
|
}
|
|
14896
14801
|
bboxWH[0] = lineWidth;
|
|
14897
14802
|
}
|
|
14898
|
-
bboxWH[1] = linesLayout.length * lineHeight;
|
|
14803
|
+
bboxWH[1] = linesLayout.length * (lineHeight + buf);
|
|
14899
14804
|
const bbox = {
|
|
14900
14805
|
xOffset: 0,
|
|
14901
14806
|
yOffset: 0,
|
|
@@ -14906,12 +14811,210 @@ class Text extends Graphic {
|
|
|
14906
14811
|
const layoutData = layoutObj.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline, lineHeight);
|
|
14907
14812
|
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;
|
|
14908
14813
|
}
|
|
14909
|
-
|
|
14814
|
+
updateSingallineAABBBounds(text) {
|
|
14815
|
+
const textTheme = this.getGraphicTheme(),
|
|
14816
|
+
{
|
|
14817
|
+
direction = textTheme.direction,
|
|
14818
|
+
underlineOffset = textTheme.underlineOffset
|
|
14819
|
+
} = this.attribute,
|
|
14820
|
+
b = "horizontal" === direction ? this.updateHorizontalSinglelineAABBBounds(text) : this.updateVerticalSinglelineAABBBounds(text);
|
|
14821
|
+
return "horizontal" === direction && underlineOffset && this._AABBBounds.add(this._AABBBounds.x1, this._AABBBounds.y2 + underlineOffset), b;
|
|
14822
|
+
}
|
|
14823
|
+
updateMultilineAABBBounds(text) {
|
|
14824
|
+
const textTheme = this.getGraphicTheme(),
|
|
14825
|
+
{
|
|
14826
|
+
direction = textTheme.direction,
|
|
14827
|
+
underlineOffset = textTheme.underlineOffset
|
|
14828
|
+
} = this.attribute,
|
|
14829
|
+
b = "horizontal" === direction ? this.updateHorizontalMultilineAABBBounds(text) : this.updateVerticalMultilineAABBBounds(text);
|
|
14830
|
+
return "horizontal" === direction && underlineOffset && this._AABBBounds.add(this._AABBBounds.x1, this._AABBBounds.y2 + underlineOffset), b;
|
|
14831
|
+
}
|
|
14832
|
+
updateHorizontalSinglelineAABBBounds(text) {
|
|
14910
14833
|
var _a, _b;
|
|
14834
|
+
const textTheme = this.getGraphicTheme(),
|
|
14835
|
+
{
|
|
14836
|
+
wrap = textTheme.wrap
|
|
14837
|
+
} = this.attribute;
|
|
14838
|
+
if (wrap) return this.updateWrapAABBBounds([text]);
|
|
14839
|
+
const textMeasure = application.graphicUtil.textMeasure;
|
|
14840
|
+
let width, str;
|
|
14841
|
+
const attribute = this.attribute,
|
|
14842
|
+
{
|
|
14843
|
+
maxLineWidth = textTheme.maxLineWidth,
|
|
14844
|
+
ellipsis = textTheme.ellipsis,
|
|
14845
|
+
textAlign = textTheme.textAlign,
|
|
14846
|
+
textBaseline = textTheme.textBaseline,
|
|
14847
|
+
fontFamily = textTheme.fontFamily,
|
|
14848
|
+
fontSize = textTheme.fontSize,
|
|
14849
|
+
fontWeight = textTheme.fontWeight,
|
|
14850
|
+
stroke = textTheme.stroke,
|
|
14851
|
+
lineWidth = textTheme.lineWidth,
|
|
14852
|
+
ignoreBuf = textTheme.ignoreBuf,
|
|
14853
|
+
whiteSpace = textTheme.whiteSpace,
|
|
14854
|
+
suffixPosition = textTheme.suffixPosition
|
|
14855
|
+
} = attribute;
|
|
14856
|
+
if ("normal" === whiteSpace) return this.updateWrapAABBBounds(text);
|
|
14857
|
+
const buf = ignoreBuf ? 0 : Math.max(2, .075 * fontSize),
|
|
14858
|
+
textFontSize = attribute.fontSize || textTheme.fontSize,
|
|
14859
|
+
lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, textFontSize)) && void 0 !== _a ? _a : textFontSize + buf;
|
|
14860
|
+
if (!this.shouldUpdateShape() && this.cache) {
|
|
14861
|
+
width = null !== (_b = this.cache.clipedWidth) && void 0 !== _b ? _b : 0;
|
|
14862
|
+
const dx = textDrawOffsetX(textAlign, width),
|
|
14863
|
+
dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);
|
|
14864
|
+
return this._AABBBounds.set(dx, dy, dx + width, dy + lineHeight), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
14865
|
+
}
|
|
14866
|
+
if (Number.isFinite(maxLineWidth)) {
|
|
14867
|
+
if (ellipsis) {
|
|
14868
|
+
const strEllipsis = !0 === ellipsis ? textTheme.ellipsis : ellipsis,
|
|
14869
|
+
data = textMeasure.clipTextWithSuffix(text.toString(), {
|
|
14870
|
+
fontSize: fontSize,
|
|
14871
|
+
fontWeight: fontWeight,
|
|
14872
|
+
fontFamily: fontFamily
|
|
14873
|
+
}, maxLineWidth, strEllipsis, !1, suffixPosition);
|
|
14874
|
+
str = data.str, width = data.width;
|
|
14875
|
+
} else {
|
|
14876
|
+
const data = textMeasure.clipText(text.toString(), {
|
|
14877
|
+
fontSize: fontSize,
|
|
14878
|
+
fontWeight: fontWeight,
|
|
14879
|
+
fontFamily: fontFamily
|
|
14880
|
+
}, maxLineWidth, !1);
|
|
14881
|
+
str = data.str, width = data.width;
|
|
14882
|
+
}
|
|
14883
|
+
this.cache.clipedText = str, this.cache.clipedWidth = width;
|
|
14884
|
+
} else width = textMeasure.measureTextWidth(text.toString(), {
|
|
14885
|
+
fontSize: fontSize,
|
|
14886
|
+
fontWeight: fontWeight,
|
|
14887
|
+
fontFamily: fontFamily
|
|
14888
|
+
}), this.cache.clipedText = text.toString(), this.cache.clipedWidth = width;
|
|
14889
|
+
this.clearUpdateShapeTag();
|
|
14890
|
+
const dx = textDrawOffsetX(textAlign, width);
|
|
14891
|
+
let lh = lineHeight;
|
|
14892
|
+
application.global && application.global.isSafari() && (lh += .2 * fontSize);
|
|
14893
|
+
const dy = textLayoutOffsetY(textBaseline, lh, fontSize, buf);
|
|
14894
|
+
return this._AABBBounds.set(dx, dy, dx + width, dy + lh), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
14895
|
+
}
|
|
14896
|
+
getBaselineMapAlign() {
|
|
14897
|
+
return Text.baselineMapAlign;
|
|
14898
|
+
}
|
|
14899
|
+
getAlignMapBaseline() {
|
|
14900
|
+
return Text.alignMapBaseline;
|
|
14901
|
+
}
|
|
14902
|
+
updateVerticalSinglelineAABBBounds(text) {
|
|
14903
|
+
var _a, _b, _c;
|
|
14911
14904
|
const textTheme = this.getGraphicTheme(),
|
|
14912
14905
|
textMeasure = application.graphicUtil.textMeasure;
|
|
14913
14906
|
let width;
|
|
14914
14907
|
const attribute = this.attribute,
|
|
14908
|
+
{
|
|
14909
|
+
ignoreBuf = textTheme.ignoreBuf
|
|
14910
|
+
} = attribute,
|
|
14911
|
+
buf = ignoreBuf ? 0 : 2,
|
|
14912
|
+
{
|
|
14913
|
+
maxLineWidth = textTheme.maxLineWidth,
|
|
14914
|
+
ellipsis = textTheme.ellipsis,
|
|
14915
|
+
fontSize = textTheme.fontSize,
|
|
14916
|
+
fontWeight = textTheme.fontWeight,
|
|
14917
|
+
fontFamily = textTheme.fontFamily,
|
|
14918
|
+
stroke = textTheme.stroke,
|
|
14919
|
+
lineWidth = textTheme.lineWidth,
|
|
14920
|
+
verticalMode = textTheme.verticalMode,
|
|
14921
|
+
suffixPosition = textTheme.suffixPosition
|
|
14922
|
+
} = attribute,
|
|
14923
|
+
lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
|
|
14924
|
+
let {
|
|
14925
|
+
textAlign = textTheme.textAlign,
|
|
14926
|
+
textBaseline = textTheme.textBaseline
|
|
14927
|
+
} = attribute;
|
|
14928
|
+
if (!verticalMode) {
|
|
14929
|
+
const t = textAlign;
|
|
14930
|
+
textAlign = null !== (_b = Text.baselineMapAlign[textBaseline]) && void 0 !== _b ? _b : "left", textBaseline = null !== (_c = Text.alignMapBaseline[t]) && void 0 !== _c ? _c : "top";
|
|
14931
|
+
}
|
|
14932
|
+
if (!this.shouldUpdateShape() && this.cache) {
|
|
14933
|
+
width = this.cache.clipedWidth;
|
|
14934
|
+
const dx = textDrawOffsetX(textAlign, width),
|
|
14935
|
+
dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);
|
|
14936
|
+
return this._AABBBounds.set(dy, dx, dy + lineHeight, dx + width), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
14937
|
+
}
|
|
14938
|
+
let verticalList = [verticalLayout(text.toString())];
|
|
14939
|
+
if (Number.isFinite(maxLineWidth)) {
|
|
14940
|
+
if (ellipsis) {
|
|
14941
|
+
const strEllipsis = !0 === ellipsis ? textTheme.ellipsis : ellipsis,
|
|
14942
|
+
data = textMeasure.clipTextWithSuffixVertical(verticalList[0], {
|
|
14943
|
+
fontSize: fontSize,
|
|
14944
|
+
fontWeight: fontWeight,
|
|
14945
|
+
fontFamily: fontFamily
|
|
14946
|
+
}, maxLineWidth, strEllipsis, !1, suffixPosition);
|
|
14947
|
+
verticalList = [data.verticalList], width = data.width;
|
|
14948
|
+
} else {
|
|
14949
|
+
const data = textMeasure.clipTextVertical(verticalList[0], {
|
|
14950
|
+
fontSize: fontSize,
|
|
14951
|
+
fontWeight: fontWeight,
|
|
14952
|
+
fontFamily: fontFamily
|
|
14953
|
+
}, maxLineWidth, !1);
|
|
14954
|
+
verticalList = [data.verticalList], width = data.width;
|
|
14955
|
+
}
|
|
14956
|
+
this.cache.verticalList = verticalList, this.cache.clipedWidth = width;
|
|
14957
|
+
} else width = 0, verticalList[0].forEach(t => {
|
|
14958
|
+
const w = t.direction === TextDirection.HORIZONTAL ? fontSize : textMeasure.measureTextWidth(t.text, {
|
|
14959
|
+
fontSize: fontSize,
|
|
14960
|
+
fontWeight: fontWeight,
|
|
14961
|
+
fontFamily: fontFamily
|
|
14962
|
+
});
|
|
14963
|
+
width += w, t.width = w;
|
|
14964
|
+
}), this.cache.verticalList = verticalList, this.cache.clipedWidth = width;
|
|
14965
|
+
this.clearUpdateShapeTag();
|
|
14966
|
+
const dx = textDrawOffsetX(textAlign, width),
|
|
14967
|
+
dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);
|
|
14968
|
+
return this._AABBBounds.set(dy, dx, dy + lineHeight, dx + width), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
14969
|
+
}
|
|
14970
|
+
updateHorizontalMultilineAABBBounds(text) {
|
|
14971
|
+
var _a, _b;
|
|
14972
|
+
const textTheme = this.getGraphicTheme(),
|
|
14973
|
+
{
|
|
14974
|
+
wrap = textTheme.wrap
|
|
14975
|
+
} = this.attribute;
|
|
14976
|
+
if (wrap) return this.updateWrapAABBBounds(text);
|
|
14977
|
+
const attribute = this.attribute,
|
|
14978
|
+
{
|
|
14979
|
+
fontFamily = textTheme.fontFamily,
|
|
14980
|
+
textAlign = textTheme.textAlign,
|
|
14981
|
+
textBaseline = textTheme.textBaseline,
|
|
14982
|
+
fontSize = textTheme.fontSize,
|
|
14983
|
+
fontWeight = textTheme.fontWeight,
|
|
14984
|
+
ellipsis = textTheme.ellipsis,
|
|
14985
|
+
maxLineWidth: maxLineWidth,
|
|
14986
|
+
stroke = textTheme.stroke,
|
|
14987
|
+
lineWidth = textTheme.lineWidth,
|
|
14988
|
+
whiteSpace = textTheme.whiteSpace,
|
|
14989
|
+
suffixPosition = textTheme.suffixPosition
|
|
14990
|
+
} = attribute,
|
|
14991
|
+
lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : attribute.fontSize || textTheme.fontSize;
|
|
14992
|
+
if ("normal" === whiteSpace) return this.updateWrapAABBBounds(text);
|
|
14993
|
+
if (!this.shouldUpdateShape() && (null === (_b = this.cache) || void 0 === _b ? void 0 : _b.layoutData)) {
|
|
14994
|
+
const bbox = this.cache.layoutData.bbox;
|
|
14995
|
+
return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
14996
|
+
}
|
|
14997
|
+
const textMeasure = application.graphicUtil.textMeasure,
|
|
14998
|
+
layoutData = new CanvasTextLayout(fontFamily, {
|
|
14999
|
+
fontSize: fontSize,
|
|
15000
|
+
fontWeight: fontWeight,
|
|
15001
|
+
fontFamily: fontFamily
|
|
15002
|
+
}, textMeasure).GetLayoutByLines(text, textAlign, textBaseline, lineHeight, !0 === ellipsis ? textTheme.ellipsis : ellipsis || void 0, !1, maxLineWidth, suffixPosition),
|
|
15003
|
+
{
|
|
15004
|
+
bbox: bbox
|
|
15005
|
+
} = layoutData;
|
|
15006
|
+
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;
|
|
15007
|
+
}
|
|
15008
|
+
updateVerticalMultilineAABBBounds(text) {
|
|
15009
|
+
var _a, _b, _c;
|
|
15010
|
+
const textTheme = this.getGraphicTheme(),
|
|
15011
|
+
textMeasure = application.graphicUtil.textMeasure;
|
|
15012
|
+
let width;
|
|
15013
|
+
const attribute = this.attribute,
|
|
15014
|
+
{
|
|
15015
|
+
ignoreBuf = textTheme.ignoreBuf
|
|
15016
|
+
} = attribute,
|
|
15017
|
+
buf = ignoreBuf ? 0 : 2,
|
|
14915
15018
|
{
|
|
14916
15019
|
maxLineWidth = textTheme.maxLineWidth,
|
|
14917
15020
|
ellipsis = textTheme.ellipsis,
|
|
@@ -14923,14 +15026,14 @@ class Text extends Graphic {
|
|
|
14923
15026
|
verticalMode = textTheme.verticalMode,
|
|
14924
15027
|
suffixPosition = textTheme.suffixPosition
|
|
14925
15028
|
} = attribute,
|
|
14926
|
-
lineHeight =
|
|
15029
|
+
lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
|
|
14927
15030
|
let {
|
|
14928
15031
|
textAlign = textTheme.textAlign,
|
|
14929
15032
|
textBaseline = textTheme.textBaseline
|
|
14930
15033
|
} = attribute;
|
|
14931
15034
|
if (!verticalMode) {
|
|
14932
15035
|
const t = textAlign;
|
|
14933
|
-
textAlign = null !== (
|
|
15036
|
+
textAlign = null !== (_b = Text.baselineMapAlign[textBaseline]) && void 0 !== _b ? _b : "left", textBaseline = null !== (_c = Text.alignMapBaseline[t]) && void 0 !== _c ? _c : "top";
|
|
14934
15037
|
}
|
|
14935
15038
|
if (width = 0, !this.shouldUpdateShape() && this.cache) {
|
|
14936
15039
|
this.cache.verticalList.forEach(item => {
|
|
@@ -14978,15 +15081,6 @@ class Text extends Graphic {
|
|
|
14978
15081
|
dy = textLayoutOffsetY(textBaseline, height, fontSize);
|
|
14979
15082
|
return this._AABBBounds.set(dy, dx, dy + height, dx + width), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
14980
15083
|
}
|
|
14981
|
-
getMaxWidth(theme) {
|
|
14982
|
-
var _a, _b;
|
|
14983
|
-
const attribute = this.attribute;
|
|
14984
|
-
return null !== (_b = null !== (_a = attribute.maxLineWidth) && void 0 !== _a ? _a : attribute.maxWidth) && void 0 !== _b ? _b : theme.maxWidth;
|
|
14985
|
-
}
|
|
14986
|
-
getLineHeight(attribute, textTheme) {
|
|
14987
|
-
var _a;
|
|
14988
|
-
return null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : attribute.fontSize || textTheme.fontSize;
|
|
14989
|
-
}
|
|
14990
15084
|
needUpdateTags(keys) {
|
|
14991
15085
|
let k = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : TEXT_UPDATE_TAG_KEY;
|
|
14992
15086
|
return super.needUpdateTags(keys, k);
|
|
@@ -15001,12 +15095,6 @@ class Text extends Graphic {
|
|
|
15001
15095
|
getNoWorkAnimateAttr() {
|
|
15002
15096
|
return Text.NOWORK_ANIMATE_ATTR;
|
|
15003
15097
|
}
|
|
15004
|
-
getBaselineMapAlign() {
|
|
15005
|
-
return Text.baselineMapAlign;
|
|
15006
|
-
}
|
|
15007
|
-
getAlignMapBaseline() {
|
|
15008
|
-
return Text.alignMapBaseline;
|
|
15009
|
-
}
|
|
15010
15098
|
}
|
|
15011
15099
|
Text.NOWORK_ANIMATE_ATTR = Object.assign({
|
|
15012
15100
|
ellipsis: 1,
|
|
@@ -15085,9 +15173,7 @@ class WrapText extends Text {
|
|
|
15085
15173
|
const clip = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
|
|
15086
15174
|
linesLayout.push({
|
|
15087
15175
|
str: clip.str,
|
|
15088
|
-
width: clip.width
|
|
15089
|
-
ascent: 0,
|
|
15090
|
-
descent: 0
|
|
15176
|
+
width: clip.width
|
|
15091
15177
|
});
|
|
15092
15178
|
break;
|
|
15093
15179
|
}
|
|
@@ -15101,9 +15187,7 @@ class WrapText extends Text {
|
|
|
15101
15187
|
}
|
|
15102
15188
|
if (linesLayout.push({
|
|
15103
15189
|
str: clip.str,
|
|
15104
|
-
width: clip.width
|
|
15105
|
-
ascent: 0,
|
|
15106
|
-
descent: 0
|
|
15190
|
+
width: clip.width
|
|
15107
15191
|
}), clip.str.length === str.length) ;else if (needCut) {
|
|
15108
15192
|
const newStr = str.substring(clip.str.length);
|
|
15109
15193
|
lines.splice(i + 1, 0, newStr);
|
|
@@ -15122,17 +15206,13 @@ class WrapText extends Text {
|
|
|
15122
15206
|
const clip = layoutObj.textMeasure.clipTextWithSuffix(lines[i], layoutObj.textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
|
|
15123
15207
|
linesLayout.push({
|
|
15124
15208
|
str: clip.str,
|
|
15125
|
-
width: clip.width
|
|
15126
|
-
ascent: 0,
|
|
15127
|
-
descent: 0
|
|
15209
|
+
width: clip.width
|
|
15128
15210
|
}), lineWidth = Math.max(lineWidth, clip.width);
|
|
15129
15211
|
break;
|
|
15130
15212
|
}
|
|
15131
15213
|
text = lines[i], width = layoutObj.textMeasure.measureTextWidth(text, layoutObj.textOptions, "break-word" === wordBreak), lineWidth = Math.max(lineWidth, width), linesLayout.push({
|
|
15132
15214
|
str: text,
|
|
15133
|
-
width: width
|
|
15134
|
-
ascent: 0,
|
|
15135
|
-
descent: 0
|
|
15215
|
+
width: width
|
|
15136
15216
|
});
|
|
15137
15217
|
}
|
|
15138
15218
|
bboxWH[0] = lineWidth;
|
|
@@ -15176,6 +15256,9 @@ class BaseSymbol {
|
|
|
15176
15256
|
bounds.x1 = -halfS, bounds.x2 = halfS, bounds.y1 = -halfS, bounds.y2 = halfS;
|
|
15177
15257
|
} else bounds.x1 = -size[0] / 2, bounds.x2 = size[0] / 2, bounds.y1 = -size[1] / 2, bounds.y2 = size[1] / 2;
|
|
15178
15258
|
}
|
|
15259
|
+
parseSize(size) {
|
|
15260
|
+
return isNumber$1(size) ? size : Math.min(size[0], size[1]);
|
|
15261
|
+
}
|
|
15179
15262
|
}
|
|
15180
15263
|
|
|
15181
15264
|
function circle(ctx, r, x, y, z) {
|
|
@@ -15186,13 +15269,13 @@ class CircleSymbol extends BaseSymbol {
|
|
|
15186
15269
|
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";
|
|
15187
15270
|
}
|
|
15188
15271
|
draw(ctx, size, x, y, z) {
|
|
15189
|
-
return circle(ctx, size / 2, x, y, z);
|
|
15272
|
+
return circle(ctx, this.parseSize(size) / 2, x, y, z);
|
|
15190
15273
|
}
|
|
15191
15274
|
drawOffset(ctx, size, x, y, offset, z) {
|
|
15192
|
-
return circle(ctx, size / 2 + offset, x, y, z);
|
|
15275
|
+
return circle(ctx, this.parseSize(size) / 2 + offset, x, y, z);
|
|
15193
15276
|
}
|
|
15194
15277
|
drawToSvgPath(size, x, y, z) {
|
|
15195
|
-
const r = size / 2;
|
|
15278
|
+
const r = this.parseSize(size) / 2;
|
|
15196
15279
|
return `M ${x - r}, ${y} a ${r},${r} 0 1,0 ${2 * r},0 a ${r},${r} 0 1,0 -${2 * r},0`;
|
|
15197
15280
|
}
|
|
15198
15281
|
}
|
|
@@ -15209,10 +15292,10 @@ class CrossSymbol extends BaseSymbol {
|
|
|
15209
15292
|
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";
|
|
15210
15293
|
}
|
|
15211
15294
|
draw(ctx, size, x, y, z) {
|
|
15212
|
-
return cross(ctx, size / 6, x, y, z);
|
|
15295
|
+
return cross(ctx, this.parseSize(size) / 6, x, y, z);
|
|
15213
15296
|
}
|
|
15214
15297
|
drawOffset(ctx, size, x, y, offset, z) {
|
|
15215
|
-
return crossOffset(ctx, size / 6, x, y, offset, z);
|
|
15298
|
+
return crossOffset(ctx, this.parseSize(size) / 6, x, y, offset, z);
|
|
15216
15299
|
}
|
|
15217
15300
|
}
|
|
15218
15301
|
var cross$1 = new CrossSymbol();
|
|
@@ -15225,13 +15308,13 @@ class DiamondSymbol extends BaseSymbol {
|
|
|
15225
15308
|
super(...arguments), this.type = "diamond", this.pathStr = "M-0.5,0L0,-0.5L0.5,0L0,0.5Z";
|
|
15226
15309
|
}
|
|
15227
15310
|
draw(ctx, size, x, y, z) {
|
|
15228
|
-
return diamond(ctx, size / 2, x, y, z);
|
|
15311
|
+
return diamond(ctx, this.parseSize(size) / 2, x, y, z);
|
|
15229
15312
|
}
|
|
15230
15313
|
drawFitDir(ctx, size, x, y, z) {
|
|
15231
|
-
return diamond(ctx, size / 2, x, y, z);
|
|
15314
|
+
return diamond(ctx, this.parseSize(size) / 2, x, y, z);
|
|
15232
15315
|
}
|
|
15233
15316
|
drawOffset(ctx, size, x, y, offset, z) {
|
|
15234
|
-
return diamond(ctx, size / 2 + offset, x, y, z);
|
|
15317
|
+
return diamond(ctx, this.parseSize(size) / 2 + offset, x, y, z);
|
|
15235
15318
|
}
|
|
15236
15319
|
}
|
|
15237
15320
|
var diamond$1 = new DiamondSymbol();
|
|
@@ -15245,10 +15328,10 @@ class SquareSymbol extends BaseSymbol {
|
|
|
15245
15328
|
super(...arguments), this.type = "square", this.pathStr = "M-0.5,-0.5h1v1h-1Z";
|
|
15246
15329
|
}
|
|
15247
15330
|
draw(ctx, size, x, y) {
|
|
15248
|
-
return square(ctx, size / 2, x, y);
|
|
15331
|
+
return square(ctx, this.parseSize(size) / 2, x, y);
|
|
15249
15332
|
}
|
|
15250
15333
|
drawOffset(ctx, size, x, y, offset) {
|
|
15251
|
-
return square(ctx, size / 2 + offset, x, y);
|
|
15334
|
+
return square(ctx, this.parseSize(size) / 2 + offset, x, y);
|
|
15252
15335
|
}
|
|
15253
15336
|
}
|
|
15254
15337
|
var square$1 = new SquareSymbol();
|
|
@@ -15262,10 +15345,10 @@ class TriangleUpSymbol extends BaseSymbol {
|
|
|
15262
15345
|
super(...arguments), this.type = "triangleUp", this.pathStr = "M0.5,0.5 L-0.5,0.5 L0,-0.5 Z";
|
|
15263
15346
|
}
|
|
15264
15347
|
draw(ctx, size, x, y) {
|
|
15265
|
-
return trianglUpOffset(ctx, size / 2, x, y);
|
|
15348
|
+
return trianglUpOffset(ctx, this.parseSize(size) / 2, x, y);
|
|
15266
15349
|
}
|
|
15267
15350
|
drawOffset(ctx, size, x, y, offset) {
|
|
15268
|
-
return trianglUpOffset(ctx, size / 2, x, y, offset);
|
|
15351
|
+
return trianglUpOffset(ctx, this.parseSize(size) / 2, x, y, offset);
|
|
15269
15352
|
}
|
|
15270
15353
|
}
|
|
15271
15354
|
var triangleUp = new TriangleUpSymbol();
|
|
@@ -15297,10 +15380,10 @@ class StarSymbol extends BaseSymbol {
|
|
|
15297
15380
|
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";
|
|
15298
15381
|
}
|
|
15299
15382
|
draw(ctx, size, transX, transY) {
|
|
15300
|
-
return star(ctx, size / 2, transX, transY);
|
|
15383
|
+
return star(ctx, this.parseSize(size) / 2, transX, transY);
|
|
15301
15384
|
}
|
|
15302
15385
|
drawOffset(ctx, size, transX, transY, offset) {
|
|
15303
|
-
return star(ctx, size / 2 + offset, transX, transY);
|
|
15386
|
+
return star(ctx, this.parseSize(size) / 2 + offset, transX, transY);
|
|
15304
15387
|
}
|
|
15305
15388
|
}
|
|
15306
15389
|
var star$1 = new StarSymbol();
|
|
@@ -15318,10 +15401,10 @@ class ArrowSymbol extends BaseSymbol {
|
|
|
15318
15401
|
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";
|
|
15319
15402
|
}
|
|
15320
15403
|
draw(ctx, size, transX, transY) {
|
|
15321
|
-
return arrow(ctx, size / 2, transX, transY);
|
|
15404
|
+
return arrow(ctx, this.parseSize(size) / 2, transX, transY);
|
|
15322
15405
|
}
|
|
15323
15406
|
drawOffset(ctx, size, transX, transY, offset) {
|
|
15324
|
-
return arrow(ctx, size / 2 + offset, transX, transY);
|
|
15407
|
+
return arrow(ctx, this.parseSize(size) / 2 + offset, transX, transY);
|
|
15325
15408
|
}
|
|
15326
15409
|
}
|
|
15327
15410
|
var arrow$1 = new ArrowSymbol();
|
|
@@ -15335,10 +15418,10 @@ class WedgeSymbol extends BaseSymbol {
|
|
|
15335
15418
|
super(...arguments), this.type = "wedge", this.pathStr = "M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z";
|
|
15336
15419
|
}
|
|
15337
15420
|
draw(ctx, size, transX, transY) {
|
|
15338
|
-
return wedge(ctx, size / 2, transX, transY);
|
|
15421
|
+
return wedge(ctx, this.parseSize(size) / 2, transX, transY);
|
|
15339
15422
|
}
|
|
15340
15423
|
drawOffset(ctx, size, transX, transY, offset) {
|
|
15341
|
-
return wedge(ctx, size / 2 + offset, transX, transY);
|
|
15424
|
+
return wedge(ctx, this.parseSize(size) / 2 + offset, transX, transY);
|
|
15342
15425
|
}
|
|
15343
15426
|
}
|
|
15344
15427
|
var wedge$1 = new WedgeSymbol();
|
|
@@ -15351,10 +15434,10 @@ class StrokeSymbol extends BaseSymbol {
|
|
|
15351
15434
|
super(...arguments), this.type = "stroke", this.pathStr = "";
|
|
15352
15435
|
}
|
|
15353
15436
|
draw(ctx, size, transX, transY) {
|
|
15354
|
-
return stroke(ctx, size / 2, transX, transY);
|
|
15437
|
+
return stroke(ctx, this.parseSize(size) / 2, transX, transY);
|
|
15355
15438
|
}
|
|
15356
15439
|
drawOffset(ctx, size, transX, transY, offset) {
|
|
15357
|
-
return stroke(ctx, size / 2 + offset, transX, transY);
|
|
15440
|
+
return stroke(ctx, this.parseSize(size) / 2 + offset, transX, transY);
|
|
15358
15441
|
}
|
|
15359
15442
|
}
|
|
15360
15443
|
var stroke$1 = new StrokeSymbol();
|
|
@@ -15376,10 +15459,10 @@ class WyeSymbol extends BaseSymbol {
|
|
|
15376
15459
|
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";
|
|
15377
15460
|
}
|
|
15378
15461
|
draw(ctx, size, transX, transY) {
|
|
15379
|
-
return wye(ctx, size / 2, transX, transY);
|
|
15462
|
+
return wye(ctx, this.parseSize(size) / 2, transX, transY);
|
|
15380
15463
|
}
|
|
15381
15464
|
drawOffset(ctx, size, transX, transY, offset) {
|
|
15382
|
-
return wye(ctx, size / 2 + offset, transX, transY);
|
|
15465
|
+
return wye(ctx, this.parseSize(size) / 2 + offset, transX, transY);
|
|
15383
15466
|
}
|
|
15384
15467
|
}
|
|
15385
15468
|
var wye$1 = new WyeSymbol();
|
|
@@ -15392,10 +15475,10 @@ class TriangleLeftSymbol extends BaseSymbol {
|
|
|
15392
15475
|
super(...arguments), this.type = "triangleLeft", this.pathStr = "M-0.5,0 L0.5,0.5 L0.5,-0.5 Z";
|
|
15393
15476
|
}
|
|
15394
15477
|
draw(ctx, size, x, y) {
|
|
15395
|
-
return trianglLeftOffset(ctx, size / 2, x, y, 0);
|
|
15478
|
+
return trianglLeftOffset(ctx, this.parseSize(size) / 2, x, y, 0);
|
|
15396
15479
|
}
|
|
15397
15480
|
drawOffset(ctx, size, x, y, offset) {
|
|
15398
|
-
return trianglLeftOffset(ctx, size / 2, x, y, offset);
|
|
15481
|
+
return trianglLeftOffset(ctx, this.parseSize(size) / 2, x, y, offset);
|
|
15399
15482
|
}
|
|
15400
15483
|
}
|
|
15401
15484
|
var triangleLeft = new TriangleLeftSymbol();
|
|
@@ -15409,10 +15492,10 @@ class TriangleRightSymbol extends BaseSymbol {
|
|
|
15409
15492
|
super(...arguments), this.type = "triangleRight", this.pathStr = "M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z";
|
|
15410
15493
|
}
|
|
15411
15494
|
draw(ctx, size, x, y) {
|
|
15412
|
-
return trianglRightOffset(ctx, size / 2, x, y);
|
|
15495
|
+
return trianglRightOffset(ctx, this.parseSize(size) / 2, x, y);
|
|
15413
15496
|
}
|
|
15414
15497
|
drawOffset(ctx, size, x, y, offset) {
|
|
15415
|
-
return trianglRightOffset(ctx, size / 2, x, y, offset);
|
|
15498
|
+
return trianglRightOffset(ctx, this.parseSize(size) / 2, x, y, offset);
|
|
15416
15499
|
}
|
|
15417
15500
|
}
|
|
15418
15501
|
var triangleRight = new TriangleRightSymbol();
|
|
@@ -15426,10 +15509,10 @@ class TriangleDownSymbol extends BaseSymbol {
|
|
|
15426
15509
|
super(...arguments), this.type = "triangleDown", this.pathStr = "M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z";
|
|
15427
15510
|
}
|
|
15428
15511
|
draw(ctx, size, x, y) {
|
|
15429
|
-
return trianglDownOffset(ctx, size / 2, x, y);
|
|
15512
|
+
return trianglDownOffset(ctx, this.parseSize(size) / 2, x, y);
|
|
15430
15513
|
}
|
|
15431
15514
|
drawOffset(ctx, size, x, y, offset) {
|
|
15432
|
-
return trianglDownOffset(ctx, size / 2, x, y, offset);
|
|
15515
|
+
return trianglDownOffset(ctx, this.parseSize(size) / 2, x, y, offset);
|
|
15433
15516
|
}
|
|
15434
15517
|
}
|
|
15435
15518
|
var triangleDown = new TriangleDownSymbol();
|
|
@@ -15444,10 +15527,10 @@ class ThinTriangleSymbol extends BaseSymbol {
|
|
|
15444
15527
|
super(...arguments), this.type = "thinTriangle", this.pathStr = "M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z";
|
|
15445
15528
|
}
|
|
15446
15529
|
draw(ctx, size, x, y) {
|
|
15447
|
-
return thinTriangle(ctx, size / 2 / sqrt3, x, y);
|
|
15530
|
+
return thinTriangle(ctx, this.parseSize(size) / 2 / sqrt3, x, y);
|
|
15448
15531
|
}
|
|
15449
15532
|
drawOffset(ctx, size, x, y, offset) {
|
|
15450
|
-
return thinTriangle(ctx, size / 2 / sqrt3 + offset, x, y);
|
|
15533
|
+
return thinTriangle(ctx, this.parseSize(size) / 2 / sqrt3 + offset, x, y);
|
|
15451
15534
|
}
|
|
15452
15535
|
}
|
|
15453
15536
|
var thinTriangle$1 = new ThinTriangleSymbol();
|
|
@@ -15461,10 +15544,10 @@ class Arrow2LeftSymbol extends BaseSymbol {
|
|
|
15461
15544
|
super(...arguments), this.type = "arrow2Left", this.pathStr = "M 0.25 -0.5 L -0.25 0 l 0.25 0.5";
|
|
15462
15545
|
}
|
|
15463
15546
|
draw(ctx, size, transX, transY) {
|
|
15464
|
-
return arrow2Left(ctx, size / 4, transX, transY);
|
|
15547
|
+
return arrow2Left(ctx, this.parseSize(size) / 4, transX, transY);
|
|
15465
15548
|
}
|
|
15466
15549
|
drawOffset(ctx, size, transX, transY, offset) {
|
|
15467
|
-
return arrow2Left(ctx, size / 4 + offset, transX, transY);
|
|
15550
|
+
return arrow2Left(ctx, this.parseSize(size) / 4 + offset, transX, transY);
|
|
15468
15551
|
}
|
|
15469
15552
|
}
|
|
15470
15553
|
var arrow2Left$1 = new Arrow2LeftSymbol();
|
|
@@ -15478,10 +15561,10 @@ class Arrow2RightSymbol extends BaseSymbol {
|
|
|
15478
15561
|
super(...arguments), this.type = "arrow2Right", this.pathStr = "M -0.25 -0.5 l 0.25 0 l -0.25 0.5";
|
|
15479
15562
|
}
|
|
15480
15563
|
draw(ctx, size, transX, transY) {
|
|
15481
|
-
return arrow2Right(ctx, size / 4, transX, transY);
|
|
15564
|
+
return arrow2Right(ctx, this.parseSize(size) / 4, transX, transY);
|
|
15482
15565
|
}
|
|
15483
15566
|
drawOffset(ctx, size, transX, transY, offset) {
|
|
15484
|
-
return arrow2Right(ctx, size / 4 + offset, transX, transY);
|
|
15567
|
+
return arrow2Right(ctx, this.parseSize(size) / 4 + offset, transX, transY);
|
|
15485
15568
|
}
|
|
15486
15569
|
}
|
|
15487
15570
|
var arrow2Right$1 = new Arrow2RightSymbol();
|
|
@@ -15495,10 +15578,10 @@ class Arrow2UpSymbol extends BaseSymbol {
|
|
|
15495
15578
|
super(...arguments), this.type = "arrow2Up", this.pathStr = "M -0.5 0.25 L 0 -0.25 l 0.5 0.25";
|
|
15496
15579
|
}
|
|
15497
15580
|
draw(ctx, size, transX, transY) {
|
|
15498
|
-
return arrow2Up(ctx, size / 4, transX, transY);
|
|
15581
|
+
return arrow2Up(ctx, this.parseSize(size) / 4, transX, transY);
|
|
15499
15582
|
}
|
|
15500
15583
|
drawOffset(ctx, size, transX, transY, offset) {
|
|
15501
|
-
return arrow2Up(ctx, size / 4 + offset, transX, transY);
|
|
15584
|
+
return arrow2Up(ctx, this.parseSize(size) / 4 + offset, transX, transY);
|
|
15502
15585
|
}
|
|
15503
15586
|
}
|
|
15504
15587
|
var arrow2Up$1 = new Arrow2UpSymbol();
|
|
@@ -15512,10 +15595,10 @@ class Arrow2DownSymbol extends BaseSymbol {
|
|
|
15512
15595
|
super(...arguments), this.type = "arrow2Down", this.pathStr = "M -0.5 -0.25 L 0 0.25 l 0.5 -0.25";
|
|
15513
15596
|
}
|
|
15514
15597
|
draw(ctx, size, transX, transY) {
|
|
15515
|
-
return arrow2Down(ctx, size / 4, transX, transY);
|
|
15598
|
+
return arrow2Down(ctx, this.parseSize(size) / 4, transX, transY);
|
|
15516
15599
|
}
|
|
15517
15600
|
drawOffset(ctx, size, transX, transY, offset) {
|
|
15518
|
-
return arrow2Down(ctx, size / 4 + offset, transX, transY);
|
|
15601
|
+
return arrow2Down(ctx, this.parseSize(size) / 4 + offset, transX, transY);
|
|
15519
15602
|
}
|
|
15520
15603
|
}
|
|
15521
15604
|
var arrow2Down$1 = new Arrow2DownSymbol();
|
|
@@ -15528,13 +15611,13 @@ class LineVSymbol extends BaseSymbol {
|
|
|
15528
15611
|
super(...arguments), this.type = "lineV", this.pathStr = "M0,-0.5L0,0.5";
|
|
15529
15612
|
}
|
|
15530
15613
|
draw(ctx, size, x, y, z) {
|
|
15531
|
-
return lineV(ctx, size / 2, x, y);
|
|
15614
|
+
return lineV(ctx, this.parseSize(size) / 2, x, y);
|
|
15532
15615
|
}
|
|
15533
15616
|
drawOffset(ctx, size, x, y, offset, z) {
|
|
15534
|
-
return lineV(ctx, size / 2 + offset, x, y);
|
|
15617
|
+
return lineV(ctx, this.parseSize(size) / 2 + offset, x, y);
|
|
15535
15618
|
}
|
|
15536
15619
|
drawToSvgPath(size, x, y, z) {
|
|
15537
|
-
const r = size / 2;
|
|
15620
|
+
const r = this.parseSize(size) / 2;
|
|
15538
15621
|
return `M ${x}, ${y - r} L ${x},${y + r}`;
|
|
15539
15622
|
}
|
|
15540
15623
|
}
|
|
@@ -15548,13 +15631,13 @@ class LineHSymbol extends BaseSymbol {
|
|
|
15548
15631
|
super(...arguments), this.type = "lineH", this.pathStr = "M-0.5,0L0.5,0";
|
|
15549
15632
|
}
|
|
15550
15633
|
draw(ctx, size, x, y, z) {
|
|
15551
|
-
return lineH(ctx, size / 2, x, y);
|
|
15634
|
+
return lineH(ctx, this.parseSize(size) / 2, x, y);
|
|
15552
15635
|
}
|
|
15553
15636
|
drawOffset(ctx, size, x, y, offset, z) {
|
|
15554
|
-
return lineH(ctx, size / 2 + offset, x, y);
|
|
15637
|
+
return lineH(ctx, this.parseSize(size) / 2 + offset, x, y);
|
|
15555
15638
|
}
|
|
15556
15639
|
drawToSvgPath(size, x, y, z) {
|
|
15557
|
-
const r = size / 2;
|
|
15640
|
+
const r = this.parseSize(size) / 2;
|
|
15558
15641
|
return `M ${x - r}, ${y} L ${x + r},${y}`;
|
|
15559
15642
|
}
|
|
15560
15643
|
}
|
|
@@ -15568,13 +15651,13 @@ class CloseSymbol extends BaseSymbol {
|
|
|
15568
15651
|
super(...arguments), this.type = "close", this.pathStr = "M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5";
|
|
15569
15652
|
}
|
|
15570
15653
|
draw(ctx, size, x, y, z) {
|
|
15571
|
-
return close(ctx, size / 2, x, y);
|
|
15654
|
+
return close(ctx, this.parseSize(size) / 2, x, y);
|
|
15572
15655
|
}
|
|
15573
15656
|
drawOffset(ctx, size, x, y, offset, z) {
|
|
15574
|
-
return close(ctx, size / 2 + offset, x, y);
|
|
15657
|
+
return close(ctx, this.parseSize(size) / 2 + offset, x, y);
|
|
15575
15658
|
}
|
|
15576
15659
|
drawToSvgPath(size, x, y, z) {
|
|
15577
|
-
const r = size / 2;
|
|
15660
|
+
const r = this.parseSize(size) / 2;
|
|
15578
15661
|
return `M ${x - r}, ${y - r} L ${x + r},${y + r} M ${x + r}, ${y - r} L ${x - r},${y + r}`;
|
|
15579
15662
|
}
|
|
15580
15663
|
}
|
|
@@ -15608,15 +15691,18 @@ class CustomSymbolClass {
|
|
|
15608
15691
|
this.pathStr = "", this.type = type, isArray$1(path) ? this.svgCache = path : this.path = path, this.isSvg = isSvg;
|
|
15609
15692
|
}
|
|
15610
15693
|
drawOffset(ctx, size, x, y, offset, z, cb) {
|
|
15611
|
-
return this.isSvg ? !!this.svgCache && (this.svgCache.forEach(item => {
|
|
15694
|
+
return size = this.parseSize(size), this.isSvg ? !!this.svgCache && (this.svgCache.forEach(item => {
|
|
15612
15695
|
ctx.beginPath(), renderCommandList(item.path.commandList, ctx, x, y, size, size), cb && cb(item.path, item.attribute);
|
|
15613
15696
|
}), !1) : (renderCommandList(this.path.commandList, ctx, x, y, size + offset, size + offset), !1);
|
|
15614
15697
|
}
|
|
15615
15698
|
draw(ctx, size, x, y, z, cb) {
|
|
15616
|
-
return this.drawOffset(ctx, size, x, y, 0, z, cb);
|
|
15699
|
+
return size = this.parseSize(size), this.drawOffset(ctx, size, x, y, 0, z, cb);
|
|
15700
|
+
}
|
|
15701
|
+
parseSize(size) {
|
|
15702
|
+
return isNumber$1(size) ? size : Math.min(size[0], size[1]);
|
|
15617
15703
|
}
|
|
15618
15704
|
bounds(size, bounds) {
|
|
15619
|
-
if (this.isSvg) {
|
|
15705
|
+
if (size = this.parseSize(size), this.isSvg) {
|
|
15620
15706
|
if (!this.svgCache) return;
|
|
15621
15707
|
return bounds.clear(), void this.svgCache.forEach(_ref => {
|
|
15622
15708
|
let {
|
|
@@ -16299,7 +16385,11 @@ class Paragraph {
|
|
|
16299
16385
|
case "sub":
|
|
16300
16386
|
baseline += this.descent / 2;
|
|
16301
16387
|
}
|
|
16302
|
-
"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)
|
|
16388
|
+
"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);
|
|
16389
|
+
const {
|
|
16390
|
+
lineWidth = 1
|
|
16391
|
+
} = this.character;
|
|
16392
|
+
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();
|
|
16303
16393
|
}
|
|
16304
16394
|
getWidthWithEllips(direction) {
|
|
16305
16395
|
let text = this.text;
|
|
@@ -18516,7 +18606,7 @@ class Stage extends Group {
|
|
|
18516
18606
|
constructor() {
|
|
18517
18607
|
let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
18518
18608
|
var _a;
|
|
18519
|
-
super({}), this._onVisibleChange = visible => {
|
|
18609
|
+
super({}), this.tickedBeforeRender = !0, this._onVisibleChange = visible => {
|
|
18520
18610
|
if (!(this._skipRender < 0)) if (visible) {
|
|
18521
18611
|
if (this.dirtyBounds) {
|
|
18522
18612
|
const b = this.window.getViewBox();
|
|
@@ -18527,7 +18617,10 @@ class Stage extends Group {
|
|
|
18527
18617
|
}, this.beforeRender = stage => {
|
|
18528
18618
|
this._beforeRender && this._beforeRender(stage);
|
|
18529
18619
|
}, this.afterRender = stage => {
|
|
18530
|
-
this.renderCount++, this._afterRender && this._afterRender(stage), this._afterNextRenderCbs && this._afterNextRenderCbs.forEach(cb => cb(stage)), this._afterNextRenderCbs = null;
|
|
18620
|
+
this.renderCount++, this._afterRender && this._afterRender(stage), this._afterNextRenderCbs && this._afterNextRenderCbs.forEach(cb => cb(stage)), this._afterNextRenderCbs = null, this.tickedBeforeRender = !1;
|
|
18621
|
+
}, this.afterTickCb = () => {
|
|
18622
|
+
var _a;
|
|
18623
|
+
this.tickedBeforeRender = !0, "performance" === (null === (_a = this.params.optimize) || void 0 === _a ? void 0 : _a.tickRenderMode) || "rendering" !== this.state && this.render();
|
|
18531
18624
|
}, this.params = params, this.theme = new Theme(), this.hooks = {
|
|
18532
18625
|
beforeRender: new SyncHook(["stage"]),
|
|
18533
18626
|
afterRender: new SyncHook(["stage"])
|
|
@@ -18544,7 +18637,7 @@ class Stage extends Group {
|
|
|
18544
18637
|
main: !0
|
|
18545
18638
|
})), 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({
|
|
18546
18639
|
background: this._background
|
|
18547
|
-
});
|
|
18640
|
+
}), this.ticker.on("afterTick", this.afterTickCb);
|
|
18548
18641
|
}
|
|
18549
18642
|
pauseRender() {
|
|
18550
18643
|
let sr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1;
|
|
@@ -18773,7 +18866,7 @@ class Stage extends Group {
|
|
|
18773
18866
|
if ("released" === this.releaseStatus) return;
|
|
18774
18867
|
this.ticker.start(), this.timeline.resume();
|
|
18775
18868
|
const state = this.state;
|
|
18776
|
-
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++;
|
|
18869
|
+
this.state = "rendering", this.tickedBeforeRender || this.ticker.trySyncTickStatus(), 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++;
|
|
18777
18870
|
}
|
|
18778
18871
|
combineLayersToWindow() {
|
|
18779
18872
|
if ("harmony" === this.global.env) {
|
|
@@ -18879,7 +18972,7 @@ class Stage extends Group {
|
|
|
18879
18972
|
layer.release();
|
|
18880
18973
|
}), this.interactiveLayer && (this.interactiveLayer.forEachChildren(item => {
|
|
18881
18974
|
item.setStage && item.setStage(null, null), this.interactiveLayer.removeChild(item);
|
|
18882
|
-
}), this.interactiveLayer.release()), this.window.release(), this.ticker.remTimeline(this.timeline), this.renderService.renderTreeRoots = [];
|
|
18975
|
+
}), this.interactiveLayer.release()), this.window.release(), this.ticker.remTimeline(this.timeline), this.ticker.removeListener("afterTick", this.afterTickCb), this.renderService.renderTreeRoots = [];
|
|
18883
18976
|
}
|
|
18884
18977
|
setStage(stage) {}
|
|
18885
18978
|
dirty(b, matrix) {
|
|
@@ -23858,7 +23951,7 @@ class Gesture extends EventEmitter {
|
|
|
23858
23951
|
startTime: startTime,
|
|
23859
23952
|
startPoints: startPoints
|
|
23860
23953
|
} = this;
|
|
23861
|
-
if (eventType) return eventType;
|
|
23954
|
+
if ("press" === eventType) return eventType;
|
|
23862
23955
|
let type;
|
|
23863
23956
|
return type = clock.now() - startTime > this.config.press.time && calcDistance(startPoints[0], point) < this.config.press.threshold ? "press" : "pan", this.eventType = type, type;
|
|
23864
23957
|
}
|
|
@@ -24390,9 +24483,10 @@ let BrowserContext2d = class {
|
|
|
24390
24483
|
lineJoin = defaultParams.lineJoin,
|
|
24391
24484
|
lineDash = defaultParams.lineDash,
|
|
24392
24485
|
lineCap = defaultParams.lineCap,
|
|
24393
|
-
miterLimit = defaultParams.miterLimit
|
|
24486
|
+
miterLimit = defaultParams.miterLimit,
|
|
24487
|
+
keepStrokeScale = defaultParams.keepStrokeScale
|
|
24394
24488
|
} = attribute;
|
|
24395
|
-
_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;
|
|
24489
|
+
_context.lineWidth = keepStrokeScale ? 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;
|
|
24396
24490
|
}
|
|
24397
24491
|
}
|
|
24398
24492
|
setTextStyleWithoutAlignBaseline(params, defaultParams, z) {
|
|
@@ -25292,8 +25386,9 @@ class PickerBase {
|
|
|
25292
25386
|
return this.canvasRenderer.drawShape(graphic, pickContext, x, y, {}, null, (context, arcAttribute, themeAttribute) => !!picked || (picked = context.isPointInPath(point.x, point.y), picked), (context, arcAttribute, themeAttribute) => {
|
|
25293
25387
|
if (picked) return !0;
|
|
25294
25388
|
const lineWidth = arcAttribute.lineWidth || themeAttribute.lineWidth,
|
|
25295
|
-
pickStrokeBuffer = arcAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer
|
|
25296
|
-
|
|
25389
|
+
pickStrokeBuffer = arcAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer,
|
|
25390
|
+
keepStrokeScale = arcAttribute.keepStrokeScale || themeAttribute.keepStrokeScale;
|
|
25391
|
+
return pickContext.lineWidth = keepStrokeScale ? lineWidth + pickStrokeBuffer : getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(point.x, point.y), picked;
|
|
25297
25392
|
}), pickContext.highPerformanceRestore(), picked;
|
|
25298
25393
|
}
|
|
25299
25394
|
}
|
|
@@ -25566,8 +25661,9 @@ class RectPickerBase {
|
|
|
25566
25661
|
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) => {
|
|
25567
25662
|
if (picked) return !0;
|
|
25568
25663
|
const lineWidth = rectAttribute.lineWidth || themeAttribute.lineWidth,
|
|
25569
|
-
pickStrokeBuffer = rectAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer
|
|
25570
|
-
|
|
25664
|
+
pickStrokeBuffer = rectAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer,
|
|
25665
|
+
keepStrokeScale = rectAttribute.keepStrokeScale || themeAttribute.keepStrokeScale;
|
|
25666
|
+
return pickContext.lineWidth = keepStrokeScale ? lineWidth + pickStrokeBuffer : getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(point.x, point.y), picked;
|
|
25571
25667
|
});else {
|
|
25572
25668
|
const {
|
|
25573
25669
|
fill = rectAttribute.fill,
|
|
@@ -25881,9 +25977,10 @@ let LynxContext2d = class extends BrowserContext2d {
|
|
|
25881
25977
|
lineJoin = defaultParams.lineJoin,
|
|
25882
25978
|
lineDash = defaultParams.lineDash,
|
|
25883
25979
|
lineCap = defaultParams.lineCap,
|
|
25884
|
-
miterLimit = defaultParams.miterLimit
|
|
25980
|
+
miterLimit = defaultParams.miterLimit,
|
|
25981
|
+
keepStrokeScale = defaultParams.keepStrokeScale
|
|
25885
25982
|
} = attribute;
|
|
25886
|
-
_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;
|
|
25983
|
+
_context.globalAlpha = strokeOpacity * opacity * this.baseGlobalAlpha, _context.lineWidth = keepStrokeScale ? 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;
|
|
25887
25984
|
}
|
|
25888
25985
|
}
|
|
25889
25986
|
measureText(text) {
|
|
@@ -26511,9 +26608,10 @@ let TaroContext2d = class extends BrowserContext2d {
|
|
|
26511
26608
|
lineJoin = defaultParams.lineJoin,
|
|
26512
26609
|
lineDash = defaultParams.lineDash,
|
|
26513
26610
|
lineCap = defaultParams.lineCap,
|
|
26514
|
-
miterLimit = defaultParams.miterLimit
|
|
26611
|
+
miterLimit = defaultParams.miterLimit,
|
|
26612
|
+
keepStrokeScale = defaultParams.keepStrokeScale
|
|
26515
26613
|
} = attribute;
|
|
26516
|
-
_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);
|
|
26614
|
+
_context.setGlobalAlpha(strokeOpacity * opacity), _context.setLineWidth(keepStrokeScale ? lineWidth : 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);
|
|
26517
26615
|
}
|
|
26518
26616
|
}
|
|
26519
26617
|
setTextStyleWithoutAlignBaseline(params, defaultParams) {
|
|
@@ -27553,9 +27651,10 @@ let HarmonyContext2d = class extends BrowserContext2d {
|
|
|
27553
27651
|
lineJoin = defaultParams.lineJoin,
|
|
27554
27652
|
lineDash = defaultParams.lineDash,
|
|
27555
27653
|
lineCap = defaultParams.lineCap,
|
|
27556
|
-
miterLimit = defaultParams.miterLimit
|
|
27654
|
+
miterLimit = defaultParams.miterLimit,
|
|
27655
|
+
keepStrokeScale = defaultParams.keepStrokeScale
|
|
27557
27656
|
} = attribute;
|
|
27558
|
-
_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;
|
|
27657
|
+
_context.globalAlpha = strokeOpacity * opacity * this.baseGlobalAlpha, _context.lineWidth = keepStrokeScale ? 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;
|
|
27559
27658
|
}
|
|
27560
27659
|
}
|
|
27561
27660
|
measureText(text) {
|
|
@@ -27962,8 +28061,9 @@ class BaseLinePicker extends BaseRender {
|
|
|
27962
28061
|
return this.canvasRenderer.drawShape(graphic, pickContext, x, y, {}, null, context => !!picked || (picked = context.isPointInPath(pickPoint.x, pickPoint.y), picked), (context, lineAttribute, themeAttribute) => {
|
|
27963
28062
|
if (picked) return !0;
|
|
27964
28063
|
const lineWidth = lineAttribute.lineWidth || themeAttribute.lineWidth,
|
|
27965
|
-
pickStrokeBuffer = lineAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer
|
|
27966
|
-
|
|
28064
|
+
pickStrokeBuffer = lineAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer,
|
|
28065
|
+
keepStrokeScale = lineAttribute.keepStrokeScale || themeAttribute.keepStrokeScale;
|
|
28066
|
+
return pickContext.lineWidth = keepStrokeScale ? lineWidth + pickStrokeBuffer : getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(pickPoint.x, pickPoint.y), picked;
|
|
27967
28067
|
}), this.canvasRenderer.z = 0, pickContext.modelMatrix !== lastModelMatrix && mat4Allocate.free(pickContext.modelMatrix), pickContext.modelMatrix = lastModelMatrix, pickContext.highPerformanceRestore(), picked;
|
|
27968
28068
|
}
|
|
27969
28069
|
}
|
|
@@ -28098,8 +28198,9 @@ let DefaultCanvasSymbolPicker = class extends Base3dPicker {
|
|
|
28098
28198
|
return this.canvasRenderer.drawShape(symbol, pickContext, x, y, {}, null, (context, symbolAttribute, themeAttribute) => !!picked || (picked = context.isPointInPath(pickPoint.x, pickPoint.y), picked), (context, symbolAttribute, themeAttribute) => {
|
|
28099
28199
|
if (picked) return !0;
|
|
28100
28200
|
const lineWidth = symbolAttribute.lineWidth || themeAttribute.lineWidth,
|
|
28101
|
-
pickStrokeBuffer = symbolAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer
|
|
28102
|
-
|
|
28201
|
+
pickStrokeBuffer = symbolAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer,
|
|
28202
|
+
keepStrokeScale = symbolAttribute.keepStrokeScale || themeAttribute.keepStrokeScale;
|
|
28203
|
+
return pickContext.lineWidth = keepStrokeScale ? lineWidth + pickStrokeBuffer : getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(pickPoint.x, pickPoint.y), picked;
|
|
28103
28204
|
}), this.canvasRenderer.z = 0, pickContext.modelMatrix !== lastModelMatrix && mat4Allocate.free(pickContext.modelMatrix), pickContext.modelMatrix = lastModelMatrix, pickContext.highPerformanceRestore(), picked;
|
|
28104
28205
|
}
|
|
28105
28206
|
};
|
|
@@ -28193,8 +28294,10 @@ let DefaultCanvasTextPicker = class extends Base3dPicker {
|
|
|
28193
28294
|
} = text.attribute,
|
|
28194
28295
|
bounds = text.AABBBounds,
|
|
28195
28296
|
height = bounds.height(),
|
|
28196
|
-
width = bounds.width()
|
|
28197
|
-
|
|
28297
|
+
width = bounds.width(),
|
|
28298
|
+
offsetY = textLayoutOffsetY(textBaseline, height, fontSize),
|
|
28299
|
+
offsetX = textDrawOffsetX(textAlign, width);
|
|
28300
|
+
return context.rect(offsetX + x, offsetY + y, width, height, z), picked = context.isPointInPath(pickPoint.x, pickPoint.y), picked;
|
|
28198
28301
|
}, (context, symbolAttribute, themeAttribute) => picked), this.canvasRenderer.z = 0, pickContext.modelMatrix !== lastModelMatrix && mat4Allocate.free(pickContext.modelMatrix), pickContext.modelMatrix = lastModelMatrix, pickContext.highPerformanceRestore(), picked;
|
|
28199
28302
|
}
|
|
28200
28303
|
};
|
|
@@ -28534,7 +28637,7 @@ const registerWrapText = _registerWrapText;
|
|
|
28534
28637
|
|
|
28535
28638
|
const roughModule = _roughModule;
|
|
28536
28639
|
|
|
28537
|
-
const version = "0.21.0-
|
|
28640
|
+
const version = "0.21.0-beta.0";
|
|
28538
28641
|
preLoadAllModule();
|
|
28539
28642
|
if (isBrowserEnv()) {
|
|
28540
28643
|
loadBrowserEnv(container);
|