@visactor/vrender 0.20.16 → 0.21.0-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -742,6 +742,13 @@ let DefaultGlobal = class {
742
742
  };
743
743
  DefaultGlobal = __decorate$1H([injectable(), __param$T(0, inject(ContributionProvider)), __param$T(0, named(EnvContribution)), __metadata$1h("design:paramtypes", [Object])], DefaultGlobal);
744
744
 
745
+ var MeasureModeEnum;
746
+ !function (MeasureModeEnum) {
747
+ MeasureModeEnum[MeasureModeEnum.estimate = 0] = "estimate", MeasureModeEnum[MeasureModeEnum.actualBounding = 1] = "actualBounding", MeasureModeEnum[MeasureModeEnum.fontBounding = 2] = "fontBounding";
748
+ }(MeasureModeEnum || (MeasureModeEnum = {}));
749
+
750
+ const strCommandMap = ["arc", "arcTo", "bezierCurveTo", "closePath", "ellipse", "lineTo", "moveTo", "quadraticCurveTo", "rect"];
751
+
745
752
  function getDefaultExportFromCjs (x) {
746
753
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
747
754
  }
@@ -1696,7 +1703,9 @@ class TextMeasure {
1696
1703
  } = this.textSpec;
1697
1704
  return {
1698
1705
  width: metrics.width,
1699
- height: null !== (_a = lineHeight) && void 0 !== _a ? _a : fontSize
1706
+ height: null !== (_a = lineHeight) && void 0 !== _a ? _a : fontSize,
1707
+ fontBoundingBoxAscent: metrics.fontBoundingBoxAscent,
1708
+ fontBoundingBoxDescent: metrics.fontBoundingBoxDescent
1700
1709
  };
1701
1710
  }
1702
1711
  quickMeasure(text) {
@@ -1710,7 +1719,7 @@ class TextMeasure {
1710
1719
  for (let i = 0; i < text.length; i++) {
1711
1720
  const char = text[i];
1712
1721
  let size = this._measureSpecialChar(char);
1713
- isNil$1(size) && TextMeasure.NUMBERS_CHAR_SET.includes(char) && (size = this._measureNumberChar()), isNil$1(size) && ["F", "W"].includes(eastAsianCharacterInfo(char)) && (size = this._measureFullSizeChar()), isNil$1(size) && (size = this._measureLetterChar()), totalSize.width += size.width, totalSize.height = Math.max(totalSize.height, size.height);
1722
+ isNil$1(size) && TextMeasure.NUMBERS_CHAR_SET.includes(char) && (size = this._measureNumberChar()), isNil$1(size) && ["F", "W"].includes(eastAsianCharacterInfo(char)) && (size = this._measureFullSizeChar()), isNil$1(size) && (size = this._measureLetterChar()), totalSize.width += size.width, totalSize.height = Math.max(totalSize.height, size.height), !isNil$1(size.fontBoundingBoxAscent) && (totalSize.fontBoundingBoxAscent = size.fontBoundingBoxAscent), !isNil$1(size.fontBoundingBoxDescent) && (totalSize.fontBoundingBoxDescent = size.fontBoundingBoxDescent);
1714
1723
  }
1715
1724
  return totalSize;
1716
1725
  }
@@ -1759,7 +1768,9 @@ class TextMeasure {
1759
1768
  const numberBounds = this._standardMethod(TextMeasure.NUMBERS_CHAR_SET);
1760
1769
  this._numberCharSize = {
1761
1770
  width: numberBounds.width / TextMeasure.NUMBERS_CHAR_SET.length,
1762
- height: numberBounds.height
1771
+ height: numberBounds.height,
1772
+ fontBoundingBoxAscent: numberBounds.fontBoundingBoxAscent,
1773
+ fontBoundingBoxDescent: numberBounds.fontBoundingBoxDescent
1763
1774
  };
1764
1775
  }
1765
1776
  return this._numberCharSize;
@@ -1772,7 +1783,9 @@ class TextMeasure {
1772
1783
  const alphabetBounds = this._standardMethod(TextMeasure.ALPHABET_CHAR_SET);
1773
1784
  this._letterCharSize = {
1774
1785
  width: alphabetBounds.width / TextMeasure.ALPHABET_CHAR_SET.length,
1775
- height: alphabetBounds.height
1786
+ height: alphabetBounds.height,
1787
+ fontBoundingBoxAscent: alphabetBounds.fontBoundingBoxAscent,
1788
+ fontBoundingBoxDescent: alphabetBounds.fontBoundingBoxDescent
1776
1789
  };
1777
1790
  }
1778
1791
  return this._letterCharSize;
@@ -3913,6 +3926,7 @@ const DefaultStrokeStyle = Object.assign({
3913
3926
  const DefaultTextStyle = {
3914
3927
  text: "",
3915
3928
  maxLineWidth: 1 / 0,
3929
+ maxWidth: 1 / 0,
3916
3930
  textAlign: "left",
3917
3931
  textBaseline: "alphabetic",
3918
3932
  fontSize: 16,
@@ -3936,7 +3950,8 @@ const DefaultTextStyle = {
3936
3950
  suffixPosition: "end",
3937
3951
  underlineDash: [],
3938
3952
  underlineOffset: 0,
3939
- disableAutoClipedPoptip: void 0
3953
+ disableAutoClipedPoptip: void 0,
3954
+ measureMode: MeasureModeEnum.fontBounding
3940
3955
  };
3941
3956
  const DefaultPickStyle = {
3942
3957
  pickStrokeBuffer: 0
@@ -4143,448 +4158,260 @@ const DefaultRichTextIconAttribute = Object.assign(Object.assign({}, DefaultImag
4143
4158
  class Application {}
4144
4159
  const application = new Application();
4145
4160
 
4146
- const parse = function () {
4147
- const tokens = {
4148
- linearGradient: /^(linear\-gradient)/i,
4149
- radialGradient: /^(radial\-gradient)/i,
4150
- conicGradient: /^(conic\-gradient)/i,
4151
- sideOrCorner: /^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,
4152
- extentKeywords: /^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,
4153
- positionKeywords: /^(left|center|right|top|bottom)/i,
4154
- pixelValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,
4155
- percentageValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,
4156
- emValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,
4157
- angleValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,
4158
- fromAngleValue: /^from\s*(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,
4159
- startCall: /^\(/,
4160
- endCall: /^\)/,
4161
- comma: /^,/,
4162
- hexColor: /(^\#[0-9a-fA-F]+)/,
4163
- literalColor: /^([a-zA-Z]+)/,
4164
- rgbColor: /^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,
4165
- rgbaColor: /^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i,
4166
- number: /^(([0-9]*\.[0-9]+)|([0-9]+\.?))/
4167
- };
4168
- let input = "";
4169
- function error(msg) {
4170
- const err = new Error(input + ": " + msg);
4171
- throw err.source = input, err;
4172
- }
4173
- function getAST() {
4174
- const ast = matchListing(matchDefinition);
4175
- return input.length > 0 && error("Invalid input not EOF"), ast;
4161
+ const DIRECTION_KEY = {
4162
+ horizontal: {
4163
+ width: "width",
4164
+ height: "height",
4165
+ left: "left",
4166
+ top: "top",
4167
+ x: "x",
4168
+ y: "y",
4169
+ bottom: "bottom"
4170
+ },
4171
+ vertical: {
4172
+ width: "height",
4173
+ height: "width",
4174
+ left: "top",
4175
+ top: "left",
4176
+ x: "y",
4177
+ y: "x",
4178
+ bottom: "right"
4176
4179
  }
4177
- function matchDefinition() {
4178
- return matchGradient("linear", tokens.linearGradient, matchLinearOrientation) || matchGradient("radial", tokens.radialGradient, matchListRadialOrientations) || matchGradient("conic", tokens.conicGradient, matchConicalOrientation);
4180
+ };
4181
+ const defaultFormatting = {
4182
+ fontSize: 16,
4183
+ fontFamily: "sans-serif",
4184
+ fill: !0,
4185
+ stroke: !1,
4186
+ fontWeight: "normal",
4187
+ lineHeight: "normal",
4188
+ fontStyle: "normal",
4189
+ textDecoration: "none",
4190
+ textAlign: "left",
4191
+ script: "normal"
4192
+ };
4193
+ const regLetter = /\w|\(|\)|-/;
4194
+ const regPunctuation = /[.?!,;:/,。?!、;:]/;
4195
+ const regFirstSpace = /\S/;
4196
+ const setTextStyle = (ctx, character) => {
4197
+ let fontSize = character.fontSize || 16;
4198
+ switch (character.script) {
4199
+ case "super":
4200
+ case "sub":
4201
+ fontSize *= .8;
4179
4202
  }
4180
- function matchGradient(gradientType, pattern, orientationMatcher) {
4181
- return function (pattern, callback) {
4182
- const captures = scan(pattern);
4183
- if (captures) {
4184
- scan(tokens.startCall) || error("Missing (");
4185
- const result = callback(captures);
4186
- return scan(tokens.endCall) || error("Missing )"), result;
4187
- }
4188
- }(pattern, function (captures) {
4189
- const orientation = orientationMatcher();
4190
- return orientation && (scan(tokens.comma) || error("Missing comma before color stops")), {
4191
- type: gradientType,
4192
- orientation: orientation,
4193
- colorStops: matchListing(matchColorStop)
4194
- };
4195
- });
4203
+ ctx.setTextStyle({
4204
+ textAlign: "left",
4205
+ textBaseline: character.textBaseline || "alphabetic",
4206
+ fontStyle: character.fontStyle || "",
4207
+ fontWeight: character.fontWeight || "",
4208
+ fontSize: fontSize,
4209
+ fontFamily: character.fontFamily || "sans-serif"
4210
+ });
4211
+ };
4212
+ function applyFillStyle(ctx, character) {
4213
+ const fillStyle = character && character.fill || defaultFormatting.fill;
4214
+ if (!fillStyle) return void (ctx.globalAlpha = 0);
4215
+ const {
4216
+ fillOpacity = 1,
4217
+ opacity = 1
4218
+ } = character;
4219
+ ctx.globalAlpha = fillOpacity * opacity, ctx.fillStyle = fillStyle, setTextStyle(ctx, character);
4220
+ }
4221
+ function applyStrokeStyle(ctx, character) {
4222
+ const strokeStyle = character && character.stroke || defaultFormatting.stroke;
4223
+ if (!strokeStyle) return void (ctx.globalAlpha = 0);
4224
+ const {
4225
+ strokeOpacity = 1,
4226
+ opacity = 1
4227
+ } = character;
4228
+ ctx.globalAlpha = strokeOpacity * opacity, ctx.lineWidth = character && "number" == typeof character.lineWidth ? character.lineWidth : 1, ctx.strokeStyle = strokeStyle, setTextStyle(ctx, character);
4229
+ }
4230
+ function getStrByWithCanvas(desc, width, character, guessIndex, needTestLetter) {
4231
+ if (!width || width <= 0) return 0;
4232
+ const textMeasure = application.graphicUtil.textMeasure;
4233
+ let index = guessIndex,
4234
+ temp = desc.slice(0, index),
4235
+ tempWidth = Math.floor(textMeasure.measureText(temp, character).width),
4236
+ tempNext = desc.slice(0, index + 1),
4237
+ tempWidthNext = Math.floor(textMeasure.measureText(tempNext, character).width);
4238
+ for (; tempWidth > width || tempWidthNext <= width;) {
4239
+ if (tempWidth > width ? index-- : index++, index > desc.length) {
4240
+ index = desc.length;
4241
+ break;
4242
+ }
4243
+ if (index < 0) {
4244
+ index = 0;
4245
+ break;
4246
+ }
4247
+ temp = desc.slice(0, index), tempWidth = Math.floor(textMeasure.measureText(temp, character).width), tempNext = desc.slice(0, index + 1), tempWidthNext = Math.floor(textMeasure.measureText(tempNext, character).width);
4196
4248
  }
4197
- function matchLinearOrientation() {
4198
- return match("directional", tokens.sideOrCorner, 1) || match("angular", tokens.angleValue, 1);
4249
+ return needTestLetter && (index = testLetter(desc, index)), index;
4250
+ }
4251
+ function testLetter(string, index) {
4252
+ let negativeWrongMatch = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
4253
+ let i = index;
4254
+ for (; regLetter.test(string[i - 1]) && regLetter.test(string[i]) || regPunctuation.test(string[i]);) if (i--, i <= 0) return negativeWrongMatch ? testLetter2(string, index) : index;
4255
+ return i;
4256
+ }
4257
+ function testLetter2(string, index) {
4258
+ let i = index;
4259
+ for (; regLetter.test(string[i - 1]) && regLetter.test(string[i]) || regPunctuation.test(string[i]);) if (i++, i >= string.length) return i;
4260
+ return i;
4261
+ }
4262
+ function measureTextCanvas(text, character) {
4263
+ const measurement = application.graphicUtil.textMeasure.measureText(text, character),
4264
+ result = {
4265
+ ascent: 0,
4266
+ height: 0,
4267
+ descent: 0,
4268
+ width: 0
4269
+ };
4270
+ return "number" != typeof measurement.actualBoundingBoxAscent || "number" != typeof measurement.actualBoundingBoxDescent ? (result.width = Math.floor(measurement.width), result.height = character.fontSize || 0, result.ascent = result.height, result.descent = 0) : (result.width = Math.floor(measurement.width), result.height = Math.floor(measurement.actualBoundingBoxAscent + measurement.actualBoundingBoxDescent), result.ascent = Math.floor(measurement.actualBoundingBoxAscent), result.descent = result.height - result.ascent), result;
4271
+ }
4272
+
4273
+ var __decorate$1G = undefined && undefined.__decorate || function (decorators, target, key, desc) {
4274
+ var d,
4275
+ c = arguments.length,
4276
+ r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
4277
+ if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) (d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
4278
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
4279
+ };
4280
+ let ATextMeasure = class {
4281
+ configure(service, env) {
4282
+ this.canvas = service.canvas, this.context = service.context, service.bindTextMeasure(this);
4199
4283
  }
4200
- function matchConicalOrientation() {
4201
- return match("angular", tokens.fromAngleValue, 1);
4284
+ _measureTextWithoutAlignBaseline(text, options, compatible) {
4285
+ this.context.setTextStyleWithoutAlignBaseline(options);
4286
+ const metrics = this.context.measureText(text);
4287
+ return compatible ? this.compatibleMetrics(metrics, options) : metrics;
4202
4288
  }
4203
- function matchListRadialOrientations() {
4204
- let radialOrientations,
4205
- lookaheadCache,
4206
- radialOrientation = matchRadialOrientation();
4207
- return radialOrientation && (radialOrientations = [], radialOrientations.push(radialOrientation), lookaheadCache = input, scan(tokens.comma) && (radialOrientation = matchRadialOrientation(), radialOrientation ? radialOrientations.push(radialOrientation) : input = lookaheadCache)), radialOrientations;
4289
+ _measureTextWithAlignBaseline(text, options, compatible) {
4290
+ this.context.setTextStyle(options);
4291
+ const metrics = this.context.measureText(text);
4292
+ return compatible ? this.compatibleMetrics(metrics, options) : metrics;
4208
4293
  }
4209
- function matchRadialOrientation() {
4210
- let radialType = function () {
4211
- const circle = match("shape", /^(circle)/i, 0);
4212
- circle && (circle.style = matchLength() || matchExtentKeyword());
4213
- return circle;
4214
- }() || function () {
4215
- const ellipse = match("shape", /^(ellipse)/i, 0);
4216
- ellipse && (ellipse.style = matchDistance() || matchExtentKeyword());
4217
- return ellipse;
4218
- }();
4219
- if (radialType) radialType.at = matchAtPosition();else {
4220
- const extent = matchExtentKeyword();
4221
- if (extent) {
4222
- radialType = extent;
4223
- const positionAt = matchAtPosition();
4224
- positionAt && (radialType.at = positionAt);
4225
- } else {
4226
- const defaultPosition = matchPositioning();
4227
- defaultPosition && (radialType = {
4228
- type: "default-radial",
4229
- at: defaultPosition
4230
- });
4231
- }
4294
+ compatibleMetrics(metrics, options) {
4295
+ if (null == metrics.actualBoundingBoxAscent || null == metrics.actualBoundingBoxDescent || null == metrics.fontBoundingBoxAscent || null == metrics.fontBoundingBoxDescent) {
4296
+ const {
4297
+ ascent: ascent,
4298
+ descent: descent
4299
+ } = this.measureTextBoundADscentEstimate(options);
4300
+ metrics.actualBoundingBoxAscent = ascent, metrics.actualBoundingBoxDescent = descent, metrics.fontBoundingBoxAscent = ascent, metrics.fontBoundingBoxDescent = descent;
4232
4301
  }
4233
- return radialType;
4234
- }
4235
- function matchExtentKeyword() {
4236
- return match("extent-keyword", tokens.extentKeywords, 1);
4237
- }
4238
- function matchAtPosition() {
4239
- if (match("position", /^at/, 0)) {
4240
- const positioning = matchPositioning();
4241
- return positioning || error("Missing positioning value"), positioning;
4302
+ if (null == metrics.actualBoundingBoxLeft || null == metrics.actualBoundingBoxRight) {
4303
+ const {
4304
+ left: left,
4305
+ right: right
4306
+ } = this.measureTextBoundLeftRightEstimate(options);
4307
+ metrics.actualBoundingBoxLeft = left, metrics.actualBoundingBoxRight = right;
4242
4308
  }
4309
+ return metrics;
4243
4310
  }
4244
- function matchPositioning() {
4245
- const location = {
4246
- x: matchDistance(),
4247
- y: matchDistance()
4248
- };
4249
- if (location.x || location.y) return {
4250
- type: "position",
4251
- value: location
4311
+ estimate(text, _ref) {
4312
+ let {
4313
+ fontSize = DefaultTextAttribute.fontSize
4314
+ } = _ref;
4315
+ let eCharLen = 0,
4316
+ cCharLen = 0;
4317
+ for (let i = 0; i < text.length; i++) text.charCodeAt(i) < 128 ? eCharLen++ : cCharLen++;
4318
+ return {
4319
+ width: ~~(.8 * eCharLen * fontSize + cCharLen * fontSize),
4320
+ height: fontSize
4252
4321
  };
4253
4322
  }
4254
- function matchListing(matcher) {
4255
- let captures = matcher();
4256
- const result = [];
4257
- if (captures) for (result.push(captures); scan(tokens.comma);) captures = matcher(), captures ? result.push(captures) : error("One extra comma");
4258
- return result;
4323
+ measureTextWidth(text, options, textMeasure) {
4324
+ return this.context ? (textMeasure = null != textMeasure ? textMeasure : this._measureTextWithoutAlignBaseline(text, options)).width : this.estimate(text, options).width;
4259
4325
  }
4260
- function matchColorStop() {
4261
- const color = match("hex", tokens.hexColor, 1) || match("rgba", tokens.rgbaColor, 1) || match("rgb", tokens.rgbColor, 1) || match("literal", tokens.literalColor, 0);
4262
- return color || error("Expected color definition"), color.length = matchDistance(), color;
4326
+ measureTextBoundsWidth(text, options, textMeasure) {
4327
+ return this.context ? (textMeasure = null != textMeasure ? textMeasure : this._measureTextWithoutAlignBaseline(text, options)).width : this.estimate(text, options).width;
4263
4328
  }
4264
- function matchDistance() {
4265
- return match("%", tokens.percentageValue, 1) || match("position-keyword", tokens.positionKeywords, 1) || matchLength();
4329
+ measureTextBoundsLeftRight(text, options, textMeasure) {
4330
+ return this.context ? {
4331
+ left: (textMeasure = null != textMeasure ? textMeasure : this._measureTextWithAlignBaseline(text, options, !0)).actualBoundingBoxLeft,
4332
+ right: textMeasure.actualBoundingBoxRight
4333
+ } : this.measureTextBoundLeftRightEstimate(options);
4266
4334
  }
4267
- function matchLength() {
4268
- return match("px", tokens.pixelValue, 1) || match("em", tokens.emValue, 1);
4335
+ measureTextPixelHeight(text, options, textMeasure) {
4336
+ var _a;
4337
+ return this.context ? (textMeasure = null != textMeasure ? textMeasure : this._measureTextWithoutAlignBaseline(text, options, !0), Math.abs(textMeasure.actualBoundingBoxAscent - textMeasure.actualBoundingBoxDescent)) : null !== (_a = options.fontSize) && void 0 !== _a ? _a : DefaultTextStyle.fontSize;
4269
4338
  }
4270
- function match(type, pattern, captureIndex) {
4271
- const captures = scan(pattern);
4272
- if (captures) return {
4273
- type: type,
4274
- value: captures[captureIndex]
4275
- };
4339
+ measureTextPixelADscent(text, options, textMeasure) {
4340
+ return this.context ? {
4341
+ ascent: (textMeasure = null != textMeasure ? textMeasure : this._measureTextWithAlignBaseline(text, options, !0)).actualBoundingBoxAscent,
4342
+ descent: textMeasure.actualBoundingBoxDescent
4343
+ } : this.measureTextBoundADscentEstimate(options);
4276
4344
  }
4277
- function scan(regexp) {
4278
- const blankCaptures = /^[\n\r\t\s]+/.exec(input);
4279
- blankCaptures && consume(blankCaptures[0].length);
4280
- const captures = regexp.exec(input);
4281
- return captures && consume(captures[0].length), captures;
4345
+ measureTextBoundHieght(text, options, textMeasure) {
4346
+ var _a;
4347
+ 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;
4282
4348
  }
4283
- function consume(size) {
4284
- input = input.substr(size);
4285
- }
4286
- return function (code) {
4287
- return input = code.toString(), getAST();
4288
- };
4289
- }();
4290
- class GradientParser {
4291
- static IsGradient(c) {
4292
- return !("string" == typeof c && !c.includes("gradient"));
4349
+ measureTextBoundADscent(text, options, textMeasure) {
4350
+ return this.context ? {
4351
+ ascent: (textMeasure = null != textMeasure ? textMeasure : this._measureTextWithAlignBaseline(text, options, !0)).fontBoundingBoxAscent,
4352
+ descent: textMeasure.fontBoundingBoxDescent
4353
+ } : this.measureTextBoundADscentEstimate(options);
4293
4354
  }
4294
- static IsGradientStr(c) {
4295
- return "string" == typeof c && c.includes("gradient");
4296
- }
4297
- static Parse(c) {
4298
- if (GradientParser.IsGradientStr(c)) try {
4299
- const datum = parse(c)[0];
4300
- if (datum) {
4301
- if ("linear" === datum.type) return GradientParser.ParseLinear(datum);
4302
- if ("radial" === datum.type) return GradientParser.ParseRadial(datum);
4303
- if ("conic" === datum.type) return GradientParser.ParseConic(datum);
4304
- }
4305
- } catch (err) {
4306
- return c;
4307
- }
4308
- return c;
4309
- }
4310
- static ParseConic(datum) {
4311
- const {
4312
- orientation: orientation,
4313
- colorStops = []
4314
- } = datum,
4315
- halfPi = pi / 2,
4316
- sa = parseFloat(orientation.value) / 180 * pi - halfPi;
4355
+ measureTextBoundADscentEstimate(options) {
4356
+ var _a;
4357
+ const fontSize = null !== (_a = options.fontSize) && void 0 !== _a ? _a : DefaultTextStyle.fontSize;
4317
4358
  return {
4318
- gradient: "conical",
4319
- x: .5,
4320
- y: .5,
4321
- startAngle: sa,
4322
- endAngle: sa + pi2,
4323
- stops: colorStops.map(item => ({
4324
- color: item.value,
4325
- offset: parseFloat(item.length.value) / 100
4326
- }))
4359
+ ascent: .79 * fontSize,
4360
+ descent: .21 * fontSize
4327
4361
  };
4328
4362
  }
4329
- static ParseRadial(datum) {
4330
- const {
4331
- colorStops = []
4332
- } = datum;
4333
- return {
4334
- gradient: "radial",
4335
- x0: .5,
4336
- y0: .5,
4337
- x1: .5,
4338
- y1: .5,
4339
- r0: 0,
4340
- r1: 1,
4341
- stops: colorStops.map(item => ({
4342
- color: item.value,
4343
- offset: parseFloat(item.length.value) / 100
4344
- }))
4363
+ measureTextBoundLeftRightEstimate(options) {
4364
+ var _a;
4365
+ const fontSize = null !== (_a = options.fontSize) && void 0 !== _a ? _a : DefaultTextStyle.fontSize,
4366
+ {
4367
+ textAlign: textAlign
4368
+ } = options;
4369
+ return "center" === textAlign ? {
4370
+ left: fontSize / 2,
4371
+ right: fontSize / 2
4372
+ } : "right" === textAlign || "end" === textAlign ? {
4373
+ left: fontSize,
4374
+ right: 0
4375
+ } : {
4376
+ left: 0,
4377
+ right: fontSize
4345
4378
  };
4346
4379
  }
4347
- static ParseLinear(datum) {
4348
- const {
4349
- orientation: orientation,
4350
- colorStops = []
4351
- } = datum,
4352
- halfPi = pi / 2;
4353
- let angle = "angular" === orientation.type ? parseFloat(orientation.value) / 180 * pi : 0;
4354
- for (; angle < 0;) angle += pi2;
4355
- for (; angle >= pi2;) angle -= pi2;
4356
- let x0 = 0,
4357
- y0 = 0,
4358
- x1 = 0,
4359
- y1 = 0;
4360
- return angle < halfPi ? (x0 = 0, y0 = 1, x1 = Math.sin(angle), y1 = y0 - Math.cos(angle)) : angle < pi ? (x0 = 0, y0 = 0, x1 = Math.cos(angle - halfPi), y1 = Math.sin(angle - halfPi)) : angle < pi + halfPi ? (x0 = 1, y0 = 0, x1 = x0 - Math.sin(angle - pi), y1 = Math.cos(angle - pi)) : (x0 = 1, x1 = x0 - Math.cos(angle - halfPi - pi), y1 -= Math.sin(angle - halfPi - pi)), {
4361
- gradient: "linear",
4362
- x0: x0,
4363
- y0: y0,
4364
- x1: x1,
4365
- y1: y1,
4366
- stops: colorStops.map(item => ({
4367
- color: item.value,
4368
- offset: parseFloat(item.length.value) / 100
4369
- }))
4380
+ measureTextPixelADscentAndWidth(text, options, mode) {
4381
+ if (!this.context) return Object.assign(Object.assign({}, this.measureTextBoundADscentEstimate(options)), {
4382
+ width: this.estimate(text, options).width
4383
+ });
4384
+ const out = this._measureTextWithoutAlignBaseline(text, options, !0);
4385
+ if (mode === MeasureModeEnum.actualBounding) return {
4386
+ ascent: out.actualBoundingBoxAscent,
4387
+ descent: out.actualBoundingBoxDescent,
4388
+ width: out.width
4370
4389
  };
4371
- }
4372
- }
4373
-
4374
- function getScaledStroke(context, width, dpr) {
4375
- let strokeWidth = width;
4376
- const {
4377
- a: a,
4378
- b: b,
4379
- c: c,
4380
- d: d
4381
- } = context.currentMatrix,
4382
- scaleX = Math.sign(a) * Math.sqrt(a * a + b * b),
4383
- scaleY = Math.sign(d) * Math.sqrt(c * c + d * d);
4384
- return scaleX + scaleY === 0 ? 0 : (strokeWidth = strokeWidth / Math.abs(scaleX + scaleY) * 2 * dpr, strokeWidth);
4385
- }
4386
- function createColor(context, c, params) {
4387
- let offsetX = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
4388
- let offsetY = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
4389
- if (!c || !0 === c) return "black";
4390
- let result, color;
4391
- if (isArray$1(c)) for (let i = 0; i < c.length && (color = c[i], !color); i++);else color = c;
4392
- if (color = GradientParser.Parse(color), "string" == typeof color) return color;
4393
- if (params.AABBBounds && (!params.attribute || 0 !== params.attribute.scaleX || 0 !== params.attribute.scaleY)) {
4394
- const bounds = params.AABBBounds;
4395
- let w = bounds.x2 - bounds.x1,
4396
- h = bounds.y2 - bounds.y1,
4397
- x = bounds.x1 - offsetX,
4398
- y = bounds.y1 - offsetY;
4399
- if (params.attribute) {
4400
- const {
4401
- scaleX = 1,
4402
- scaleY = 1
4403
- } = params.attribute;
4404
- w /= scaleX, h /= scaleY, x /= scaleX, y /= scaleY;
4405
- }
4406
- "linear" === color.gradient ? result = createLinearGradient(context, color, x, y, w, h) : "conical" === color.gradient ? result = createConicGradient(context, color, x, y, w, h) : "radial" === color.gradient && (result = createRadialGradient(context, color, x, y, w, h));
4407
- }
4408
- return result || "orange";
4409
- }
4410
- function createLinearGradient(context, color, x, y, w, h) {
4411
- var _a, _b, _c, _d;
4412
- const canvasGradient = context.createLinearGradient(x + (null !== (_a = color.x0) && void 0 !== _a ? _a : 0) * w, y + (null !== (_b = color.y0) && void 0 !== _b ? _b : 0) * h, x + (null !== (_c = color.x1) && void 0 !== _c ? _c : 1) * w, y + (null !== (_d = color.y1) && void 0 !== _d ? _d : 0) * h);
4413
- return color.stops.forEach(stop => {
4414
- canvasGradient.addColorStop(stop.offset, stop.color);
4415
- }), canvasGradient;
4416
- }
4417
- function createRadialGradient(context, color, x, y, w, h) {
4418
- var _a, _b, _c, _d, _e, _f;
4419
- const canvasGradient = context.createRadialGradient(x + (null !== (_a = color.x0) && void 0 !== _a ? _a : .5) * w, y + (null !== (_b = color.y0) && void 0 !== _b ? _b : .5) * h, Math.max(w, h) * (null !== (_c = color.r0) && void 0 !== _c ? _c : 0), x + (null !== (_d = color.x1) && void 0 !== _d ? _d : .5) * w, y + (null !== (_e = color.y1) && void 0 !== _e ? _e : .5) * h, Math.max(w, h) * (null !== (_f = color.r1) && void 0 !== _f ? _f : .5));
4420
- return color.stops.forEach(stop => {
4421
- canvasGradient.addColorStop(stop.offset, stop.color);
4422
- }), canvasGradient;
4423
- }
4424
- function createConicGradient(context, color, x, y, w, h) {
4425
- var _a, _b;
4426
- const canvasGradient = context.createConicGradient(x + (null !== (_a = color.x) && void 0 !== _a ? _a : 0) * w, y + (null !== (_b = color.y) && void 0 !== _b ? _b : 0) * h, color.startAngle, color.endAngle);
4427
- return color.stops.forEach(stop => {
4428
- canvasGradient.addColorStop(stop.offset, stop.color);
4429
- }), canvasGradient.GetPattern(w + x, h + y, undefined);
4430
- }
4431
-
4432
- const DIRECTION_KEY = {
4433
- horizontal: {
4434
- width: "width",
4435
- height: "height",
4436
- left: "left",
4437
- top: "top",
4438
- x: "x",
4439
- y: "y",
4440
- bottom: "bottom"
4441
- },
4442
- vertical: {
4443
- width: "height",
4444
- height: "width",
4445
- left: "top",
4446
- top: "left",
4447
- x: "y",
4448
- y: "x",
4449
- bottom: "right"
4450
- }
4451
- };
4452
- const defaultFormatting = {
4453
- fontSize: 16,
4454
- fontFamily: "sans-serif",
4455
- fill: !0,
4456
- stroke: !1,
4457
- fontWeight: "normal",
4458
- lineHeight: "normal",
4459
- fontStyle: "normal",
4460
- textDecoration: "none",
4461
- textAlign: "left",
4462
- script: "normal"
4463
- };
4464
- const regLetter = /\w|\(|\)|-/;
4465
- const regPunctuation = /[.?!,;:/,。?!、;:]/;
4466
- const regFirstSpace = /\S/;
4467
- const setTextStyle = (ctx, character) => {
4468
- let fontSize = character.fontSize || 16;
4469
- switch (character.script) {
4470
- case "super":
4471
- case "sub":
4472
- fontSize *= .8;
4473
- }
4474
- ctx.setTextStyle({
4475
- textAlign: "left",
4476
- textBaseline: character.textBaseline || "alphabetic",
4477
- fontStyle: character.fontStyle || "",
4478
- fontWeight: character.fontWeight || "",
4479
- fontSize: fontSize,
4480
- fontFamily: character.fontFamily || "sans-serif"
4481
- });
4482
- };
4483
- function applyFillStyle(ctx, character, b) {
4484
- const fillStyle = character && character.fill || defaultFormatting.fill;
4485
- if (!fillStyle) return void (ctx.globalAlpha = 0);
4486
- const {
4487
- fillOpacity = 1,
4488
- opacity = 1
4489
- } = character;
4490
- ctx.globalAlpha = fillOpacity * opacity, ctx.fillStyle = b ? createColor(ctx, fillStyle, {
4491
- AABBBounds: b
4492
- }) : fillStyle, setTextStyle(ctx, character);
4493
- }
4494
- function applyStrokeStyle(ctx, character) {
4495
- const strokeStyle = character && character.stroke || defaultFormatting.stroke;
4496
- if (!strokeStyle) return void (ctx.globalAlpha = 0);
4497
- const {
4498
- strokeOpacity = 1,
4499
- opacity = 1
4500
- } = character;
4501
- ctx.globalAlpha = strokeOpacity * opacity, ctx.lineWidth = character && "number" == typeof character.lineWidth ? character.lineWidth : 1, ctx.strokeStyle = strokeStyle, setTextStyle(ctx, character);
4502
- }
4503
- function getStrByWithCanvas(desc, width, character, guessIndex, needTestLetter) {
4504
- if (!width || width <= 0) return 0;
4505
- const textMeasure = application.graphicUtil.textMeasure;
4506
- let index = guessIndex,
4507
- temp = desc.slice(0, index),
4508
- tempWidth = Math.floor(textMeasure.measureText(temp, character).width),
4509
- tempNext = desc.slice(0, index + 1),
4510
- tempWidthNext = Math.floor(textMeasure.measureText(tempNext, character).width);
4511
- for (; tempWidth > width || tempWidthNext <= width;) {
4512
- if (tempWidth > width ? index-- : index++, index > desc.length) {
4513
- index = desc.length;
4514
- break;
4515
- }
4516
- if (index < 0) {
4517
- index = 0;
4518
- break;
4390
+ if (mode === MeasureModeEnum.estimate) return Object.assign(Object.assign({}, this.measureTextBoundADscentEstimate(options)), {
4391
+ width: out.width
4392
+ });
4393
+ if (mode === MeasureModeEnum.fontBounding) {
4394
+ let ascent = out.fontBoundingBoxAscent,
4395
+ descent = out.fontBoundingBoxDescent;
4396
+ if (out.actualBoundingBoxDescent && descent < out.actualBoundingBoxDescent) {
4397
+ const delta = out.actualBoundingBoxDescent - descent;
4398
+ descent += delta, ascent -= delta;
4399
+ } else if (out.actualBoundingBoxAscent && ascent < out.actualBoundingBoxAscent) {
4400
+ const delta = out.actualBoundingBoxAscent - ascent;
4401
+ ascent += delta, descent -= delta;
4402
+ }
4403
+ return {
4404
+ ascent: ascent,
4405
+ descent: descent,
4406
+ width: out.width
4407
+ };
4519
4408
  }
4520
- temp = desc.slice(0, index), tempWidth = Math.floor(textMeasure.measureText(temp, character).width), tempNext = desc.slice(0, index + 1), tempWidthNext = Math.floor(textMeasure.measureText(tempNext, character).width);
4521
- }
4522
- return needTestLetter && (index = testLetter(desc, index)), index;
4523
- }
4524
- function testLetter(string, index) {
4525
- let negativeWrongMatch = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
4526
- let i = index;
4527
- for (; regLetter.test(string[i - 1]) && regLetter.test(string[i]) || regPunctuation.test(string[i]);) if (i--, i <= 0) return negativeWrongMatch ? testLetter2(string, index) : index;
4528
- return i;
4529
- }
4530
- function testLetter2(string, index) {
4531
- let i = index;
4532
- for (; regLetter.test(string[i - 1]) && regLetter.test(string[i]) || regPunctuation.test(string[i]);) if (i++, i >= string.length) return i;
4533
- return i;
4534
- }
4535
- function measureTextCanvas(text, character) {
4536
- const measurement = application.graphicUtil.textMeasure.measureText(text, character),
4537
- result = {
4538
- ascent: 0,
4539
- height: 0,
4540
- descent: 0,
4541
- width: 0
4542
- };
4543
- return "number" != typeof measurement.actualBoundingBoxAscent || "number" != typeof measurement.actualBoundingBoxDescent ? (result.width = Math.floor(measurement.width), result.height = character.fontSize || 0, result.ascent = result.height, result.descent = 0) : (result.width = Math.floor(measurement.width), result.height = Math.floor(measurement.actualBoundingBoxAscent + measurement.actualBoundingBoxDescent), result.ascent = Math.floor(measurement.actualBoundingBoxAscent), result.descent = result.height - result.ascent), result;
4544
- }
4545
-
4546
- var __decorate$1G = undefined && undefined.__decorate || function (decorators, target, key, desc) {
4547
- var d,
4548
- c = arguments.length,
4549
- r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
4550
- if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) (d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
4551
- return c > 3 && r && Object.defineProperty(target, key, r), r;
4552
- };
4553
- let ATextMeasure = class {
4554
- configure(service, env) {
4555
- this.canvas = service.canvas, this.context = service.context, service.bindTextMeasure(this);
4556
- }
4557
- measureTextWidth(text, options) {
4558
- if (!this.context) return this.estimate(text, options).width;
4559
- this.context.setTextStyleWithoutAlignBaseline(options);
4560
- return this.context.measureText(text).width;
4561
- }
4562
- estimate(text, _ref) {
4563
- let {
4564
- fontSize = DefaultTextAttribute.fontSize
4565
- } = _ref;
4566
- let eCharLen = 0,
4567
- cCharLen = 0;
4568
- for (let i = 0; i < text.length; i++) text.charCodeAt(i) < 128 ? eCharLen++ : cCharLen++;
4569
4409
  return {
4570
- width: ~~(.8 * eCharLen * fontSize + cCharLen * fontSize),
4571
- height: fontSize
4410
+ ascent: out.actualBoundingBoxAscent,
4411
+ descent: out.actualBoundingBoxDescent,
4412
+ width: out.width
4572
4413
  };
4573
4414
  }
4574
- measureTextPixelHeight(text, options) {
4575
- var _a;
4576
- if (!this.context) return null !== (_a = options.fontSize) && void 0 !== _a ? _a : DefaultTextStyle.fontSize;
4577
- this.context.setTextStyleWithoutAlignBaseline(options);
4578
- const textMeasure = this.context.measureText(text);
4579
- return Math.abs(textMeasure.actualBoundingBoxAscent - textMeasure.actualBoundingBoxDescent);
4580
- }
4581
- measureTextBoundHieght(text, options) {
4582
- var _a;
4583
- if (!this.context) return null !== (_a = options.fontSize) && void 0 !== _a ? _a : DefaultTextStyle.fontSize;
4584
- this.context.setTextStyleWithoutAlignBaseline(options);
4585
- const textMeasure = this.context.measureText(text);
4586
- return Math.abs(textMeasure.fontBoundingBoxAscent - textMeasure.fontBoundingBoxDescent);
4587
- }
4588
4415
  measureText(text, options) {
4589
4416
  return this.context ? (this.context.setTextStyleWithoutAlignBaseline(options), this.context.measureText(text)) : this.estimate(text, options);
4590
4417
  }
@@ -6695,7 +6522,7 @@ class TimeOutTickHandler {
6695
6522
  }
6696
6523
  }
6697
6524
 
6698
- class DefaultTicker {
6525
+ class DefaultTicker extends EventEmitter {
6699
6526
  set mode(m) {
6700
6527
  this._mode !== m && (this._mode = m, this.setupTickHandler());
6701
6528
  }
@@ -6704,17 +6531,17 @@ class DefaultTicker {
6704
6531
  }
6705
6532
  constructor() {
6706
6533
  let timelines = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
6707
- this.handleTick = (handler, params) => {
6534
+ super(), this.handleTick = (handler, params) => {
6708
6535
  const {
6709
6536
  once = !1
6710
6537
  } = null != params ? params : {};
6711
- this.ifCanStop() ? this.stop() : (this._handlerTick(handler), once || handler.tick(this.interval, this.handleTick));
6712
- }, this._handlerTick = handler => {
6538
+ this.ifCanStop() ? this.stop() : (this._handlerTick(), once || handler.tick(this.interval, this.handleTick));
6539
+ }, this._handlerTick = () => {
6713
6540
  const time = this.tickerHandler.getTime();
6714
6541
  let delta = 0;
6715
6542
  this.lastFrameTime >= 0 && (delta = time - this.lastFrameTime), this.lastFrameTime = time, this.status === STATUS$1.RUNNING && (this.tickCounts++, this.timelines.forEach(t => {
6716
6543
  t.tick(delta);
6717
- }));
6544
+ }), this.emit("afterTick"));
6718
6545
  }, this.init(), this.lastFrameTime = -1, this.tickCounts = 0, this.timelines = timelines, this.autoStop = !0;
6719
6546
  }
6720
6547
  init() {
@@ -6810,6 +6637,9 @@ class DefaultTicker {
6810
6637
  stop() {
6811
6638
  this.status = STATUS$1.INITIAL, this.setupTickHandler(), this.lastFrameTime = -1;
6812
6639
  }
6640
+ trySyncTickStatus() {
6641
+ this.status === STATUS$1.RUNNING && this._handlerTick();
6642
+ }
6813
6643
  }
6814
6644
 
6815
6645
  class ManualTickHandler {
@@ -7951,7 +7781,7 @@ class TagPointsUpdate extends ACustomAnimate {
7951
7781
  lastMatchedIndex = i, lastMatchedPoint = tagMap.get(this.toPoints[i].context);
7952
7782
  break;
7953
7783
  }
7954
- "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);
7784
+ "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);
7955
7785
  let prevMatchedPoint = this.toPoints[0];
7956
7786
  this.interpolatePoints = this.toPoints.map((point, index) => {
7957
7787
  const matchedPoint = tagMap.get(point.context);
@@ -7963,11 +7793,19 @@ class TagPointsUpdate extends ACustomAnimate {
7963
7793
  return newPoint.defined = toPoint.defined, newPoint.context = toPoint.context, newPoint;
7964
7794
  });
7965
7795
  }
7796
+ onFirstRun() {
7797
+ const lastClipRange = this.target.attribute.clipRange;
7798
+ isValidNumber$1(lastClipRange * this.clipRange) && (this.clipRange *= lastClipRange);
7799
+ }
7966
7800
  onUpdate(end, ratio, out) {
7967
7801
  if (this.points = this.points.map((point, index) => {
7968
7802
  const newPoint = pointInterpolation(this.interpolatePoints[index][0], this.interpolatePoints[index][1], ratio);
7969
7803
  return newPoint.context = point.context, newPoint;
7970
- }), this.clipRange && (out.clipRange = this.clipRange + (1 - this.clipRange) * ratio), this.segmentsCache && this.to.segments) {
7804
+ }), this.clipRange) {
7805
+ 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));
7806
+ out.clipRange = this.clipRange + (1 - this.clipRange) * ratio;
7807
+ }
7808
+ if (this.segmentsCache && this.to.segments) {
7971
7809
  let start = 0;
7972
7810
  out.segments = this.to.segments.map((segment, index) => {
7973
7811
  const end = start + this.segmentsCache[index],
@@ -11546,266 +11384,555 @@ function getModelMatrix(out, graphic, theme) {
11546
11384
  translate(m, m, [_anchor[0], _anchor[1], 0]), rotateZ(m, m, angle), translate(m, m, [-_anchor[0], -_anchor[1], 0]), multiplyMat4Mat4(out, out, m);
11547
11385
  }
11548
11386
  }
11549
- function shouldUseMat4(graphic) {
11550
- const {
11551
- alpha: alpha,
11552
- beta: beta
11553
- } = graphic.attribute;
11554
- return alpha || beta;
11555
- }
11556
- let DefaultGraphicService = class {
11557
- constructor(creator) {
11558
- this.creator = creator, this.hooks = {
11559
- onAttributeUpdate: new SyncHook(["graphic"]),
11560
- onSetStage: new SyncHook(["graphic", "stage"]),
11561
- onRemove: new SyncHook(["graphic"]),
11562
- onRelease: new SyncHook(["graphic"]),
11563
- onAddIncremental: new SyncHook(["graphic", "group", "stage"]),
11564
- onClearIncremental: new SyncHook(["graphic", "group", "stage"]),
11565
- beforeUpdateAABBBounds: new SyncHook(["graphic", "stage", "willUpdate", "aabbBounds"]),
11566
- afterUpdateAABBBounds: new SyncHook(["graphic", "stage", "aabbBounds", "globalAABBBounds", "selfChange"])
11567
- }, this.tempAABBBounds1 = new AABBBounds(), this.tempAABBBounds2 = new AABBBounds();
11568
- }
11569
- onAttributeUpdate(graphic) {
11570
- this.hooks.onAttributeUpdate.taps.length && this.hooks.onAttributeUpdate.call(graphic);
11387
+ function shouldUseMat4(graphic) {
11388
+ const {
11389
+ alpha: alpha,
11390
+ beta: beta
11391
+ } = graphic.attribute;
11392
+ return alpha || beta;
11393
+ }
11394
+ let DefaultGraphicService = class {
11395
+ constructor(creator) {
11396
+ this.creator = creator, this.hooks = {
11397
+ onAttributeUpdate: new SyncHook(["graphic"]),
11398
+ onSetStage: new SyncHook(["graphic", "stage"]),
11399
+ onRemove: new SyncHook(["graphic"]),
11400
+ onRelease: new SyncHook(["graphic"]),
11401
+ onAddIncremental: new SyncHook(["graphic", "group", "stage"]),
11402
+ onClearIncremental: new SyncHook(["graphic", "group", "stage"]),
11403
+ beforeUpdateAABBBounds: new SyncHook(["graphic", "stage", "willUpdate", "aabbBounds"]),
11404
+ afterUpdateAABBBounds: new SyncHook(["graphic", "stage", "aabbBounds", "globalAABBBounds", "selfChange"]),
11405
+ clearAABBBounds: new SyncHook(["graphic", "stage", "aabbBounds"])
11406
+ }, this.tempAABBBounds1 = new AABBBounds(), this.tempAABBBounds2 = new AABBBounds();
11407
+ }
11408
+ onAttributeUpdate(graphic) {
11409
+ this.hooks.onAttributeUpdate.taps.length && this.hooks.onAttributeUpdate.call(graphic);
11410
+ }
11411
+ onSetStage(graphic, stage) {
11412
+ this.hooks.onSetStage.taps.length && this.hooks.onSetStage.call(graphic, stage);
11413
+ }
11414
+ onRemove(graphic) {
11415
+ this.hooks.onRemove.taps.length && this.hooks.onRemove.call(graphic);
11416
+ }
11417
+ onRelease(graphic) {
11418
+ this.hooks.onRelease.taps.length && this.hooks.onRelease.call(graphic);
11419
+ }
11420
+ onAddIncremental(graphic, group, stage) {
11421
+ this.hooks.onAddIncremental.taps.length && this.hooks.onAddIncremental.call(graphic, group, stage);
11422
+ }
11423
+ onClearIncremental(group, stage) {
11424
+ this.hooks.onClearIncremental.taps.length && this.hooks.onClearIncremental.call(group, stage);
11425
+ }
11426
+ beforeUpdateAABBBounds(graphic, stage, willUpdate, bounds) {
11427
+ this.hooks.beforeUpdateAABBBounds.taps.length && this.hooks.beforeUpdateAABBBounds.call(graphic, stage, willUpdate, bounds);
11428
+ }
11429
+ afterUpdateAABBBounds(graphic, stage, bounds, params, selfChange) {
11430
+ this.hooks.afterUpdateAABBBounds.taps.length && this.hooks.afterUpdateAABBBounds.call(graphic, stage, bounds, params, selfChange);
11431
+ }
11432
+ clearAABBBounds(graphic, stage, b) {
11433
+ this.hooks.clearAABBBounds.taps.length && this.hooks.clearAABBBounds.call(graphic, stage, b);
11434
+ }
11435
+ updatePathProxyAABBBounds(aabbBounds, graphic) {
11436
+ const path = "function" == typeof graphic.pathProxy ? graphic.pathProxy(graphic.attribute) : graphic.pathProxy;
11437
+ if (!path) return !1;
11438
+ const boundsContext = new BoundsContext(aabbBounds);
11439
+ return renderCommandList(path.commandList, boundsContext, 0, 0), !0;
11440
+ }
11441
+ updateHTMLTextAABBBounds(attribute, textTheme, aabbBounds, graphic) {
11442
+ const {
11443
+ textAlign: textAlign,
11444
+ textBaseline: textBaseline
11445
+ } = attribute;
11446
+ if (null != attribute.forceBoundsHeight) {
11447
+ const h = isNumber$1(attribute.forceBoundsHeight) ? attribute.forceBoundsHeight : attribute.forceBoundsHeight(),
11448
+ dy = textLayoutOffsetY(textBaseline, h, h);
11449
+ aabbBounds.set(aabbBounds.x1, dy, aabbBounds.x2, dy + h);
11450
+ }
11451
+ if (null != attribute.forceBoundsWidth) {
11452
+ const w = isNumber$1(attribute.forceBoundsWidth) ? attribute.forceBoundsWidth : attribute.forceBoundsWidth(),
11453
+ dx = textDrawOffsetX(textAlign, w);
11454
+ aabbBounds.set(dx, aabbBounds.y1, dx + w, aabbBounds.y2);
11455
+ }
11456
+ }
11457
+ combindShadowAABBBounds(bounds, graphic) {
11458
+ if (graphic && graphic.shadowRoot) {
11459
+ const b = graphic.shadowRoot.AABBBounds;
11460
+ bounds.union(b);
11461
+ }
11462
+ }
11463
+ transformAABBBounds(attribute, aabbBounds, theme, miter, graphic) {
11464
+ if (!aabbBounds.empty()) {
11465
+ const {
11466
+ scaleX = theme.scaleX,
11467
+ scaleY = theme.scaleY,
11468
+ stroke = theme.stroke,
11469
+ shadowBlur = theme.shadowBlur,
11470
+ lineWidth = theme.lineWidth,
11471
+ pickStrokeBuffer = theme.pickStrokeBuffer,
11472
+ strokeBoundsBuffer = theme.strokeBoundsBuffer
11473
+ } = attribute,
11474
+ tb1 = this.tempAABBBounds1,
11475
+ tb2 = this.tempAABBBounds2;
11476
+ if (stroke && lineWidth) {
11477
+ const scaledHalfLineWidth = (lineWidth + pickStrokeBuffer) / Math.abs(scaleX + scaleY);
11478
+ boundStroke(tb1, scaledHalfLineWidth, miter, strokeBoundsBuffer), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2);
11479
+ }
11480
+ if (shadowBlur) {
11481
+ const {
11482
+ shadowOffsetX = theme.shadowOffsetX,
11483
+ shadowOffsetY = theme.shadowOffsetY
11484
+ } = attribute,
11485
+ shadowBlurWidth = shadowBlur / Math.abs(scaleX + scaleY) * 2;
11486
+ boundStroke(tb1, shadowBlurWidth, !1, strokeBoundsBuffer + 1), tb1.translate(shadowOffsetX, shadowOffsetY), aabbBounds.union(tb1);
11487
+ }
11488
+ }
11489
+ if (this.combindShadowAABBBounds(aabbBounds, graphic), aabbBounds.empty()) return;
11490
+ let updateMatrix = !0;
11491
+ const m = graphic.transMatrix;
11492
+ graphic && graphic.isContainer && (updateMatrix = !(1 === m.a && 0 === m.b && 0 === m.c && 1 === m.d && 0 === m.e && 0 === m.f)), updateMatrix && transformBoundsWithMatrix(aabbBounds, aabbBounds, m);
11493
+ }
11494
+ validCheck(attribute, theme, aabbBounds, graphic) {
11495
+ if (!graphic) return !0;
11496
+ if (null != attribute.forceBoundsHeight || null != attribute.forceBoundsWidth) return !0;
11497
+ if (graphic.shadowRoot || graphic.isContainer) return !0;
11498
+ const {
11499
+ visible = theme.visible
11500
+ } = attribute;
11501
+ return !(!graphic.valid || !visible) || (aabbBounds.empty() || (graphic.parent && aabbBounds.transformWithMatrix(graphic.parent.globalTransMatrix), application.graphicService.clearAABBBounds(graphic, graphic.stage, aabbBounds), aabbBounds.clear()), !1);
11502
+ }
11503
+ updateTempAABBBounds(aabbBounds) {
11504
+ const tb1 = this.tempAABBBounds1,
11505
+ tb2 = this.tempAABBBounds2;
11506
+ return tb1.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), tb2.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), {
11507
+ tb1: tb1,
11508
+ tb2: tb2
11509
+ };
11510
+ }
11511
+ };
11512
+ DefaultGraphicService = __decorate$1B([injectable(), __param$R(0, inject(GraphicCreator$1)), __metadata$1d("design:paramtypes", [Object])], DefaultGraphicService);
11513
+
11514
+ const result = {
11515
+ x: 0,
11516
+ y: 0,
11517
+ z: 0,
11518
+ lastModelMatrix: null
11519
+ };
11520
+ class BaseRender {
11521
+ init(contributions) {
11522
+ contributions && (this._renderContribitions = contributions.getContributions()), this._renderContribitions || (this._renderContribitions = []), this.builtinContributions && this.builtinContributions.forEach(item => this._renderContribitions.push(item)), this._renderContribitions.length && (this._renderContribitions.sort((a, b) => b.order - a.order), this._beforeRenderContribitions = this._renderContribitions.filter(c => c.time === BaseRenderContributionTime.beforeFillStroke), this._afterRenderContribitions = this._renderContribitions.filter(c => c.time === BaseRenderContributionTime.afterFillStroke));
11523
+ }
11524
+ beforeRenderStep(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, params) {
11525
+ this._beforeRenderContribitions && this._beforeRenderContribitions.forEach(c => {
11526
+ if (c.supportedAppName && graphic.stage && graphic.stage.params && graphic.stage.params.context && graphic.stage.params.context.appName) {
11527
+ if (!(Array.isArray(c.supportedAppName) ? c.supportedAppName : [c.supportedAppName]).includes(graphic.stage.params.context.appName)) return;
11528
+ }
11529
+ c.drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, params);
11530
+ });
11531
+ }
11532
+ afterRenderStep(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, params) {
11533
+ this._afterRenderContribitions && this._afterRenderContribitions.forEach(c => {
11534
+ if (c.supportedAppName && graphic.stage && graphic.stage.params && graphic.stage.params.context && graphic.stage.params.context.appName) {
11535
+ if (!(Array.isArray(c.supportedAppName) ? c.supportedAppName : [c.supportedAppName]).includes(graphic.stage.params.context.appName)) return;
11536
+ }
11537
+ c.drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, params);
11538
+ });
11539
+ }
11540
+ valid(graphic, defaultAttribute, fillCb, strokeCb) {
11541
+ const {
11542
+ fill = defaultAttribute.fill,
11543
+ background: background,
11544
+ stroke = defaultAttribute.stroke,
11545
+ opacity = defaultAttribute.opacity,
11546
+ fillOpacity = defaultAttribute.fillOpacity,
11547
+ lineWidth = defaultAttribute.lineWidth,
11548
+ strokeOpacity = defaultAttribute.strokeOpacity,
11549
+ visible = defaultAttribute.visible
11550
+ } = graphic.attribute,
11551
+ fVisible = fillVisible(opacity, fillOpacity, fill),
11552
+ sVisible = strokeVisible(opacity, strokeOpacity),
11553
+ doFill = runFill(fill, background),
11554
+ doStroke = runStroke(stroke, lineWidth);
11555
+ return !(!graphic.valid || !visible) && !(!doFill && !doStroke) && !!(fVisible || sVisible || fillCb || strokeCb || background) && {
11556
+ fVisible: fVisible,
11557
+ sVisible: sVisible,
11558
+ doFill: doFill,
11559
+ doStroke: doStroke
11560
+ };
11561
+ }
11562
+ transform(graphic, graphicAttribute, context) {
11563
+ let use3dMatrixIn3dMode = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
11564
+ const {
11565
+ x = graphicAttribute.x,
11566
+ y = graphicAttribute.y,
11567
+ z = graphicAttribute.z,
11568
+ scaleX = graphicAttribute.scaleX,
11569
+ scaleY = graphicAttribute.scaleY,
11570
+ angle = graphicAttribute.angle,
11571
+ postMatrix: postMatrix
11572
+ } = graphic.attribute,
11573
+ lastModelMatrix = context.modelMatrix,
11574
+ camera = context.camera;
11575
+ result.x = x, result.y = y, result.z = z, result.lastModelMatrix = lastModelMatrix;
11576
+ const shouldTransform3d = camera && (use3dMatrixIn3dMode || shouldUseMat4(graphic)),
11577
+ onlyTranslate = shouldTransform3d ? graphic.transMatrix.onlyTranslate() && !postMatrix : 1 === scaleX && 1 === scaleY && 0 === angle && !postMatrix;
11578
+ if (shouldTransform3d) {
11579
+ const nextModelMatrix = mat4Allocate.allocate(),
11580
+ modelMatrix = mat4Allocate.allocate();
11581
+ getModelMatrix(modelMatrix, graphic, graphicAttribute), multiplyMat4Mat4(nextModelMatrix, lastModelMatrix || nextModelMatrix, modelMatrix), result.x = 0, result.y = 0, result.z = 0, context.modelMatrix = nextModelMatrix, context.setTransform(1, 0, 0, 1, 0, 0, !0), mat4Allocate.free(modelMatrix);
11582
+ }
11583
+ if (onlyTranslate && !lastModelMatrix) {
11584
+ const point = graphic.getOffsetXY(graphicAttribute);
11585
+ result.x += point.x, result.y += point.y, result.z = z, context.setTransformForCurrent();
11586
+ } else if (shouldTransform3d) result.x = 0, result.y = 0, result.z = 0, context.setTransform(1, 0, 0, 1, 0, 0, !0);else if (camera && context.project) {
11587
+ const point = graphic.getOffsetXY(graphicAttribute);
11588
+ result.x += point.x, result.y += point.y, this.transformWithoutTranslate(context, result.x, result.y, result.z, scaleX, scaleY, angle);
11589
+ } else context.transformFromMatrix(graphic.transMatrix, !0), result.x = 0, result.y = 0, result.z = 0;
11590
+ return result;
11591
+ }
11592
+ transformUseContext2d(graphic, graphicAttribute, z, context) {
11593
+ const camera = context.camera;
11594
+ if (this.camera = camera, camera) {
11595
+ const bounds = graphic.AABBBounds,
11596
+ width = bounds.x2 - bounds.x1,
11597
+ height = bounds.y2 - bounds.y1,
11598
+ p1 = context.project(0, 0, z),
11599
+ p2 = context.project(width, 0, z),
11600
+ p3 = context.project(width, height, z),
11601
+ _p1 = {
11602
+ x: 0,
11603
+ y: 0
11604
+ },
11605
+ _p2 = {
11606
+ x: width,
11607
+ y: 0
11608
+ },
11609
+ _p3 = {
11610
+ x: width,
11611
+ y: height
11612
+ };
11613
+ context.camera = null;
11614
+ const denom = 1 / (_p1.x * (_p3.y - _p2.y) - _p2.x * _p3.y + _p3.x * _p2.y + (_p2.x - _p3.x) * _p1.y),
11615
+ m11 = -(_p1.y * (p3.x - p2.x) - _p2.y * p3.x + _p3.y * p2.x + (_p2.y - _p3.y) * p1.x) * denom,
11616
+ m12 = (_p2.y * p3.y + _p1.y * (p2.y - p3.y) - _p3.y * p2.y + (_p3.y - _p2.y) * p1.y) * denom,
11617
+ m21 = (_p1.x * (p3.x - p2.x) - _p2.x * p3.x + _p3.x * p2.x + (_p2.x - _p3.x) * p1.x) * denom,
11618
+ m22 = -(_p2.x * p3.y + _p1.x * (p2.y - p3.y) - _p3.x * p2.y + (_p3.x - _p2.x) * p1.y) * denom,
11619
+ dx = (_p1.x * (_p3.y * p2.x - _p2.y * p3.x) + _p1.y * (_p2.x * p3.x - _p3.x * p2.x) + (_p3.x * _p2.y - _p2.x * _p3.y) * p1.x) * denom,
11620
+ dy = (_p1.x * (_p3.y * p2.y - _p2.y * p3.y) + _p1.y * (_p2.x * p3.y - _p3.x * p2.y) + (_p3.x * _p2.y - _p2.x * _p3.y) * p1.y) * denom;
11621
+ context.setTransform(m11, m12, m21, m22, dx, dy, !0);
11622
+ }
11623
+ }
11624
+ restoreTransformUseContext2d(graphic, graphicAttribute, z, context) {
11625
+ this.camera && (context.camera = this.camera);
11626
+ }
11627
+ transformWithoutTranslate(context, x, y, z, scaleX, scaleY, angle) {
11628
+ const p = context.project(x, y, z);
11629
+ context.translate(p.x, p.y, !1), context.scale(scaleX, scaleY, !1), context.rotate(angle, !1), context.translate(-p.x, -p.y, !1), context.setTransformForCurrent();
11630
+ }
11631
+ _draw(graphic, defaultAttr, computed3dMatrix, drawContext, params) {
11632
+ const {
11633
+ context: context
11634
+ } = drawContext;
11635
+ if (!context) return;
11636
+ const {
11637
+ renderable: renderable
11638
+ } = graphic.attribute;
11639
+ if (!1 === renderable) return;
11640
+ context.highPerformanceSave();
11641
+ const data = this.transform(graphic, defaultAttr, context, computed3dMatrix),
11642
+ {
11643
+ x: x,
11644
+ y: y,
11645
+ z: z,
11646
+ lastModelMatrix: lastModelMatrix
11647
+ } = data;
11648
+ this.z = z, drawPathProxy(graphic, context, x, y, drawContext, params) || (this.drawShape(graphic, context, x, y, drawContext, params), this.z = 0, context.modelMatrix !== lastModelMatrix && mat4Allocate.free(context.modelMatrix), context.modelMatrix = lastModelMatrix), context.highPerformanceRestore();
11649
+ }
11650
+ }
11651
+
11652
+ const parse = function () {
11653
+ const tokens = {
11654
+ linearGradient: /^(linear\-gradient)/i,
11655
+ radialGradient: /^(radial\-gradient)/i,
11656
+ conicGradient: /^(conic\-gradient)/i,
11657
+ sideOrCorner: /^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,
11658
+ extentKeywords: /^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,
11659
+ positionKeywords: /^(left|center|right|top|bottom)/i,
11660
+ pixelValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,
11661
+ percentageValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,
11662
+ emValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,
11663
+ angleValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,
11664
+ fromAngleValue: /^from\s*(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,
11665
+ startCall: /^\(/,
11666
+ endCall: /^\)/,
11667
+ comma: /^,/,
11668
+ hexColor: /(^\#[0-9a-fA-F]+)/,
11669
+ literalColor: /^([a-zA-Z]+)/,
11670
+ rgbColor: /^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,
11671
+ rgbaColor: /^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i,
11672
+ number: /^(([0-9]*\.[0-9]+)|([0-9]+\.?))/
11673
+ };
11674
+ let input = "";
11675
+ function error(msg) {
11676
+ const err = new Error(input + ": " + msg);
11677
+ throw err.source = input, err;
11571
11678
  }
11572
- onSetStage(graphic, stage) {
11573
- this.hooks.onSetStage.taps.length && this.hooks.onSetStage.call(graphic, stage);
11679
+ function getAST() {
11680
+ const ast = matchListing(matchDefinition);
11681
+ return input.length > 0 && error("Invalid input not EOF"), ast;
11574
11682
  }
11575
- onRemove(graphic) {
11576
- this.hooks.onRemove.taps.length && this.hooks.onRemove.call(graphic);
11683
+ function matchDefinition() {
11684
+ return matchGradient("linear", tokens.linearGradient, matchLinearOrientation) || matchGradient("radial", tokens.radialGradient, matchListRadialOrientations) || matchGradient("conic", tokens.conicGradient, matchConicalOrientation);
11577
11685
  }
11578
- onRelease(graphic) {
11579
- this.hooks.onRelease.taps.length && this.hooks.onRelease.call(graphic);
11686
+ function matchGradient(gradientType, pattern, orientationMatcher) {
11687
+ return function (pattern, callback) {
11688
+ const captures = scan(pattern);
11689
+ if (captures) {
11690
+ scan(tokens.startCall) || error("Missing (");
11691
+ const result = callback(captures);
11692
+ return scan(tokens.endCall) || error("Missing )"), result;
11693
+ }
11694
+ }(pattern, function (captures) {
11695
+ const orientation = orientationMatcher();
11696
+ return orientation && (scan(tokens.comma) || error("Missing comma before color stops")), {
11697
+ type: gradientType,
11698
+ orientation: orientation,
11699
+ colorStops: matchListing(matchColorStop)
11700
+ };
11701
+ });
11580
11702
  }
11581
- onAddIncremental(graphic, group, stage) {
11582
- this.hooks.onAddIncremental.taps.length && this.hooks.onAddIncremental.call(graphic, group, stage);
11703
+ function matchLinearOrientation() {
11704
+ return match("directional", tokens.sideOrCorner, 1) || match("angular", tokens.angleValue, 1);
11583
11705
  }
11584
- onClearIncremental(group, stage) {
11585
- this.hooks.onClearIncremental.taps.length && this.hooks.onClearIncremental.call(group, stage);
11706
+ function matchConicalOrientation() {
11707
+ return match("angular", tokens.fromAngleValue, 1);
11586
11708
  }
11587
- beforeUpdateAABBBounds(graphic, stage, willUpdate, bounds) {
11588
- this.hooks.beforeUpdateAABBBounds.taps.length && this.hooks.beforeUpdateAABBBounds.call(graphic, stage, willUpdate, bounds);
11709
+ function matchListRadialOrientations() {
11710
+ let radialOrientations,
11711
+ lookaheadCache,
11712
+ radialOrientation = matchRadialOrientation();
11713
+ return radialOrientation && (radialOrientations = [], radialOrientations.push(radialOrientation), lookaheadCache = input, scan(tokens.comma) && (radialOrientation = matchRadialOrientation(), radialOrientation ? radialOrientations.push(radialOrientation) : input = lookaheadCache)), radialOrientations;
11589
11714
  }
11590
- afterUpdateAABBBounds(graphic, stage, bounds, params, selfChange) {
11591
- this.hooks.afterUpdateAABBBounds.taps.length && this.hooks.afterUpdateAABBBounds.call(graphic, stage, bounds, params, selfChange);
11715
+ function matchRadialOrientation() {
11716
+ let radialType = function () {
11717
+ const circle = match("shape", /^(circle)/i, 0);
11718
+ circle && (circle.style = matchLength() || matchExtentKeyword());
11719
+ return circle;
11720
+ }() || function () {
11721
+ const ellipse = match("shape", /^(ellipse)/i, 0);
11722
+ ellipse && (ellipse.style = matchDistance() || matchExtentKeyword());
11723
+ return ellipse;
11724
+ }();
11725
+ if (radialType) radialType.at = matchAtPosition();else {
11726
+ const extent = matchExtentKeyword();
11727
+ if (extent) {
11728
+ radialType = extent;
11729
+ const positionAt = matchAtPosition();
11730
+ positionAt && (radialType.at = positionAt);
11731
+ } else {
11732
+ const defaultPosition = matchPositioning();
11733
+ defaultPosition && (radialType = {
11734
+ type: "default-radial",
11735
+ at: defaultPosition
11736
+ });
11737
+ }
11738
+ }
11739
+ return radialType;
11592
11740
  }
11593
- updatePathProxyAABBBounds(aabbBounds, graphic) {
11594
- const path = "function" == typeof graphic.pathProxy ? graphic.pathProxy(graphic.attribute) : graphic.pathProxy;
11595
- if (!path) return !1;
11596
- const boundsContext = new BoundsContext(aabbBounds);
11597
- return renderCommandList(path.commandList, boundsContext, 0, 0), !0;
11741
+ function matchExtentKeyword() {
11742
+ return match("extent-keyword", tokens.extentKeywords, 1);
11598
11743
  }
11599
- updateHTMLTextAABBBounds(attribute, textTheme, aabbBounds, graphic) {
11600
- const {
11601
- textAlign: textAlign,
11602
- textBaseline: textBaseline
11603
- } = attribute;
11604
- if (null != attribute.forceBoundsHeight) {
11605
- const h = isNumber$1(attribute.forceBoundsHeight) ? attribute.forceBoundsHeight : attribute.forceBoundsHeight(),
11606
- dy = textLayoutOffsetY(textBaseline, h, h);
11607
- aabbBounds.set(aabbBounds.x1, dy, aabbBounds.x2, dy + h);
11608
- }
11609
- if (null != attribute.forceBoundsWidth) {
11610
- const w = isNumber$1(attribute.forceBoundsWidth) ? attribute.forceBoundsWidth : attribute.forceBoundsWidth(),
11611
- dx = textDrawOffsetX(textAlign, w);
11612
- aabbBounds.set(dx, aabbBounds.y1, dx + w, aabbBounds.y2);
11744
+ function matchAtPosition() {
11745
+ if (match("position", /^at/, 0)) {
11746
+ const positioning = matchPositioning();
11747
+ return positioning || error("Missing positioning value"), positioning;
11613
11748
  }
11614
11749
  }
11615
- combindShadowAABBBounds(bounds, graphic) {
11616
- if (graphic && graphic.shadowRoot) {
11617
- const b = graphic.shadowRoot.AABBBounds;
11618
- bounds.union(b);
11619
- }
11750
+ function matchPositioning() {
11751
+ const location = {
11752
+ x: matchDistance(),
11753
+ y: matchDistance()
11754
+ };
11755
+ if (location.x || location.y) return {
11756
+ type: "position",
11757
+ value: location
11758
+ };
11620
11759
  }
11621
- transformAABBBounds(attribute, aabbBounds, theme, miter, graphic) {
11622
- if (!aabbBounds.empty()) {
11623
- const {
11624
- scaleX = theme.scaleX,
11625
- scaleY = theme.scaleY,
11626
- stroke = theme.stroke,
11627
- shadowBlur = theme.shadowBlur,
11628
- lineWidth = theme.lineWidth,
11629
- pickStrokeBuffer = theme.pickStrokeBuffer,
11630
- strokeBoundsBuffer = theme.strokeBoundsBuffer
11631
- } = attribute,
11632
- tb1 = this.tempAABBBounds1,
11633
- tb2 = this.tempAABBBounds2;
11634
- if (stroke && lineWidth) {
11635
- const scaledHalfLineWidth = (lineWidth + pickStrokeBuffer) / Math.abs(scaleX + scaleY);
11636
- boundStroke(tb1, scaledHalfLineWidth, miter, strokeBoundsBuffer), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2);
11637
- }
11638
- if (shadowBlur) {
11639
- const {
11640
- shadowOffsetX = theme.shadowOffsetX,
11641
- shadowOffsetY = theme.shadowOffsetY
11642
- } = attribute,
11643
- shadowBlurWidth = shadowBlur / Math.abs(scaleX + scaleY) * 2;
11644
- boundStroke(tb1, shadowBlurWidth, !1, strokeBoundsBuffer + 1), tb1.translate(shadowOffsetX, shadowOffsetY), aabbBounds.union(tb1);
11645
- }
11646
- }
11647
- if (this.combindShadowAABBBounds(aabbBounds, graphic), aabbBounds.empty()) return;
11648
- let updateMatrix = !0;
11649
- const m = graphic.transMatrix;
11650
- graphic && graphic.isContainer && (updateMatrix = !(1 === m.a && 0 === m.b && 0 === m.c && 1 === m.d && 0 === m.e && 0 === m.f)), updateMatrix && transformBoundsWithMatrix(aabbBounds, aabbBounds, m);
11760
+ function matchListing(matcher) {
11761
+ let captures = matcher();
11762
+ const result = [];
11763
+ if (captures) for (result.push(captures); scan(tokens.comma);) captures = matcher(), captures ? result.push(captures) : error("One extra comma");
11764
+ return result;
11651
11765
  }
11652
- validCheck(attribute, theme, aabbBounds, graphic) {
11653
- if (!graphic) return !0;
11654
- if (null != attribute.forceBoundsHeight || null != attribute.forceBoundsWidth) return !0;
11655
- if (graphic.shadowRoot) return !0;
11656
- if (!graphic.valid) return aabbBounds.clear(), !1;
11657
- const {
11658
- visible = theme.visible
11659
- } = attribute;
11660
- return !!visible || (aabbBounds.clear(), !1);
11766
+ function matchColorStop() {
11767
+ const color = match("hex", tokens.hexColor, 1) || match("rgba", tokens.rgbaColor, 1) || match("rgb", tokens.rgbColor, 1) || match("literal", tokens.literalColor, 0);
11768
+ return color || error("Expected color definition"), color.length = matchDistance(), color;
11661
11769
  }
11662
- updateTempAABBBounds(aabbBounds) {
11663
- const tb1 = this.tempAABBBounds1,
11664
- tb2 = this.tempAABBBounds2;
11665
- return tb1.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), tb2.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), {
11666
- tb1: tb1,
11667
- tb2: tb2
11770
+ function matchDistance() {
11771
+ return match("%", tokens.percentageValue, 1) || match("position-keyword", tokens.positionKeywords, 1) || matchLength();
11772
+ }
11773
+ function matchLength() {
11774
+ return match("px", tokens.pixelValue, 1) || match("em", tokens.emValue, 1);
11775
+ }
11776
+ function match(type, pattern, captureIndex) {
11777
+ const captures = scan(pattern);
11778
+ if (captures) return {
11779
+ type: type,
11780
+ value: captures[captureIndex]
11668
11781
  };
11669
11782
  }
11670
- };
11671
- DefaultGraphicService = __decorate$1B([injectable(), __param$R(0, inject(GraphicCreator$1)), __metadata$1d("design:paramtypes", [Object])], DefaultGraphicService);
11672
-
11673
- const result = {
11674
- x: 0,
11675
- y: 0,
11676
- z: 0,
11677
- lastModelMatrix: null
11678
- };
11679
- class BaseRender {
11680
- init(contributions) {
11681
- contributions && (this._renderContribitions = contributions.getContributions()), this._renderContribitions || (this._renderContribitions = []), this.builtinContributions && this.builtinContributions.forEach(item => this._renderContribitions.push(item)), this._renderContribitions.length && (this._renderContribitions.sort((a, b) => b.order - a.order), this._beforeRenderContribitions = this._renderContribitions.filter(c => c.time === BaseRenderContributionTime.beforeFillStroke), this._afterRenderContribitions = this._renderContribitions.filter(c => c.time === BaseRenderContributionTime.afterFillStroke));
11783
+ function scan(regexp) {
11784
+ const blankCaptures = /^[\n\r\t\s]+/.exec(input);
11785
+ blankCaptures && consume(blankCaptures[0].length);
11786
+ const captures = regexp.exec(input);
11787
+ return captures && consume(captures[0].length), captures;
11682
11788
  }
11683
- beforeRenderStep(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, params) {
11684
- this._beforeRenderContribitions && this._beforeRenderContribitions.forEach(c => {
11685
- if (c.supportedAppName && graphic.stage && graphic.stage.params && graphic.stage.params.context && graphic.stage.params.context.appName) {
11686
- if (!(Array.isArray(c.supportedAppName) ? c.supportedAppName : [c.supportedAppName]).includes(graphic.stage.params.context.appName)) return;
11687
- }
11688
- c.drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, params);
11689
- });
11789
+ function consume(size) {
11790
+ input = input.substr(size);
11791
+ }
11792
+ return function (code) {
11793
+ return input = code.toString(), getAST();
11794
+ };
11795
+ }();
11796
+ class GradientParser {
11797
+ static IsGradient(c) {
11798
+ return !("string" == typeof c && !c.includes("gradient"));
11799
+ }
11800
+ static IsGradientStr(c) {
11801
+ return "string" == typeof c && c.includes("gradient");
11690
11802
  }
11691
- afterRenderStep(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, params) {
11692
- this._afterRenderContribitions && this._afterRenderContribitions.forEach(c => {
11693
- if (c.supportedAppName && graphic.stage && graphic.stage.params && graphic.stage.params.context && graphic.stage.params.context.appName) {
11694
- if (!(Array.isArray(c.supportedAppName) ? c.supportedAppName : [c.supportedAppName]).includes(graphic.stage.params.context.appName)) return;
11803
+ static Parse(c) {
11804
+ if (GradientParser.IsGradientStr(c)) try {
11805
+ const datum = parse(c)[0];
11806
+ if (datum) {
11807
+ if ("linear" === datum.type) return GradientParser.ParseLinear(datum);
11808
+ if ("radial" === datum.type) return GradientParser.ParseRadial(datum);
11809
+ if ("conic" === datum.type) return GradientParser.ParseConic(datum);
11695
11810
  }
11696
- c.drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, params);
11697
- });
11811
+ } catch (err) {
11812
+ return c;
11813
+ }
11814
+ return c;
11698
11815
  }
11699
- valid(graphic, defaultAttribute, fillCb, strokeCb) {
11816
+ static ParseConic(datum) {
11700
11817
  const {
11701
- fill = defaultAttribute.fill,
11702
- background: background,
11703
- stroke = defaultAttribute.stroke,
11704
- opacity = defaultAttribute.opacity,
11705
- fillOpacity = defaultAttribute.fillOpacity,
11706
- lineWidth = defaultAttribute.lineWidth,
11707
- strokeOpacity = defaultAttribute.strokeOpacity,
11708
- visible = defaultAttribute.visible
11709
- } = graphic.attribute,
11710
- fVisible = fillVisible(opacity, fillOpacity, fill),
11711
- sVisible = strokeVisible(opacity, strokeOpacity),
11712
- doFill = runFill(fill, background),
11713
- doStroke = runStroke(stroke, lineWidth);
11714
- return !(!graphic.valid || !visible) && !(!doFill && !doStroke) && !!(fVisible || sVisible || fillCb || strokeCb || background) && {
11715
- fVisible: fVisible,
11716
- sVisible: sVisible,
11717
- doFill: doFill,
11718
- doStroke: doStroke
11818
+ orientation: orientation,
11819
+ colorStops = []
11820
+ } = datum,
11821
+ halfPi = pi / 2,
11822
+ sa = parseFloat(orientation.value) / 180 * pi - halfPi;
11823
+ return {
11824
+ gradient: "conical",
11825
+ x: .5,
11826
+ y: .5,
11827
+ startAngle: sa,
11828
+ endAngle: sa + pi2,
11829
+ stops: colorStops.map(item => ({
11830
+ color: item.value,
11831
+ offset: parseFloat(item.length.value) / 100
11832
+ }))
11719
11833
  };
11720
11834
  }
11721
- transform(graphic, graphicAttribute, context) {
11722
- let use3dMatrixIn3dMode = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
11835
+ static ParseRadial(datum) {
11723
11836
  const {
11724
- x = graphicAttribute.x,
11725
- y = graphicAttribute.y,
11726
- z = graphicAttribute.z,
11727
- scaleX = graphicAttribute.scaleX,
11728
- scaleY = graphicAttribute.scaleY,
11729
- angle = graphicAttribute.angle,
11730
- postMatrix: postMatrix
11731
- } = graphic.attribute,
11732
- lastModelMatrix = context.modelMatrix,
11733
- camera = context.camera;
11734
- result.x = x, result.y = y, result.z = z, result.lastModelMatrix = lastModelMatrix;
11735
- const shouldTransform3d = camera && (use3dMatrixIn3dMode || shouldUseMat4(graphic)),
11736
- onlyTranslate = shouldTransform3d ? graphic.transMatrix.onlyTranslate() && !postMatrix : 1 === scaleX && 1 === scaleY && 0 === angle && !postMatrix;
11737
- if (shouldTransform3d) {
11738
- const nextModelMatrix = mat4Allocate.allocate(),
11739
- modelMatrix = mat4Allocate.allocate();
11740
- getModelMatrix(modelMatrix, graphic, graphicAttribute), multiplyMat4Mat4(nextModelMatrix, lastModelMatrix || nextModelMatrix, modelMatrix), result.x = 0, result.y = 0, result.z = 0, context.modelMatrix = nextModelMatrix, context.setTransform(1, 0, 0, 1, 0, 0, !0), mat4Allocate.free(modelMatrix);
11741
- }
11742
- if (onlyTranslate && !lastModelMatrix) {
11743
- const point = graphic.getOffsetXY(graphicAttribute);
11744
- result.x += point.x, result.y += point.y, result.z = z, context.setTransformForCurrent();
11745
- } else if (shouldTransform3d) result.x = 0, result.y = 0, result.z = 0, context.setTransform(1, 0, 0, 1, 0, 0, !0);else if (camera && context.project) {
11746
- const point = graphic.getOffsetXY(graphicAttribute);
11747
- result.x += point.x, result.y += point.y, this.transformWithoutTranslate(context, result.x, result.y, result.z, scaleX, scaleY, angle);
11748
- } else context.transformFromMatrix(graphic.transMatrix, !0), result.x = 0, result.y = 0, result.z = 0;
11749
- return result;
11750
- }
11751
- transformUseContext2d(graphic, graphicAttribute, z, context) {
11752
- const camera = context.camera;
11753
- if (this.camera = camera, camera) {
11754
- const bounds = graphic.AABBBounds,
11755
- width = bounds.x2 - bounds.x1,
11756
- height = bounds.y2 - bounds.y1,
11757
- p1 = context.project(0, 0, z),
11758
- p2 = context.project(width, 0, z),
11759
- p3 = context.project(width, height, z),
11760
- _p1 = {
11761
- x: 0,
11762
- y: 0
11763
- },
11764
- _p2 = {
11765
- x: width,
11766
- y: 0
11767
- },
11768
- _p3 = {
11769
- x: width,
11770
- y: height
11771
- };
11772
- context.camera = null;
11773
- const denom = 1 / (_p1.x * (_p3.y - _p2.y) - _p2.x * _p3.y + _p3.x * _p2.y + (_p2.x - _p3.x) * _p1.y),
11774
- m11 = -(_p1.y * (p3.x - p2.x) - _p2.y * p3.x + _p3.y * p2.x + (_p2.y - _p3.y) * p1.x) * denom,
11775
- m12 = (_p2.y * p3.y + _p1.y * (p2.y - p3.y) - _p3.y * p2.y + (_p3.y - _p2.y) * p1.y) * denom,
11776
- m21 = (_p1.x * (p3.x - p2.x) - _p2.x * p3.x + _p3.x * p2.x + (_p2.x - _p3.x) * p1.x) * denom,
11777
- m22 = -(_p2.x * p3.y + _p1.x * (p2.y - p3.y) - _p3.x * p2.y + (_p3.x - _p2.x) * p1.y) * denom,
11778
- dx = (_p1.x * (_p3.y * p2.x - _p2.y * p3.x) + _p1.y * (_p2.x * p3.x - _p3.x * p2.x) + (_p3.x * _p2.y - _p2.x * _p3.y) * p1.x) * denom,
11779
- dy = (_p1.x * (_p3.y * p2.y - _p2.y * p3.y) + _p1.y * (_p2.x * p3.y - _p3.x * p2.y) + (_p3.x * _p2.y - _p2.x * _p3.y) * p1.y) * denom;
11780
- context.setTransform(m11, m12, m21, m22, dx, dy, !0);
11781
- }
11782
- }
11783
- restoreTransformUseContext2d(graphic, graphicAttribute, z, context) {
11784
- this.camera && (context.camera = this.camera);
11785
- }
11786
- transformWithoutTranslate(context, x, y, z, scaleX, scaleY, angle) {
11787
- const p = context.project(x, y, z);
11788
- context.translate(p.x, p.y, !1), context.scale(scaleX, scaleY, !1), context.rotate(angle, !1), context.translate(-p.x, -p.y, !1), context.setTransformForCurrent();
11837
+ colorStops = []
11838
+ } = datum;
11839
+ return {
11840
+ gradient: "radial",
11841
+ x0: .5,
11842
+ y0: .5,
11843
+ x1: .5,
11844
+ y1: .5,
11845
+ r0: 0,
11846
+ r1: 1,
11847
+ stops: colorStops.map(item => ({
11848
+ color: item.value,
11849
+ offset: parseFloat(item.length.value) / 100
11850
+ }))
11851
+ };
11789
11852
  }
11790
- _draw(graphic, defaultAttr, computed3dMatrix, drawContext, params) {
11791
- const {
11792
- context: context
11793
- } = drawContext;
11794
- if (!context) return;
11853
+ static ParseLinear(datum) {
11795
11854
  const {
11796
- renderable: renderable
11797
- } = graphic.attribute;
11798
- if (!1 === renderable) return;
11799
- context.highPerformanceSave();
11800
- const data = this.transform(graphic, defaultAttr, context, computed3dMatrix),
11801
- {
11802
- x: x,
11803
- y: y,
11804
- z: z,
11805
- lastModelMatrix: lastModelMatrix
11806
- } = data;
11807
- this.z = z, drawPathProxy(graphic, context, x, y, drawContext, params) || (this.drawShape(graphic, context, x, y, drawContext, params), this.z = 0, context.modelMatrix !== lastModelMatrix && mat4Allocate.free(context.modelMatrix), context.modelMatrix = lastModelMatrix), context.highPerformanceRestore();
11855
+ orientation: orientation,
11856
+ colorStops = []
11857
+ } = datum,
11858
+ halfPi = pi / 2;
11859
+ let angle = "angular" === orientation.type ? parseFloat(orientation.value) / 180 * pi : 0;
11860
+ for (; angle < 0;) angle += pi2;
11861
+ for (; angle > pi2;) angle -= pi2;
11862
+ let x0 = 0,
11863
+ y0 = 0,
11864
+ x1 = 0,
11865
+ y1 = 0;
11866
+ return angle < halfPi ? (x0 = 0, y0 = 1, x1 = Math.sin(angle), y1 = Math.cos(angle)) : angle < pi ? (x0 = 0, y0 = 0, x1 = Math.cos(angle - halfPi), y1 = Math.sin(angle - halfPi)) : angle < pi + halfPi ? (x0 = 1, y0 = 0, x1 = x0 - Math.sin(angle - pi), y1 = Math.cos(angle - pi)) : (x0 = 1, x1 = x0 - Math.cos(angle - halfPi - pi), y1 -= Math.sin(angle - halfPi - pi)), {
11867
+ gradient: "linear",
11868
+ x0: x0,
11869
+ y0: y0,
11870
+ x1: x1,
11871
+ y1: y1,
11872
+ stops: colorStops.map(item => ({
11873
+ color: item.value,
11874
+ offset: parseFloat(item.length.value) / 100
11875
+ }))
11876
+ };
11877
+ }
11878
+ }
11879
+
11880
+ function getScaledStroke(context, width, dpr) {
11881
+ let strokeWidth = width;
11882
+ const {
11883
+ a: a,
11884
+ b: b,
11885
+ c: c,
11886
+ d: d
11887
+ } = context.currentMatrix,
11888
+ scaleX = Math.sign(a) * Math.sqrt(a * a + b * b),
11889
+ scaleY = Math.sign(d) * Math.sqrt(c * c + d * d);
11890
+ return scaleX + scaleY === 0 ? 0 : (strokeWidth = strokeWidth / Math.abs(scaleX + scaleY) * 2 * dpr, strokeWidth);
11891
+ }
11892
+ function createColor(context, c, params) {
11893
+ let offsetX = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
11894
+ let offsetY = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
11895
+ if (!c || !0 === c) return "black";
11896
+ let result, color;
11897
+ if (isArray$1(c)) for (let i = 0; i < c.length && (color = c[i], !color); i++);else color = c;
11898
+ if (color = GradientParser.Parse(color), "string" == typeof color) return color;
11899
+ if (params.AABBBounds && (!params.attribute || 0 !== params.attribute.scaleX || 0 !== params.attribute.scaleY)) {
11900
+ const bounds = params.AABBBounds;
11901
+ let w = bounds.x2 - bounds.x1,
11902
+ h = bounds.y2 - bounds.y1,
11903
+ x = bounds.x1 - offsetX,
11904
+ y = bounds.y1 - offsetY;
11905
+ if (params.attribute) {
11906
+ const {
11907
+ scaleX = 1,
11908
+ scaleY = 1
11909
+ } = params.attribute;
11910
+ w /= scaleX, h /= scaleY, x /= scaleX, y /= scaleY;
11911
+ }
11912
+ "linear" === color.gradient ? result = createLinearGradient(context, color, x, y, w, h) : "conical" === color.gradient ? result = createConicGradient(context, color, x, y, w, h) : "radial" === color.gradient && (result = createRadialGradient(context, color, x, y, w, h));
11808
11913
  }
11914
+ return result || "orange";
11915
+ }
11916
+ function createLinearGradient(context, color, x, y, w, h) {
11917
+ var _a, _b, _c, _d;
11918
+ const canvasGradient = context.createLinearGradient(x + (null !== (_a = color.x0) && void 0 !== _a ? _a : 0) * w, y + (null !== (_b = color.y0) && void 0 !== _b ? _b : 0) * h, x + (null !== (_c = color.x1) && void 0 !== _c ? _c : 1) * w, y + (null !== (_d = color.y1) && void 0 !== _d ? _d : 0) * h);
11919
+ return color.stops.forEach(stop => {
11920
+ canvasGradient.addColorStop(stop.offset, stop.color);
11921
+ }), canvasGradient;
11922
+ }
11923
+ function createRadialGradient(context, color, x, y, w, h) {
11924
+ var _a, _b, _c, _d, _e, _f;
11925
+ const canvasGradient = context.createRadialGradient(x + (null !== (_a = color.x0) && void 0 !== _a ? _a : .5) * w, y + (null !== (_b = color.y0) && void 0 !== _b ? _b : .5) * h, Math.max(w, h) * (null !== (_c = color.r0) && void 0 !== _c ? _c : 0), x + (null !== (_d = color.x1) && void 0 !== _d ? _d : .5) * w, y + (null !== (_e = color.y1) && void 0 !== _e ? _e : .5) * h, Math.max(w, h) * (null !== (_f = color.r1) && void 0 !== _f ? _f : .5));
11926
+ return color.stops.forEach(stop => {
11927
+ canvasGradient.addColorStop(stop.offset, stop.color);
11928
+ }), canvasGradient;
11929
+ }
11930
+ function createConicGradient(context, color, x, y, w, h) {
11931
+ var _a, _b;
11932
+ const canvasGradient = context.createConicGradient(x + (null !== (_a = color.x) && void 0 !== _a ? _a : 0) * w, y + (null !== (_b = color.y) && void 0 !== _b ? _b : 0) * h, color.startAngle, color.endAngle);
11933
+ return color.stops.forEach(stop => {
11934
+ canvasGradient.addColorStop(stop.offset, stop.color);
11935
+ }), canvasGradient.GetPattern(w + x, h + y, undefined);
11809
11936
  }
11810
11937
 
11811
11938
  var __decorate$1A = undefined && undefined.__decorate || function (decorators, target, key, desc) {
@@ -13674,16 +13801,8 @@ let DefaultCanvasTextRender = class extends BaseRender {
13674
13801
  verticalMode = textAttribute.verticalMode,
13675
13802
  x: originX = textAttribute.x,
13676
13803
  y: originY = textAttribute.y
13677
- } = text.attribute;
13678
- let {
13679
- textAlign = textAttribute.textAlign,
13680
- textBaseline = textAttribute.textBaseline
13681
- } = text.attribute;
13682
- if (!verticalMode && "vertical" === direction) {
13683
- const t = textAlign;
13684
- textAlign = null !== (_a = text.getBaselineMapAlign()[textBaseline]) && void 0 !== _a ? _a : "left", textBaseline = null !== (_b = text.getAlignMapBaseline()[t]) && void 0 !== _b ? _b : "top";
13685
- }
13686
- const lineHeight = null !== (_c = calculateLineHeight(text.attribute.lineHeight, fontSize)) && void 0 !== _c ? _c : fontSize,
13804
+ } = text.attribute,
13805
+ lineHeight = null !== (_a = calculateLineHeight(text.attribute.lineHeight, fontSize)) && void 0 !== _a ? _a : fontSize,
13687
13806
  data = this.valid(text, textAttribute, fillCb, strokeCb);
13688
13807
  if (!data) return;
13689
13808
  const {
@@ -13703,79 +13822,60 @@ let DefaultCanvasTextRender = class extends BaseRender {
13703
13822
  const matrix = matrixAllocate.allocate(1, 0, 0, 1, 0, 0);
13704
13823
  matrix.rotateByCenter(Math.PI / 2, _x, _y), context.transformFromMatrix(matrix, !0), matrixAllocate.free(matrix);
13705
13824
  }
13706
- 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());
13825
+ doStroke && (strokeCb ? strokeCb(context, text.attribute, textAttribute) : sVisible && (context.setStrokeStyle(text, text.attribute, originX - x, originY - y, textAttribute), context.strokeText(t, _x, _y, z))), doFill && (fillCb ? fillCb(context, text.attribute, textAttribute) : fVisible && (context.setCommonStyle(text, text.attribute, originX - x, originY - y, textAttribute), context.fillText(t, _x, _y, z))), direction && (context.highPerformanceRestore(), context.setTransformForCurrent());
13707
13826
  };
13708
- if (text.isMultiLine) {
13709
- if (context.setTextStyleWithoutAlignBaseline(text.attribute, textAttribute, z), "horizontal" === direction) {
13710
- const {
13711
- multilineLayout: multilineLayout
13712
- } = text;
13713
- if (!multilineLayout) return void context.highPerformanceRestore();
13714
- const {
13715
- xOffset: xOffset,
13716
- yOffset: yOffset
13717
- } = multilineLayout.bbox;
13718
- doStroke && (strokeCb ? strokeCb(context, text.attribute, textAttribute) : sVisible && (context.setStrokeStyle(text, text.attribute, originX - x, originY - y, textAttribute), multilineLayout.lines.forEach(line => {
13719
- context.strokeText(line.str, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y, z);
13720
- }))), doFill && (fillCb ? fillCb(context, text.attribute, textAttribute) : fVisible && (context.setCommonStyle(text, text.attribute, originX - x, originY - y, textAttribute), multilineLayout.lines.forEach(line => {
13721
- 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, {
13722
- width: line.width
13723
- });
13724
- })));
13725
- } else {
13726
- text.tryUpdateAABBBounds();
13727
- const cache = text.cache,
13728
- {
13729
- verticalList: verticalList
13730
- } = cache;
13731
- context.textAlign = "left", context.textBaseline = "top";
13732
- const totalHeight = lineHeight * verticalList.length;
13733
- let totalW = 0;
13734
- verticalList.forEach(verticalData => {
13735
- const _w = verticalData.reduce((a, b) => a + (b.width || 0), 0);
13736
- totalW = max(_w, totalW);
13737
- });
13738
- let offsetY = 0,
13739
- offsetX = 0;
13740
- "bottom" === textBaseline ? offsetX = -totalHeight : "middle" === textBaseline && (offsetX = -totalHeight / 2), "center" === textAlign ? offsetY -= totalW / 2 : "right" === textAlign && (offsetY -= totalW), verticalList.forEach((verticalData, i) => {
13741
- const currentW = verticalData.reduce((a, b) => a + (b.width || 0), 0),
13742
- dw = totalW - currentW;
13743
- let currentOffsetY = offsetY;
13744
- "center" === textAlign ? currentOffsetY += dw / 2 : "right" === textAlign && (currentOffsetY += dw), verticalData.forEach(item => {
13745
- const {
13746
- text: text,
13747
- width: width,
13748
- direction: direction
13749
- } = item;
13750
- drawText(text, totalHeight - (i + 1) * lineHeight + offsetX, currentOffsetY, direction), currentOffsetY += width;
13751
- });
13827
+ if (context.setTextStyleWithoutAlignBaseline(text.attribute, textAttribute, z), "horizontal" === direction) {
13828
+ const {
13829
+ multilineLayout: multilineLayout
13830
+ } = text;
13831
+ if (!multilineLayout) return void context.highPerformanceRestore();
13832
+ const {
13833
+ xOffset: xOffset,
13834
+ yOffset: yOffset
13835
+ } = multilineLayout.bbox;
13836
+ doStroke && (strokeCb ? strokeCb(context, text.attribute, textAttribute) : sVisible && (context.setStrokeStyle(text, text.attribute, originX - x, originY - y, textAttribute), multilineLayout.lines.forEach(line => {
13837
+ context.strokeText(line.str, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y, z);
13838
+ }))), doFill && (fillCb ? fillCb(context, text.attribute, textAttribute) : fVisible && (context.setCommonStyle(text, text.attribute, originX - x, originY - y, textAttribute), multilineLayout.lines.forEach(line => {
13839
+ 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, line.descent, (line.descent - line.ascent) / 2, z, textAttribute, context, {
13840
+ width: line.width
13752
13841
  });
13753
- }
13754
- } else if ("horizontal" === direction) {
13755
- context.setTextStyle(text.attribute, textAttribute, z);
13756
- const t = text.clipedText;
13757
- let dy = 0;
13758
- lineHeight !== fontSize && ("top" === textBaseline ? dy = (lineHeight - fontSize) / 2 : "middle" === textBaseline || "bottom" === textBaseline && (dy = -(lineHeight - fontSize) / 2)), drawText(t, 0, dy, 0);
13842
+ })));
13759
13843
  } else {
13844
+ let {
13845
+ textAlign = textAttribute.textAlign,
13846
+ textBaseline = textAttribute.textBaseline
13847
+ } = text.attribute;
13848
+ if (!verticalMode) {
13849
+ const t = textAlign;
13850
+ textAlign = null !== (_b = text.getBaselineMapAlign()[textBaseline]) && void 0 !== _b ? _b : "left", textBaseline = null !== (_c = text.getAlignMapBaseline()[t]) && void 0 !== _c ? _c : "top";
13851
+ }
13760
13852
  text.tryUpdateAABBBounds();
13761
- const cache = text.cache;
13762
- if (cache) {
13763
- context.setTextStyleWithoutAlignBaseline(text.attribute, textAttribute, z);
13764
- const {
13853
+ const cache = text.cache,
13854
+ {
13765
13855
  verticalList: verticalList
13766
13856
  } = cache;
13767
- let offsetY = 0;
13768
- const totalW = verticalList[0].reduce((a, b) => a + (b.width || 0), 0);
13769
- let offsetX = 0;
13770
- "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 => {
13857
+ context.textAlign = "left", context.textBaseline = "top";
13858
+ const totalHeight = lineHeight * verticalList.length;
13859
+ let totalW = 0;
13860
+ verticalList.forEach(verticalData => {
13861
+ const _w = verticalData.reduce((a, b) => a + (b.width || 0), 0);
13862
+ totalW = max(_w, totalW);
13863
+ });
13864
+ let offsetY = 0,
13865
+ offsetX = 0;
13866
+ "bottom" === textBaseline ? offsetX = -totalHeight : "middle" === textBaseline && (offsetX = -totalHeight / 2), "center" === textAlign ? offsetY -= totalW / 2 : "right" === textAlign && (offsetY -= totalW), verticalList.forEach((verticalData, i) => {
13867
+ const currentW = verticalData.reduce((a, b) => a + (b.width || 0), 0),
13868
+ dw = totalW - currentW;
13869
+ let currentOffsetY = offsetY;
13870
+ "center" === textAlign ? currentOffsetY += dw / 2 : "right" === textAlign && (currentOffsetY += dw), verticalData.forEach(item => {
13771
13871
  const {
13772
13872
  text: text,
13773
13873
  width: width,
13774
13874
  direction: direction
13775
13875
  } = item;
13776
- drawText(text, offsetX, offsetY, direction), offsetY += width;
13876
+ drawText(text, totalHeight - (i + 1) * lineHeight + offsetX, currentOffsetY, direction), currentOffsetY += width;
13777
13877
  });
13778
- }
13878
+ });
13779
13879
  }
13780
13880
  transform3dMatrixToContextMatrix && this.restoreTransformUseContext2d(text, textAttribute, z, context), this.afterRenderStep(text, context, x, y, doFill, doStroke, fVisible, sVisible, textAttribute, drawContext, fillCb, strokeCb);
13781
13881
  }
@@ -13787,12 +13887,10 @@ let DefaultCanvasTextRender = class extends BaseRender {
13787
13887
  computed3dMatrix = !keepDirIn3d;
13788
13888
  this._draw(text, textAttribute, computed3dMatrix, drawContext, params);
13789
13889
  }
13790
- drawUnderLine(underline, lineThrough, text, x, y, z, textAttribute, context, multiOption) {
13890
+ drawUnderLine(underline, lineThrough, text, anchorX, anchorY, offsetUnderLineY, offsetThroughLineY, z, textAttribute, context, multiOption) {
13791
13891
  if (lineThrough + underline <= 0) return;
13792
13892
  const {
13793
13893
  textAlign = textAttribute.textAlign,
13794
- textBaseline = textAttribute.textBaseline,
13795
- fontSize = textAttribute.fontSize,
13796
13894
  fill = textAttribute.fill,
13797
13895
  opacity = textAttribute.opacity,
13798
13896
  underlineOffset = textAttribute.underlineOffset,
@@ -13802,23 +13900,21 @@ let DefaultCanvasTextRender = class extends BaseRender {
13802
13900
  isMulti = !isNil$1(multiOption),
13803
13901
  w = isMulti ? multiOption.width : text.clipedWidth,
13804
13902
  offsetX = isMulti ? 0 : textDrawOffsetX(textAlign, w),
13805
- offsetY = textLayoutOffsetY(isMulti ? "alphabetic" : textBaseline, fontSize, fontSize),
13806
13903
  attribute = {
13807
13904
  lineWidth: 0,
13808
13905
  stroke: fill,
13809
13906
  opacity: opacity,
13810
13907
  strokeOpacity: fillOpacity
13811
13908
  };
13812
- let deltaY = isMulti ? -3 : 0;
13813
13909
  if (underline) {
13814
- attribute.lineWidth = underline, context.setStrokeStyle(text, attribute, x, y, textAttribute), underlineDash && context.setLineDash(underlineDash), context.beginPath();
13815
- const dy = y + offsetY + fontSize + underlineOffset + deltaY;
13816
- context.moveTo(x + offsetX, dy, z), context.lineTo(x + offsetX + w, dy, z), context.stroke();
13910
+ attribute.lineWidth = underline, context.setStrokeStyle(text, attribute, anchorX, anchorY, textAttribute), underlineDash && context.setLineDash(underlineDash), context.beginPath();
13911
+ const dy = anchorY + offsetUnderLineY + underlineOffset;
13912
+ context.moveTo(anchorX + offsetX, dy, z), context.lineTo(anchorX + offsetX + w, dy, z), context.stroke();
13817
13913
  }
13818
- if (isMulti && (deltaY = -1), lineThrough) {
13819
- attribute.lineWidth = lineThrough, context.setStrokeStyle(text, attribute, x, y, textAttribute), context.beginPath();
13820
- const dy = y + offsetY + fontSize / 2 + deltaY;
13821
- context.moveTo(x + offsetX, dy, z), context.lineTo(x + offsetX + w, dy, z), context.stroke();
13914
+ if (lineThrough) {
13915
+ attribute.lineWidth = lineThrough, context.setStrokeStyle(text, attribute, anchorX, anchorY, textAttribute), context.beginPath();
13916
+ const dy = anchorY + offsetThroughLineY;
13917
+ context.moveTo(anchorX + offsetX, dy, z), context.lineTo(anchorX + offsetX + w, dy, z), context.stroke();
13822
13918
  }
13823
13919
  }
13824
13920
  };
@@ -14221,10 +14317,7 @@ class ShadowRootDrawItemInterceptorContribution {
14221
14317
  const {
14222
14318
  context: context
14223
14319
  } = drawContext;
14224
- context.highPerformanceSave();
14225
- const t1 = graphic.parent.globalTransMatrix,
14226
- t2 = graphic.stage.window.getViewBoxTransform().clone().multiply(t1.a, t1.b, t1.c, t1.d, t1.e, t1.f);
14227
- if (graphic.parent && context.setTransformFromMatrix(t2, !0), drawContribution.dirtyBounds && drawContribution.backupDirtyBounds) {
14320
+ if (context.highPerformanceSave(), context.transformFromMatrix(graphic.transMatrix, !0), drawContribution.dirtyBounds && drawContribution.backupDirtyBounds) {
14228
14321
  tempDirtyBounds.copy(drawContribution.dirtyBounds), tempBackupDirtyBounds.copy(drawContribution.backupDirtyBounds);
14229
14322
  const m = graphic.globalTransMatrix.getInverse();
14230
14323
  drawContribution.dirtyBounds.copy(drawContribution.backupDirtyBounds).transformWithMatrix(m), drawContribution.backupDirtyBounds.copy(drawContribution.dirtyBounds);
@@ -14504,58 +14597,60 @@ class CanvasTextLayout {
14504
14597
  constructor(fontFamily, options, textMeasure) {
14505
14598
  this.fontFamily = fontFamily, this.textOptions = options, this.textMeasure = textMeasure;
14506
14599
  }
14507
- LayoutBBox(bbox, textAlign, textBaseline) {
14600
+ LayoutBBox(bbox, textAlign, textBaseline, linesLayout) {
14508
14601
  if ("left" === textAlign || "start" === textAlign) bbox.xOffset = 0;else if ("center" === textAlign) bbox.xOffset = bbox.width / -2;else {
14509
14602
  if ("right" !== textAlign && "end" !== textAlign) throw new Error("非法的textAlign");
14510
14603
  bbox.xOffset = -bbox.width;
14511
14604
  }
14512
- return bbox.yOffset = "top" === textBaseline ? 0 : "middle" === textBaseline ? bbox.height / -2 : "alphabetic" === textBaseline ? -.79 * bbox.height : -bbox.height, bbox;
14513
- }
14514
- GetLayout(str, width, height, textAlign, textBaseline, lineHeight, suffix, wordBreak, suffixPosition) {
14515
- const linesLayout = [],
14516
- bboxWH = [width, height],
14517
- bboxOffset = [0, 0];
14518
- for (; str.length > 0;) {
14519
- const {
14520
- str: clipText
14521
- } = this.textMeasure.clipTextWithSuffix(str, this.textOptions, width, suffix, wordBreak, suffixPosition);
14522
- linesLayout.push({
14523
- str: clipText,
14524
- width: this.textMeasure.measureTextWidth(clipText, this.textOptions)
14525
- }), str = str.substring(clipText.length);
14526
- }
14527
- "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]));
14528
- const bbox = {
14529
- xOffset: bboxOffset[0],
14530
- yOffset: bboxOffset[1],
14531
- width: bboxWH[0],
14532
- height: bboxWH[1]
14533
- };
14534
- return this.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline, lineHeight);
14605
+ if ("top" === textBaseline) bbox.yOffset = 0;else if ("middle" === textBaseline) bbox.yOffset = bbox.height / -2;else if ("alphabetic" === textBaseline) {
14606
+ let percent = .79;
14607
+ if (1 === linesLayout.length) {
14608
+ const lineInfo = linesLayout[0];
14609
+ percent = lineInfo.ascent / (lineInfo.ascent + lineInfo.descent);
14610
+ }
14611
+ bbox.yOffset = bbox.height * -percent;
14612
+ } else bbox.yOffset = -bbox.height;
14613
+ return bbox;
14535
14614
  }
14536
14615
  GetLayoutByLines(lines, textAlign, textBaseline, lineHeight) {
14537
14616
  let suffix = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : "";
14538
14617
  let wordBreak = arguments.length > 5 ? arguments[5] : undefined;
14539
- let lineWidth = arguments.length > 6 ? arguments[6] : undefined;
14540
- let suffixPosition = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : "end";
14618
+ let params = arguments.length > 6 ? arguments[6] : undefined;
14619
+ const {
14620
+ lineWidth: lineWidth,
14621
+ suffixPosition = "end",
14622
+ measureMode = MeasureModeEnum.actualBounding
14623
+ } = null != params ? params : {};
14541
14624
  lines = lines.map(l => l.toString());
14542
14625
  const linesLayout = [],
14543
14626
  bboxWH = [0, 0];
14544
14627
  if ("number" == typeof lineWidth && lineWidth !== 1 / 0) {
14545
14628
  let width;
14546
- for (let i = 0, len = lines.length; i < len; i++) width = Math.min(this.textMeasure.measureTextWidth(lines[i], this.textOptions), lineWidth), linesLayout.push({
14547
- str: this.textMeasure.clipTextWithSuffix(lines[i], this.textOptions, width, suffix, wordBreak, suffixPosition).str,
14548
- width: width
14549
- });
14629
+ for (let i = 0, len = lines.length; i < len; i++) {
14630
+ const metrics = this.textMeasure.measureTextPixelADscentAndWidth(lines[i], this.textOptions, measureMode);
14631
+ width = Math.min(metrics.width, lineWidth), linesLayout.push({
14632
+ str: metrics.width <= lineWidth ? lines[i].toString() : this.textMeasure.clipTextWithSuffix(lines[i], this.textOptions, width, suffix, wordBreak, suffixPosition).str,
14633
+ width: width,
14634
+ ascent: metrics.ascent,
14635
+ descent: metrics.descent
14636
+ });
14637
+ }
14550
14638
  bboxWH[0] = lineWidth;
14551
14639
  } else {
14552
- let width, text;
14553
- lineWidth = 0;
14554
- 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({
14555
- str: text,
14556
- width: width
14557
- });
14558
- bboxWH[0] = lineWidth;
14640
+ let width,
14641
+ text,
14642
+ _lineWidth = 0;
14643
+ for (let i = 0, len = lines.length; i < len; i++) {
14644
+ text = lines[i];
14645
+ const metrics = this.textMeasure.measureTextPixelADscentAndWidth(lines[i], this.textOptions, measureMode);
14646
+ width = metrics.width, _lineWidth = Math.max(_lineWidth, width), linesLayout.push({
14647
+ str: text,
14648
+ width: width,
14649
+ ascent: metrics.ascent,
14650
+ descent: metrics.descent
14651
+ });
14652
+ }
14653
+ bboxWH[0] = _lineWidth;
14559
14654
  }
14560
14655
  bboxWH[1] = linesLayout.length * lineHeight, bboxWH[0] = linesLayout.reduce((a, b) => Math.max(a, b.width), 0);
14561
14656
  const bbox = {
@@ -14564,7 +14659,7 @@ class CanvasTextLayout {
14564
14659
  width: bboxWH[0],
14565
14660
  height: bboxWH[1]
14566
14661
  };
14567
- return this.LayoutBBox(bbox, textAlign, textBaseline), this.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline, lineHeight);
14662
+ return this.LayoutBBox(bbox, textAlign, textBaseline, linesLayout), this.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline, lineHeight);
14568
14663
  }
14569
14664
  layoutWithBBox(bbox, lines, textAlign, textBaseline, lineHeight) {
14570
14665
  const origin = [0, 0],
@@ -14583,11 +14678,13 @@ class CanvasTextLayout {
14583
14678
  };
14584
14679
  }
14585
14680
  lineOffset(bbox, line, textAlign, textBaseline, lineHeight, origin) {
14586
- 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;
14681
+ "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 + (line.ascent - line.descent) / 2 + origin[1];
14682
+ const actualHeightWithBuf = line.ascent + line.descent + 0;
14683
+ return actualHeightWithBuf < lineHeight - 0 && ("bottom" === textBaseline ? line.topOffset += (lineHeight - actualHeightWithBuf) / 2 : "top" === textBaseline && (line.topOffset -= (lineHeight - actualHeightWithBuf) / 2)), origin[1] += lineHeight, line;
14587
14684
  }
14588
14685
  }
14589
14686
 
14590
- const TEXT_UPDATE_TAG_KEY = ["text", "maxLineWidth", "textAlign", "textBaseline", "heightLimit", "lineClamp", "fontSize", "fontFamily", "fontWeight", "ellipsis", "lineHeight", "direction", "wordBreak", "heightLimit", "lineClamp", ...GRAPHIC_UPDATE_TAG_KEY];
14687
+ const TEXT_UPDATE_TAG_KEY = ["text", "maxLineWidth", "maxWidth", "textAlign", "textBaseline", "heightLimit", "lineClamp", "fontSize", "fontFamily", "fontWeight", "ellipsis", "lineHeight", "direction", "wordBreak", "heightLimit", "lineClamp", ...GRAPHIC_UPDATE_TAG_KEY];
14591
14688
  class Text extends Graphic {
14592
14689
  get font() {
14593
14690
  const textTheme = this.getGraphicTheme();
@@ -14596,26 +14693,22 @@ class Text extends Graphic {
14596
14693
  get clipedText() {
14597
14694
  var _a;
14598
14695
  const attribute = this.attribute,
14599
- textTheme = this.getGraphicTheme();
14600
- if (!this.isSimplify()) return;
14601
- const {
14602
- maxLineWidth = textTheme.maxLineWidth
14603
- } = attribute;
14604
- return Number.isFinite(maxLineWidth) ? (this.tryUpdateAABBBounds(), this.cache.clipedText) : (null !== (_a = attribute.text) && void 0 !== _a ? _a : textTheme.text).toString();
14696
+ textTheme = this.getGraphicTheme(),
14697
+ maxWidth = this.getMaxWidth(textTheme);
14698
+ return Number.isFinite(maxWidth) ? (this.tryUpdateAABBBounds(), this.cache.clipedText) : (null !== (_a = attribute.text) && void 0 !== _a ? _a : textTheme.text).toString();
14605
14699
  }
14606
14700
  get clipedWidth() {
14607
- if (this.isSimplify()) return this.tryUpdateAABBBounds(), this.cache.clipedWidth;
14701
+ return this.tryUpdateAABBBounds(), this.cache.clipedWidth;
14608
14702
  }
14609
14703
  get cliped() {
14610
14704
  var _a, _b;
14611
14705
  const textTheme = this.getGraphicTheme(),
14612
14706
  attribute = this.attribute,
14613
- {
14614
- maxLineWidth = textTheme.maxLineWidth,
14615
- text: text,
14616
- whiteSpace = textTheme.whiteSpace
14617
- } = attribute;
14618
- if (!Number.isFinite(maxLineWidth)) return !1;
14707
+ maxWidth = this.getMaxWidth(textTheme);
14708
+ if (!Number.isFinite(maxWidth)) return !1;
14709
+ const {
14710
+ text: text
14711
+ } = this.attribute;
14619
14712
  if (this.tryUpdateAABBBounds(), null === (_b = null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData) || void 0 === _b ? void 0 : _b.lines) {
14620
14713
  let mergedText = "";
14621
14714
  this.cache.layoutData.lines.forEach(item => {
@@ -14626,10 +14719,7 @@ class Text extends Graphic {
14626
14719
  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();
14627
14720
  }
14628
14721
  get multilineLayout() {
14629
- if (this.isMultiLine) return this.tryUpdateAABBBounds(), this.cache.layoutData;
14630
- }
14631
- isSimplify() {
14632
- return !this.isMultiLine && "vertical" !== this.attribute.direction;
14722
+ return this.tryUpdateAABBBounds(), this.cache.layoutData;
14633
14723
  }
14634
14724
  get isMultiLine() {
14635
14725
  return Array.isArray(this.attribute.text) || "normal" === this.attribute.whiteSpace;
@@ -14702,8 +14792,72 @@ class Text extends Graphic {
14702
14792
  }
14703
14793
  return application.graphicService.combindShadowAABBBounds(aabbBounds, this), null == attribute.forceBoundsHeight && null == attribute.forceBoundsWidth || application.graphicService.updateHTMLTextAABBBounds(attribute, textTheme, aabbBounds), transformBoundsWithMatrix(aabbBounds, aabbBounds, this.transMatrix), aabbBounds;
14704
14794
  }
14795
+ updateSingallineAABBBounds(text) {
14796
+ this.updateMultilineAABBBounds([text]);
14797
+ const layoutData = this.cache.layoutData;
14798
+ if (layoutData) {
14799
+ const line = layoutData.lines[0];
14800
+ this.cache.clipedText = line.str, this.cache.clipedWidth = line.width;
14801
+ }
14802
+ return this._AABBBounds;
14803
+ }
14804
+ updateMultilineAABBBounds(text) {
14805
+ const textTheme = this.getGraphicTheme(),
14806
+ {
14807
+ direction = textTheme.direction,
14808
+ underlineOffset = textTheme.underlineOffset
14809
+ } = this.attribute,
14810
+ b = "horizontal" === direction ? this.updateHorizontalMultilineAABBBounds(text) : this.updateVerticalMultilineAABBBounds(text);
14811
+ return "horizontal" === direction && underlineOffset && this._AABBBounds.add(this._AABBBounds.x1, this._AABBBounds.y2 + underlineOffset), b;
14812
+ }
14813
+ guessLineHeightBuf(fontSize) {
14814
+ return fontSize ? .1 * fontSize : 0;
14815
+ }
14816
+ updateHorizontalMultilineAABBBounds(text) {
14817
+ var _a;
14818
+ const textTheme = this.getGraphicTheme(),
14819
+ attribute = this.attribute,
14820
+ {
14821
+ fontFamily = textTheme.fontFamily,
14822
+ textAlign = textTheme.textAlign,
14823
+ textBaseline = textTheme.textBaseline,
14824
+ fontSize = textTheme.fontSize,
14825
+ fontWeight = textTheme.fontWeight,
14826
+ ellipsis = textTheme.ellipsis,
14827
+ maxLineWidth: maxLineWidth,
14828
+ stroke = textTheme.stroke,
14829
+ wrap = textTheme.wrap,
14830
+ measureMode = textTheme.measureMode,
14831
+ lineWidth = textTheme.lineWidth,
14832
+ whiteSpace = textTheme.whiteSpace,
14833
+ suffixPosition = textTheme.suffixPosition,
14834
+ ignoreBuf = textTheme.ignoreBuf
14835
+ } = attribute,
14836
+ buf = ignoreBuf ? 0 : this.guessLineHeightBuf(fontSize),
14837
+ lineHeight = this.getLineHeight(attribute, textTheme) + buf;
14838
+ if ("normal" === whiteSpace || wrap) return this.updateWrapAABBBounds(text);
14839
+ if (!this.shouldUpdateShape() && (null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData)) {
14840
+ const bbox = this.cache.layoutData.bbox;
14841
+ return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
14842
+ }
14843
+ const textMeasure = application.graphicUtil.textMeasure,
14844
+ layoutData = new CanvasTextLayout(fontFamily, {
14845
+ fontSize: fontSize,
14846
+ fontWeight: fontWeight,
14847
+ fontFamily: fontFamily,
14848
+ lineHeight: lineHeight
14849
+ }, textMeasure).GetLayoutByLines(text, textAlign, textBaseline, lineHeight, !0 === ellipsis ? textTheme.ellipsis : ellipsis || void 0, !1, {
14850
+ lineWidth: maxLineWidth,
14851
+ suffixPosition: suffixPosition,
14852
+ measureMode: measureMode
14853
+ }),
14854
+ {
14855
+ bbox: bbox
14856
+ } = layoutData;
14857
+ 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;
14858
+ }
14705
14859
  updateWrapAABBBounds(text) {
14706
- var _a, _b, _c, _d;
14860
+ var _a, _b, _c;
14707
14861
  const textTheme = this.getGraphicTheme(),
14708
14862
  {
14709
14863
  fontFamily = textTheme.fontFamily,
@@ -14717,22 +14871,25 @@ class Text extends Graphic {
14717
14871
  wordBreak = textTheme.wordBreak,
14718
14872
  fontWeight = textTheme.fontWeight,
14719
14873
  ignoreBuf = textTheme.ignoreBuf,
14874
+ measureMode = textTheme.measureMode,
14720
14875
  suffixPosition = textTheme.suffixPosition,
14721
14876
  heightLimit = 0,
14722
14877
  lineClamp: lineClamp
14723
14878
  } = this.attribute,
14724
- lineHeight = null !== (_a = calculateLineHeight(this.attribute.lineHeight, this.attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : this.attribute.fontSize || textTheme.fontSize,
14725
- buf = ignoreBuf ? 0 : 2;
14726
- if (!this.shouldUpdateShape() && (null === (_b = this.cache) || void 0 === _b ? void 0 : _b.layoutData)) {
14879
+ buf = ignoreBuf ? 0 : this.guessLineHeightBuf(fontSize),
14880
+ lineHeight = this.getLineHeight(this.attribute, textTheme) + buf;
14881
+ if (!this.shouldUpdateShape() && (null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData)) {
14727
14882
  const bbox = this.cache.layoutData.bbox;
14728
14883
  return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
14729
14884
  }
14730
14885
  const textMeasure = application.graphicUtil.textMeasure,
14731
- layoutObj = new CanvasTextLayout(fontFamily, {
14886
+ textOptions = {
14732
14887
  fontSize: fontSize,
14733
14888
  fontWeight: fontWeight,
14734
- fontFamily: fontFamily
14735
- }, textMeasure),
14889
+ fontFamily: fontFamily,
14890
+ lineHeight: lineHeight
14891
+ },
14892
+ layoutObj = new CanvasTextLayout(fontFamily, textOptions, textMeasure),
14736
14893
  lines = isArray$1(text) ? text.map(l => l.toString()) : [text.toString()],
14737
14894
  linesLayout = [],
14738
14895
  bboxWH = [0, 0];
@@ -14742,29 +14899,35 @@ class Text extends Graphic {
14742
14899
  const str = lines[i];
14743
14900
  let needCut = !0;
14744
14901
  if (i === lineCountLimit - 1) {
14745
- const clip = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1, suffixPosition, i !== lines.length - 1);
14902
+ const clip = textMeasure.clipTextWithSuffix(str, textOptions, maxLineWidth, ellipsis, !1, suffixPosition, i !== lines.length - 1),
14903
+ matrics = textMeasure.measureTextPixelADscentAndWidth(clip.str, textOptions, measureMode);
14746
14904
  linesLayout.push({
14747
14905
  str: clip.str,
14748
- width: clip.width
14906
+ width: clip.width,
14907
+ ascent: matrics.ascent,
14908
+ descent: matrics.descent
14749
14909
  });
14750
14910
  break;
14751
14911
  }
14752
- const clip = layoutObj.textMeasure.clipText(str, layoutObj.textOptions, maxLineWidth, "break-all" !== wordBreak, "keep-all" === wordBreak);
14912
+ const clip = textMeasure.clipText(str, textOptions, maxLineWidth, "break-all" !== wordBreak, "keep-all" === wordBreak);
14753
14913
  if ("" !== str && "" === clip.str || clip.wordBreaked) {
14754
14914
  if (ellipsis) {
14755
- const clipEllipsis = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
14756
- clip.str = null !== (_c = clipEllipsis.str) && void 0 !== _c ? _c : "", clip.width = null !== (_d = clipEllipsis.width) && void 0 !== _d ? _d : 0;
14915
+ const clipEllipsis = textMeasure.clipTextWithSuffix(str, textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
14916
+ clip.str = null !== (_b = clipEllipsis.str) && void 0 !== _b ? _b : "", clip.width = null !== (_c = clipEllipsis.width) && void 0 !== _c ? _c : 0;
14757
14917
  } else clip.str = "", clip.width = 0;
14758
14918
  needCut = !1;
14759
14919
  }
14920
+ const matrics = textMeasure.measureTextPixelADscentAndWidth(clip.str, textOptions, measureMode);
14760
14921
  linesLayout.push({
14761
14922
  str: clip.str,
14762
- width: clip.width
14923
+ width: clip.width,
14924
+ ascent: matrics.ascent,
14925
+ descent: matrics.descent
14763
14926
  });
14764
14927
  let cutLength = clip.str.length;
14765
14928
  if (!clip.wordBreaked || "" !== str && "" === clip.str || (needCut = !0, cutLength = clip.wordBreaked), clip.str.length === str.length) ;else if (needCut) {
14766
- let newStr = str.substring(cutLength);
14767
- "keep-all" === wordBreak && (newStr = newStr.replace(/^\s+/g, "")), lines.splice(i + 1, 0, newStr);
14929
+ const newStr = str.substring(cutLength);
14930
+ lines.splice(i + 1, 0, newStr);
14768
14931
  }
14769
14932
  }
14770
14933
  let maxWidth = 0;
@@ -14777,235 +14940,44 @@ class Text extends Graphic {
14777
14940
  lineWidth = 0;
14778
14941
  for (let i = 0, len = lines.length; i < len; i++) {
14779
14942
  if (i === lineCountLimit - 1) {
14780
- const clip = layoutObj.textMeasure.clipTextWithSuffix(lines[i], layoutObj.textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
14943
+ const clip = textMeasure.clipTextWithSuffix(lines[i], textOptions, maxLineWidth, ellipsis, !1, suffixPosition),
14944
+ matrics = textMeasure.measureTextPixelADscentAndWidth(clip.str, textOptions, measureMode);
14781
14945
  linesLayout.push({
14782
14946
  str: clip.str,
14783
- width: clip.width
14947
+ width: clip.width,
14948
+ ascent: matrics.ascent,
14949
+ descent: matrics.descent
14784
14950
  }), lineWidth = Math.max(lineWidth, clip.width);
14785
14951
  break;
14786
14952
  }
14787
- text = lines[i], width = layoutObj.textMeasure.measureTextWidth(text, layoutObj.textOptions, "break-word" === wordBreak), lineWidth = Math.max(lineWidth, width), linesLayout.push({
14953
+ text = lines[i], width = textMeasure.measureTextWidth(text, textOptions), lineWidth = Math.max(lineWidth, width);
14954
+ const matrics = textMeasure.measureTextPixelADscentAndWidth(text, textOptions, measureMode);
14955
+ linesLayout.push({
14788
14956
  str: text,
14789
- width: width
14957
+ width: width,
14958
+ ascent: matrics.ascent,
14959
+ descent: matrics.descent
14790
14960
  });
14791
14961
  }
14792
14962
  bboxWH[0] = lineWidth;
14793
14963
  }
14794
- bboxWH[1] = linesLayout.length * (lineHeight + buf);
14964
+ bboxWH[1] = linesLayout.length * lineHeight;
14795
14965
  const bbox = {
14796
14966
  xOffset: 0,
14797
14967
  yOffset: 0,
14798
14968
  width: bboxWH[0],
14799
14969
  height: bboxWH[1]
14800
14970
  };
14801
- layoutObj.LayoutBBox(bbox, textAlign, textBaseline);
14971
+ layoutObj.LayoutBBox(bbox, textAlign, textBaseline, linesLayout);
14802
14972
  const layoutData = layoutObj.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline, lineHeight);
14803
14973
  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;
14804
14974
  }
14805
- updateSingallineAABBBounds(text) {
14806
- const textTheme = this.getGraphicTheme(),
14807
- {
14808
- direction = textTheme.direction,
14809
- underlineOffset = textTheme.underlineOffset
14810
- } = this.attribute,
14811
- b = "horizontal" === direction ? this.updateHorizontalSinglelineAABBBounds(text) : this.updateVerticalSinglelineAABBBounds(text);
14812
- return "horizontal" === direction && underlineOffset && this._AABBBounds.add(this._AABBBounds.x1, this._AABBBounds.y2 + underlineOffset), b;
14813
- }
14814
- updateMultilineAABBBounds(text) {
14815
- const textTheme = this.getGraphicTheme(),
14816
- {
14817
- direction = textTheme.direction,
14818
- underlineOffset = textTheme.underlineOffset
14819
- } = this.attribute,
14820
- b = "horizontal" === direction ? this.updateHorizontalMultilineAABBBounds(text) : this.updateVerticalMultilineAABBBounds(text);
14821
- return "horizontal" === direction && underlineOffset && this._AABBBounds.add(this._AABBBounds.x1, this._AABBBounds.y2 + underlineOffset), b;
14822
- }
14823
- updateHorizontalSinglelineAABBBounds(text) {
14824
- var _a, _b;
14825
- const textTheme = this.getGraphicTheme(),
14826
- {
14827
- wrap = textTheme.wrap
14828
- } = this.attribute;
14829
- if (wrap) return this.updateWrapAABBBounds([text]);
14830
- const textMeasure = application.graphicUtil.textMeasure;
14831
- let width, str;
14832
- const attribute = this.attribute,
14833
- {
14834
- maxLineWidth = textTheme.maxLineWidth,
14835
- ellipsis = textTheme.ellipsis,
14836
- textAlign = textTheme.textAlign,
14837
- textBaseline = textTheme.textBaseline,
14838
- fontFamily = textTheme.fontFamily,
14839
- fontSize = textTheme.fontSize,
14840
- fontWeight = textTheme.fontWeight,
14841
- stroke = textTheme.stroke,
14842
- lineWidth = textTheme.lineWidth,
14843
- ignoreBuf = textTheme.ignoreBuf,
14844
- whiteSpace = textTheme.whiteSpace,
14845
- suffixPosition = textTheme.suffixPosition
14846
- } = attribute;
14847
- if ("normal" === whiteSpace) return this.updateWrapAABBBounds(text);
14848
- const buf = ignoreBuf ? 0 : Math.max(2, .075 * fontSize),
14849
- textFontSize = attribute.fontSize || textTheme.fontSize,
14850
- lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, textFontSize)) && void 0 !== _a ? _a : textFontSize + buf;
14851
- if (!this.shouldUpdateShape() && this.cache) {
14852
- width = null !== (_b = this.cache.clipedWidth) && void 0 !== _b ? _b : 0;
14853
- const dx = textDrawOffsetX(textAlign, width),
14854
- dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);
14855
- return this._AABBBounds.set(dx, dy, dx + width, dy + lineHeight), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
14856
- }
14857
- if (Number.isFinite(maxLineWidth)) {
14858
- if (ellipsis) {
14859
- const strEllipsis = !0 === ellipsis ? textTheme.ellipsis : ellipsis,
14860
- data = textMeasure.clipTextWithSuffix(text.toString(), {
14861
- fontSize: fontSize,
14862
- fontWeight: fontWeight,
14863
- fontFamily: fontFamily
14864
- }, maxLineWidth, strEllipsis, !1, suffixPosition);
14865
- str = data.str, width = data.width;
14866
- } else {
14867
- const data = textMeasure.clipText(text.toString(), {
14868
- fontSize: fontSize,
14869
- fontWeight: fontWeight,
14870
- fontFamily: fontFamily
14871
- }, maxLineWidth, !1);
14872
- str = data.str, width = data.width;
14873
- }
14874
- this.cache.clipedText = str, this.cache.clipedWidth = width;
14875
- } else width = textMeasure.measureTextWidth(text.toString(), {
14876
- fontSize: fontSize,
14877
- fontWeight: fontWeight,
14878
- fontFamily: fontFamily
14879
- }), this.cache.clipedText = text.toString(), this.cache.clipedWidth = width;
14880
- this.clearUpdateShapeTag();
14881
- const dx = textDrawOffsetX(textAlign, width);
14882
- let lh = lineHeight;
14883
- application.global && application.global.isSafari() && (lh += .2 * fontSize);
14884
- const dy = textLayoutOffsetY(textBaseline, lh, fontSize, buf);
14885
- return this._AABBBounds.set(dx, dy, dx + width, dy + lh), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
14886
- }
14887
- getBaselineMapAlign() {
14888
- return Text.baselineMapAlign;
14889
- }
14890
- getAlignMapBaseline() {
14891
- return Text.alignMapBaseline;
14892
- }
14893
- updateVerticalSinglelineAABBBounds(text) {
14894
- var _a, _b, _c;
14895
- const textTheme = this.getGraphicTheme(),
14896
- textMeasure = application.graphicUtil.textMeasure;
14897
- let width;
14898
- const attribute = this.attribute,
14899
- {
14900
- ignoreBuf = textTheme.ignoreBuf
14901
- } = attribute,
14902
- buf = ignoreBuf ? 0 : 2,
14903
- {
14904
- maxLineWidth = textTheme.maxLineWidth,
14905
- ellipsis = textTheme.ellipsis,
14906
- fontSize = textTheme.fontSize,
14907
- fontWeight = textTheme.fontWeight,
14908
- fontFamily = textTheme.fontFamily,
14909
- stroke = textTheme.stroke,
14910
- lineWidth = textTheme.lineWidth,
14911
- verticalMode = textTheme.verticalMode,
14912
- suffixPosition = textTheme.suffixPosition
14913
- } = attribute,
14914
- lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
14915
- let {
14916
- textAlign = textTheme.textAlign,
14917
- textBaseline = textTheme.textBaseline
14918
- } = attribute;
14919
- if (!verticalMode) {
14920
- const t = textAlign;
14921
- textAlign = null !== (_b = Text.baselineMapAlign[textBaseline]) && void 0 !== _b ? _b : "left", textBaseline = null !== (_c = Text.alignMapBaseline[t]) && void 0 !== _c ? _c : "top";
14922
- }
14923
- if (!this.shouldUpdateShape() && this.cache) {
14924
- width = this.cache.clipedWidth;
14925
- const dx = textDrawOffsetX(textAlign, width),
14926
- dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);
14927
- return this._AABBBounds.set(dy, dx, dy + lineHeight, dx + width), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
14928
- }
14929
- let verticalList = [verticalLayout(text.toString())];
14930
- if (Number.isFinite(maxLineWidth)) {
14931
- if (ellipsis) {
14932
- const strEllipsis = !0 === ellipsis ? textTheme.ellipsis : ellipsis,
14933
- data = textMeasure.clipTextWithSuffixVertical(verticalList[0], {
14934
- fontSize: fontSize,
14935
- fontWeight: fontWeight,
14936
- fontFamily: fontFamily
14937
- }, maxLineWidth, strEllipsis, !1, suffixPosition);
14938
- verticalList = [data.verticalList], width = data.width;
14939
- } else {
14940
- const data = textMeasure.clipTextVertical(verticalList[0], {
14941
- fontSize: fontSize,
14942
- fontWeight: fontWeight,
14943
- fontFamily: fontFamily
14944
- }, maxLineWidth, !1);
14945
- verticalList = [data.verticalList], width = data.width;
14946
- }
14947
- this.cache.verticalList = verticalList, this.cache.clipedWidth = width;
14948
- } else width = 0, verticalList[0].forEach(t => {
14949
- const w = t.direction === TextDirection.HORIZONTAL ? fontSize : textMeasure.measureTextWidth(t.text, {
14950
- fontSize: fontSize,
14951
- fontWeight: fontWeight,
14952
- fontFamily: fontFamily
14953
- });
14954
- width += w, t.width = w;
14955
- }), this.cache.verticalList = verticalList, this.cache.clipedWidth = width;
14956
- this.clearUpdateShapeTag();
14957
- const dx = textDrawOffsetX(textAlign, width),
14958
- dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);
14959
- return this._AABBBounds.set(dy, dx, dy + lineHeight, dx + width), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
14960
- }
14961
- updateHorizontalMultilineAABBBounds(text) {
14962
- var _a, _b;
14963
- const textTheme = this.getGraphicTheme(),
14964
- {
14965
- wrap = textTheme.wrap
14966
- } = this.attribute;
14967
- if (wrap) return this.updateWrapAABBBounds(text);
14968
- const attribute = this.attribute,
14969
- {
14970
- fontFamily = textTheme.fontFamily,
14971
- textAlign = textTheme.textAlign,
14972
- textBaseline = textTheme.textBaseline,
14973
- fontSize = textTheme.fontSize,
14974
- fontWeight = textTheme.fontWeight,
14975
- ellipsis = textTheme.ellipsis,
14976
- maxLineWidth: maxLineWidth,
14977
- stroke = textTheme.stroke,
14978
- lineWidth = textTheme.lineWidth,
14979
- whiteSpace = textTheme.whiteSpace,
14980
- suffixPosition = textTheme.suffixPosition
14981
- } = attribute,
14982
- lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : attribute.fontSize || textTheme.fontSize;
14983
- if ("normal" === whiteSpace) return this.updateWrapAABBBounds(text);
14984
- if (!this.shouldUpdateShape() && (null === (_b = this.cache) || void 0 === _b ? void 0 : _b.layoutData)) {
14985
- const bbox = this.cache.layoutData.bbox;
14986
- return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
14987
- }
14988
- const textMeasure = application.graphicUtil.textMeasure,
14989
- layoutData = new CanvasTextLayout(fontFamily, {
14990
- fontSize: fontSize,
14991
- fontWeight: fontWeight,
14992
- fontFamily: fontFamily
14993
- }, textMeasure).GetLayoutByLines(text, textAlign, textBaseline, lineHeight, !0 === ellipsis ? textTheme.ellipsis : ellipsis || void 0, !1, maxLineWidth, suffixPosition),
14994
- {
14995
- bbox: bbox
14996
- } = layoutData;
14997
- 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;
14998
- }
14999
14975
  updateVerticalMultilineAABBBounds(text) {
15000
- var _a, _b, _c;
14976
+ var _a, _b;
15001
14977
  const textTheme = this.getGraphicTheme(),
15002
14978
  textMeasure = application.graphicUtil.textMeasure;
15003
14979
  let width;
15004
14980
  const attribute = this.attribute,
15005
- {
15006
- ignoreBuf = textTheme.ignoreBuf
15007
- } = attribute,
15008
- buf = ignoreBuf ? 0 : 2,
15009
14981
  {
15010
14982
  maxLineWidth = textTheme.maxLineWidth,
15011
14983
  ellipsis = textTheme.ellipsis,
@@ -15017,14 +14989,14 @@ class Text extends Graphic {
15017
14989
  verticalMode = textTheme.verticalMode,
15018
14990
  suffixPosition = textTheme.suffixPosition
15019
14991
  } = attribute,
15020
- lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
14992
+ lineHeight = this.getLineHeight(attribute, textTheme);
15021
14993
  let {
15022
14994
  textAlign = textTheme.textAlign,
15023
14995
  textBaseline = textTheme.textBaseline
15024
14996
  } = attribute;
15025
14997
  if (!verticalMode) {
15026
14998
  const t = textAlign;
15027
- textAlign = null !== (_b = Text.baselineMapAlign[textBaseline]) && void 0 !== _b ? _b : "left", textBaseline = null !== (_c = Text.alignMapBaseline[t]) && void 0 !== _c ? _c : "top";
14999
+ textAlign = null !== (_a = Text.baselineMapAlign[textBaseline]) && void 0 !== _a ? _a : "left", textBaseline = null !== (_b = Text.alignMapBaseline[t]) && void 0 !== _b ? _b : "top";
15028
15000
  }
15029
15001
  if (width = 0, !this.shouldUpdateShape() && this.cache) {
15030
15002
  this.cache.verticalList.forEach(item => {
@@ -15072,6 +15044,15 @@ class Text extends Graphic {
15072
15044
  dy = textLayoutOffsetY(textBaseline, height, fontSize);
15073
15045
  return this._AABBBounds.set(dy, dx, dy + height, dx + width), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
15074
15046
  }
15047
+ getMaxWidth(theme) {
15048
+ var _a, _b;
15049
+ const attribute = this.attribute;
15050
+ return null !== (_b = null !== (_a = attribute.maxLineWidth) && void 0 !== _a ? _a : attribute.maxWidth) && void 0 !== _b ? _b : theme.maxWidth;
15051
+ }
15052
+ getLineHeight(attribute, textTheme) {
15053
+ var _a;
15054
+ return null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : attribute.fontSize || textTheme.fontSize;
15055
+ }
15075
15056
  needUpdateTags(keys) {
15076
15057
  let k = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : TEXT_UPDATE_TAG_KEY;
15077
15058
  return super.needUpdateTags(keys, k);
@@ -15086,6 +15067,12 @@ class Text extends Graphic {
15086
15067
  getNoWorkAnimateAttr() {
15087
15068
  return Text.NOWORK_ANIMATE_ATTR;
15088
15069
  }
15070
+ getBaselineMapAlign() {
15071
+ return Text.baselineMapAlign;
15072
+ }
15073
+ getAlignMapBaseline() {
15074
+ return Text.alignMapBaseline;
15075
+ }
15089
15076
  }
15090
15077
  Text.NOWORK_ANIMATE_ATTR = Object.assign({
15091
15078
  ellipsis: 1,
@@ -15164,7 +15151,9 @@ class WrapText extends Text {
15164
15151
  const clip = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
15165
15152
  linesLayout.push({
15166
15153
  str: clip.str,
15167
- width: clip.width
15154
+ width: clip.width,
15155
+ ascent: 0,
15156
+ descent: 0
15168
15157
  });
15169
15158
  break;
15170
15159
  }
@@ -15178,7 +15167,9 @@ class WrapText extends Text {
15178
15167
  }
15179
15168
  if (linesLayout.push({
15180
15169
  str: clip.str,
15181
- width: clip.width
15170
+ width: clip.width,
15171
+ ascent: 0,
15172
+ descent: 0
15182
15173
  }), clip.str.length === str.length) ;else if (needCut) {
15183
15174
  const newStr = str.substring(clip.str.length);
15184
15175
  lines.splice(i + 1, 0, newStr);
@@ -15197,13 +15188,17 @@ class WrapText extends Text {
15197
15188
  const clip = layoutObj.textMeasure.clipTextWithSuffix(lines[i], layoutObj.textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
15198
15189
  linesLayout.push({
15199
15190
  str: clip.str,
15200
- width: clip.width
15191
+ width: clip.width,
15192
+ ascent: 0,
15193
+ descent: 0
15201
15194
  }), lineWidth = Math.max(lineWidth, clip.width);
15202
15195
  break;
15203
15196
  }
15204
15197
  text = lines[i], width = layoutObj.textMeasure.measureTextWidth(text, layoutObj.textOptions, "break-word" === wordBreak), lineWidth = Math.max(lineWidth, width), linesLayout.push({
15205
15198
  str: text,
15206
- width: width
15199
+ width: width,
15200
+ ascent: 0,
15201
+ descent: 0
15207
15202
  });
15208
15203
  }
15209
15204
  bboxWH[0] = lineWidth;
@@ -16380,7 +16375,7 @@ class Paragraph {
16380
16375
  const {
16381
16376
  lineWidth = 1
16382
16377
  } = this.character;
16383
- this.character.stroke && lineWidth && ctx.strokeText(text, left, baseline), 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();
16378
+ 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();
16384
16379
  }
16385
16380
  getWidthWithEllips(direction) {
16386
16381
  let text = this.text;
@@ -16603,18 +16598,12 @@ class Line {
16603
16598
  paragraph.ellipsis = "hide", otherParagraphWidth += paragraph.width;
16604
16599
  }
16605
16600
  }
16606
- this.paragraphs.forEach((paragraph, index) => {
16601
+ this.paragraphs.map((paragraph, index) => {
16607
16602
  if (paragraph instanceof RichTextIcon) return paragraph.setAttributes({
16608
16603
  x: x + paragraph._x,
16609
16604
  y: y + paragraph._y
16610
16605
  }), void drawIcon(paragraph, ctx, x + paragraph._x, y + paragraph._y, this.ascent);
16611
- const b = {
16612
- x1: this.left,
16613
- y1: this.top,
16614
- x2: this.left + this.actualWidth,
16615
- y2: this.top + this.height
16616
- };
16617
- applyStrokeStyle(ctx, paragraph.character), applyFillStyle(ctx, paragraph.character, b), paragraph.draw(ctx, y + this.ascent, x, 0 === index, this.textAlign);
16606
+ paragraph.draw(ctx, y + this.ascent, x, 0 === index, this.textAlign);
16618
16607
  });
16619
16608
  }
16620
16609
  getWidthWithEllips(ellipsis) {
@@ -16637,7 +16626,7 @@ class Line {
16637
16626
  paragraph.ellipsis = "hide", otherParagraphWidth += paragraph.width;
16638
16627
  }
16639
16628
  let width = 0;
16640
- return this.paragraphs.forEach((paragraph, index) => {
16629
+ return this.paragraphs.map((paragraph, index) => {
16641
16630
  width += paragraph instanceof RichTextIcon ? paragraph.width : paragraph.getWidthWithEllips(this.direction);
16642
16631
  }), width;
16643
16632
  }
@@ -18479,13 +18468,15 @@ class DirtyBoundsPlugin {
18479
18468
  graphic.glyphHost && (graphic = graphic.glyphHost), stage && stage === this.pluginService.stage && stage.renderCount && (graphic.isContainer && !graphic.shouldSelfChangeUpdateAABBBounds() || willUpdate && (globalBounds.setValue(bounds.x1, bounds.y1, bounds.x2, bounds.y2), stage.dirty(globalBounds, graphic.parent && graphic.parent.globalTransMatrix)));
18480
18469
  }), application.graphicService.hooks.afterUpdateAABBBounds.tap(this.key, (graphic, stage, bounds, params, selfChange) => {
18481
18470
  stage && stage === this.pluginService.stage && stage.renderCount && (graphic.isContainer && !selfChange || stage.dirty(params.globalAABBBounds));
18471
+ }), application.graphicService.hooks.clearAABBBounds.tap(this.key, (graphic, stage, bounds) => {
18472
+ stage && stage === this.pluginService.stage && stage.renderCount && stage && stage.dirty(bounds);
18482
18473
  }), application.graphicService.hooks.onRemove.tap(this.key, graphic => {
18483
18474
  const stage = graphic.stage;
18484
18475
  stage && stage === this.pluginService.stage && stage.renderCount && stage && stage.dirty(graphic.globalAABBBounds);
18485
18476
  });
18486
18477
  }
18487
18478
  deactivate(context) {
18488
- application.graphicService.hooks.beforeUpdateAABBBounds.taps = application.graphicService.hooks.beforeUpdateAABBBounds.taps.filter(item => item.name !== this.key), application.graphicService.hooks.afterUpdateAABBBounds.taps = application.graphicService.hooks.afterUpdateAABBBounds.taps.filter(item => item.name !== this.key), context.stage.hooks.afterRender.taps = context.stage.hooks.afterRender.taps.filter(item => item.name !== this.key), application.graphicService.hooks.onRemove.taps = application.graphicService.hooks.onRemove.taps.filter(item => item.name !== this.key);
18479
+ application.graphicService.hooks.beforeUpdateAABBBounds.taps = application.graphicService.hooks.beforeUpdateAABBBounds.taps.filter(item => item.name !== this.key), application.graphicService.hooks.afterUpdateAABBBounds.taps = application.graphicService.hooks.afterUpdateAABBBounds.taps.filter(item => item.name !== this.key), application.graphicService.hooks.clearAABBBounds.taps = application.graphicService.hooks.clearAABBBounds.taps.filter(item => item.name !== this.key), context.stage.hooks.afterRender.taps = context.stage.hooks.afterRender.taps.filter(item => item.name !== this.key), application.graphicService.hooks.onRemove.taps = application.graphicService.hooks.onRemove.taps.filter(item => item.name !== this.key);
18489
18480
  }
18490
18481
  }
18491
18482
 
@@ -18601,7 +18592,7 @@ class Stage extends Group {
18601
18592
  constructor() {
18602
18593
  let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
18603
18594
  var _a;
18604
- super({}), this._onVisibleChange = visible => {
18595
+ super({}), this.tickedBeforeRender = !0, this._onVisibleChange = visible => {
18605
18596
  if (!(this._skipRender < 0)) if (visible) {
18606
18597
  if (this.dirtyBounds) {
18607
18598
  const b = this.window.getViewBox();
@@ -18612,7 +18603,10 @@ class Stage extends Group {
18612
18603
  }, this.beforeRender = stage => {
18613
18604
  this._beforeRender && this._beforeRender(stage);
18614
18605
  }, this.afterRender = stage => {
18615
- this.renderCount++, this._afterRender && this._afterRender(stage), this._afterNextRenderCbs && this._afterNextRenderCbs.forEach(cb => cb(stage)), this._afterNextRenderCbs = null;
18606
+ this.renderCount++, this._afterRender && this._afterRender(stage), this._afterNextRenderCbs && this._afterNextRenderCbs.forEach(cb => cb(stage)), this._afterNextRenderCbs = null, this.tickedBeforeRender = !1;
18607
+ }, this.afterTickCb = () => {
18608
+ var _a;
18609
+ this.tickedBeforeRender = !0, "performance" === (null === (_a = this.params.optimize) || void 0 === _a ? void 0 : _a.tickRenderMode) || "rendering" !== this.state && this.render();
18616
18610
  }, this.params = params, this.theme = new Theme(), this.hooks = {
18617
18611
  beforeRender: new SyncHook(["stage"]),
18618
18612
  afterRender: new SyncHook(["stage"])
@@ -18629,7 +18623,7 @@ class Stage extends Group {
18629
18623
  main: !0
18630
18624
  })), this.nextFrameRenderLayerSet = new Set(), this.willNextFrameRender = !1, this.stage = this, this.renderStyle = params.renderStyle, params.autoRender && this.enableAutoRender(), params.autoRefresh && this.enableAutoRefresh(), !1 === params.disableDirtyBounds && this.enableDirtyBounds(), params.enableHtmlAttribute && this.enableHtmlAttribute(params.enableHtmlAttribute), params.ReactDOM && this.enableReactAttribute(params.ReactDOM), params.enableLayout && this.enableLayout(), this.hooks.beforeRender.tap("constructor", this.beforeRender), this.hooks.afterRender.tap("constructor", this.afterRender), this._beforeRender = params.beforeRender, this._afterRender = params.afterRender, this.ticker = params.ticker || defaultTicker, this.supportInteractiveLayer = !1 !== params.interactiveLayer, this.timeline = new DefaultTimeline(), this.ticker.addTimeline(this.timeline), this.timeline.pause(), params.optimize || (params.optimize = {}), this.optmize(params.optimize), params.background && isString$1(this._background) && this._background.includes("/") && this.setAttributes({
18631
18625
  background: this._background
18632
- });
18626
+ }), this.ticker.on("afterTick", this.afterTickCb);
18633
18627
  }
18634
18628
  pauseRender() {
18635
18629
  let sr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1;
@@ -18858,7 +18852,7 @@ class Stage extends Group {
18858
18852
  if ("released" === this.releaseStatus) return;
18859
18853
  this.ticker.start(), this.timeline.resume();
18860
18854
  const state = this.state;
18861
- 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++;
18855
+ 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++;
18862
18856
  }
18863
18857
  combineLayersToWindow() {
18864
18858
  if ("harmony" === this.global.env) {
@@ -18964,7 +18958,7 @@ class Stage extends Group {
18964
18958
  layer.release();
18965
18959
  }), this.interactiveLayer && (this.interactiveLayer.forEachChildren(item => {
18966
18960
  item.setStage && item.setStage(null, null), this.interactiveLayer.removeChild(item);
18967
- }), this.interactiveLayer.release()), this.window.release(), this.ticker.remTimeline(this.timeline), this.renderService.renderTreeRoots = [];
18961
+ }), this.interactiveLayer.release()), this.window.release(), this.ticker.remTimeline(this.timeline), this.ticker.removeListener("afterTick", this.afterTickCb), this.renderService.renderTreeRoots = [];
18968
18962
  }
18969
18963
  setStage(stage) {}
18970
18964
  dirty(b, matrix) {
@@ -19042,8 +19036,6 @@ function createStage(params) {
19042
19036
  return new Stage(params);
19043
19037
  }
19044
19038
 
19045
- const strCommandMap = ["arc", "arcTo", "bezierCurveTo", "closePath", "ellipse", "lineTo", "moveTo", "quadraticCurveTo", "rect"];
19046
-
19047
19039
  var __decorate$1d = undefined && undefined.__decorate || function (decorators, target, key, desc) {
19048
19040
  var d,
19049
19041
  c = arguments.length,
@@ -28629,7 +28621,7 @@ const registerWrapText = _registerWrapText;
28629
28621
 
28630
28622
  const roughModule = _roughModule;
28631
28623
 
28632
- const version = "0.20.16";
28624
+ const version = "0.21.0-alpha.10";
28633
28625
  preLoadAllModule();
28634
28626
  if (isBrowserEnv()) {
28635
28627
  loadBrowserEnv(container);
@@ -28662,4 +28654,4 @@ registerReactAttributePlugin();
28662
28654
  registerDirectionalLight();
28663
28655
  registerOrthoCamera();
28664
28656
 
28665
- export { ACustomAnimate, ARC3D_NUMBER_TYPE, ARC_NUMBER_TYPE, AREA_NUMBER_TYPE, AbstractGraphicRender, Animate, AnimateGroup, AnimateGroup1, AnimateMode, AnimateStatus, AnimateStepType, Application, Arc, Arc3d, Arc3dRender, ArcRender, ArcRenderContribution, Area, AreaRender, AreaRenderContribution, AttributeAnimate, AttributeUpdateType, AutoEnablePlugins, BaseCanvas, BaseEnvContribution, BaseRender, BaseRenderContributionTime, BaseWindowHandlerContribution, Basis, BeforeRenderConstribution, BoundsContext, BoundsPicker, BrowserEnvContribution, CIRCLE_NUMBER_TYPE, Canvas3DDrawItemInterceptor, Canvas3DPickItemInterceptor, CanvasArc3dPicker, CanvasArcPicker, CanvasAreaPicker, CanvasCirclePicker, CanvasFactory, CanvasGlyphPicker, CanvasGroupPicker, CanvasImagePicker, CanvasLinePicker, CanvasPathPicker, CanvasPickerContribution, CanvasPolygonPicker, CanvasPyramid3dPicker, CanvasRect3dPicker, CanvasRectPicker, CanvasRichTextPicker, CanvasSymbolPicker, CanvasTextLayout, CanvasTextPicker, CbAnimate, Circle, CircleRender, CircleRenderContribution, ClipAngleAnimate, ClipDirectionAnimate, ClipGraphicAnimate, ClipRadiusAnimate, ColorInterpolate, ColorStore, ColorType, CommonDrawItemInterceptorContribution, CommonRenderContribution, Container, ContainerModule, Context2dFactory, ContributionProvider, CurveContext, CurveTypeEnum, CustomEvent, CustomPath2D, CustomSymbolClass, DebugDrawItemInterceptorContribution, DefaultArcAllocate, DefaultArcAttribute, DefaultArcRenderContribution, DefaultAreaAllocate, DefaultAreaAttribute, DefaultAreaTextureRenderContribution, DefaultAttribute, DefaultBaseBackgroundRenderContribution, DefaultBaseInteractiveRenderContribution, DefaultBaseTextureRenderContribution, DefaultCanvasAllocate, DefaultCanvasArcRender, DefaultCanvasAreaRender, DefaultCanvasCircleRender, DefaultCanvasGroupRender, DefaultCanvasImageRender, DefaultCanvasLineRender, DefaultCanvasPathRender, DefaultCanvasPolygonRender, DefaultCanvasRectRender, DefaultCanvasSymbolRender, DefaultCanvasTextRender, DefaultCircleAllocate, DefaultCircleAttribute, DefaultCircleRenderContribution, DefaultConnectAttribute, DefaultDebugAttribute, DefaultFillStyle, DefaultGlobal, DefaultGlobalPickerService, DefaultGlyphAttribute, DefaultGraphicAllocate, DefaultGraphicMemoryManager, DefaultGraphicService, DefaultGraphicUtil, DefaultGroupAttribute, DefaultGroupBackgroundRenderContribution, DefaultImageAttribute, DefaultImageBackgroundRenderContribution, DefaultImageRenderContribution, DefaultLayerService, DefaultLayout, DefaultLineAllocate, DefaultLineAttribute, DefaultMat4Allocate, DefaultMatrixAllocate, DefaultMorphingAnimateConfig, DefaultPathAllocate, DefaultPathAttribute, DefaultPickService, DefaultPickStyle, DefaultPolygonAttribute, DefaultRect3dAttribute, DefaultRectAllocate, DefaultRectAttribute, DefaultRectRenderContribution, DefaultRenderService, DefaultRichTextAttribute, DefaultRichTextIconAttribute, DefaultStateAnimateConfig, DefaultStrokeStyle, DefaultStyle, DefaultSymbolAllocate, DefaultSymbolAttribute, DefaultSymbolRenderContribution, DefaultTextAllocate, DefaultTextAttribute, DefaultTextMeasureContribution, DefaultTextStyle, DefaultTicker, DefaultTimeline, DefaultTransform, DefaultTransformUtil, DefaultWindow, Direction$1 as Direction, DirectionalLight, DragNDrop, DrawContribution, DrawItemInterceptor, DynamicLayerHandlerContribution, Edge, EmptyContext2d, EnvContribution, EventManager, EventSystem, EventTarget, FORMAT_ELEMENT_COMMAND, FORMAT_TEXT_COMMAND, Factory, FadeInPlus, FederatedEvent, FederatedMouseEvent, FederatedPointerEvent, FederatedWheelEvent, FlexLayoutPlugin, Fragment, GLYPH_NUMBER_TYPE, GRAPHIC_UPDATE_TAG_KEY, GROUP_NUMBER_TYPE, Generator, Gesture, GlobalPickerService, Glyph, GlyphRender, Graphic, GraphicAnimate, GraphicCreator$1 as GraphicCreator, GraphicPicker, GraphicRender, GraphicService, GraphicUtil, Group, GroupFadeIn, GroupFadeOut, GroupRender, GroupRenderContribution, GroupUpdateAABBBoundsMode, HtmlAttributePlugin, IContainPointMode, IMAGE_NUMBER_TYPE, Image, ImageRender, ImageRenderContribution, IncreaseCount, IncrementalDrawContribution, InputText, InteractiveDrawItemInterceptorContribution, InteractivePickItemInterceptorContribution, InteractiveSubRenderContribution, LINE_NUMBER_TYPE, Layer, LayerService, Line$1 as Line, LineRender, Linear, LinearClosed, ManualTickHandler, ManualTicker, Mat4Allocate, MathArcPicker, MathAreaPicker, MathCirclePicker, MathGlyphPicker, MathImagePicker, MathLinePicker, MathPathPicker, MathPickerContribution, MathPolygonPicker, MathRectPicker, MathSymbolPicker, MathTextPicker, MatrixAllocate, Meteor, MonotoneX, MonotoneY, MorphingPath, MotionPath, MultiToOneMorphingPath, NOWORK_ANIMATE_ATTR, Node, OrthoCamera, PATH_NUMBER_TYPE, POLYGON_NUMBER_TYPE, PURE_STYLE_KEY, PYRAMID3D_NUMBER_TYPE, Path, PathRender, PathRenderContribution, PickItemInterceptor, PickerService, PluginService, Polygon, PolygonRender, PolygonRenderContribution, Pyramid3d, Pyramid3dRender, RAFTickHandler, REACT_TO_CANOPUS_EVENTS, REACT_TO_CANOPUS_EVENTS_LIST, RECT3D_NUMBER_TYPE, RECT_NUMBER_TYPE, RICHTEXT_NUMBER_TYPE, RafBasedSTO, ReactAttributePlugin, Rect, Rect3DRender, Rect3d, RectRender, RectRenderContribution, ReflectSegContext, RenderSelector, RenderService, ResourceLoader, RichText, RichTextEditPlugin, RichTextRender, RotateBySphereAnimate, SVG_ATTRIBUTE_MAP, SVG_ATTRIBUTE_MAP_KEYS, SVG_PARSE_ATTRIBUTE_MAP, SVG_PARSE_ATTRIBUTE_MAP_KEYS, SYMBOL_NUMBER_TYPE, SegContext, ShadowRoot, ShadowRootDrawItemInterceptorContribution, ShadowRootPickItemInterceptorContribution, SplitRectAfterRenderContribution, SplitRectBeforeRenderContribution, Stage, StaticLayerHandlerContribution, Step$1 as Step, StreamLight, SubAnimate, Symbol$1 as Symbol, SymbolRender, SymbolRenderContribution, TEXT_NUMBER_TYPE, TagPointsUpdate, Text, TextDirection, TextMeasureContribution, TextRender, TextRenderContribution, Theme, TimeOutTickHandler, TransformUtil, UpdateTag, VArc, VArc3d, VArea, VCircle, VGlobal, VGlyph, VGroup, VImage, VLine, VPath, VPolygon, VPyramid3d, VRect, VRect3d, VRichText, VSymbol, VText, VWindow, ViewTransform3dPlugin, VirtualLayerHandlerContribution, WILDCARD, WindowHandlerContribution, WrapText, XMLParser, _interpolateColor, _registerArc, addArcToBezierPath$1 as addArcToBezierPath, addAttributeToPrototype, alignBezierCurves, alignSubpath, application, applyTransformOnBezierCurves, arc3dCanvasPickModule, arc3dModule, arcCanvasPickModule, arcMathPickModule, arcModule, areaCanvasPickModule, areaMathPickModule, areaModule, bezier, bezierCurversToPath, binarySplitPolygon, bindContributionProvider, bindContributionProviderNoSingletonScope, boundStroke, browserEnvModule, builtInSymbolStrMap, builtinSymbols, builtinSymbolsMap, calcLineCache, calculateArcCornerRadius, calculateLineHeight, canvasAllocate, centroidOfSubpath, circleBounds, circleCanvasPickModule, circleMathPickModule, circleModule, clock, cloneGraphic, colorEqual, colorStringInterpolationToStr, container, cornerTangents, createArc, createArc3d, createArea, createCircle, createColor, createConicalGradient, createGlyph, createGroup, createImage, createImageElement$1 as createImageElement, createLine, createMat4, createPath, createPolygon, createPyramid3d, createRect, createRect3d, createRectPath, createRichText, createShadowRoot, createStage, createSymbol, createText, createWrapText, cubicCalc, cubicLength, cubicPointAt, cubicSubdivide, decodeReactDom, defaultArcAllocate, defaultArcBackgroundRenderContribution, defaultArcRenderContribution, defaultArcTextureRenderContribution, defaultAreaAllocate, defaultBaseBackgroundRenderContribution, defaultBaseTextureRenderContribution, defaultCircleAllocate, defaultCircleBackgroundRenderContribution, defaultCircleRenderContribution, defaultCircleTextureRenderContribution, defaultGraphicMemoryManager, defaultGroupBackgroundRenderContribution, defaultImageBackgroundRenderContribution, defaultImageRenderContribution, defaultLineAllocate, defaultPathAllocate, defaultRectAllocate, defaultRectBackgroundRenderContribution, defaultRectRenderContribution, defaultRectTextureRenderContribution, defaultSymbolAllocate, defaultSymbolBackgroundRenderContribution, defaultSymbolRenderContribution, defaultSymbolTextureRenderContribution, defaultTextAllocate, defaultTicker, defaultTimeline, drawArc, drawArcPath$1 as drawArcPath, drawAreaSegments, drawIncrementalAreaSegments, drawIncrementalSegments, drawPathProxy, drawSegments, enumCommandMap, feishuEnvModule, fillVisible, findBestMorphingRotation, findNextGraphic, flatten_simplify, foreach, foreachAsync, genBasisSegments, genBasisTypeSegments, genLinearClosedSegments, genLinearClosedTypeSegments, genLinearSegments, genLinearTypeSegments, genMonotoneXSegments, genMonotoneXTypeSegments, genMonotoneYSegments, genMonotoneYTypeSegments, genNumberType, genStepSegments, genStepTypeSegments, getAttributeFromDefaultAttrList, getConicGradientAt, getCurrentEnv, getExtraModelMatrix, getModelMatrix, getRichTextBounds, getScaledStroke, getTextBounds, getTheme, getThemeFromGroup, globalTheme, glyphCanvasPickModule, glyphMathPickModule, glyphModule, graphicCreator, graphicService, graphicUtil, harmonyEnvModule, identityMat4, imageCanvasPickModule, imageMathPickModule, imageModule, incrementalAddTo, initAllEnv, initBrowserEnv, initFeishuEnv, initHarmonyEnv, initLynxEnv, initNodeEnv, initTTEnv, initTaroEnv, initWxEnv, inject, injectable, interpolateColor, interpolateGradientConicalColor, interpolateGradientLinearColor, interpolateGradientRadialColor, interpolatePureColorArray, intersect, isBrowserEnv, isNodeEnv, isSvg, isTransformKey, isXML, jsx, layerService, lineCanvasPickModule, lineMathPickModule, lineModule, loadAllEnv, loadAllModule, loadBrowserEnv, loadFeishuEnv, loadHarmonyEnv, loadLynxEnv, loadNodeEnv, loadTTEnv, loadTaroEnv, loadWxEnv, lookAt, lynxEnvModule, mat3Tomat4, mat4Allocate, matrixAllocate, morphPath, multiInject, multiToOneMorph, multiplyMat4Mat3, multiplyMat4Mat4, named, newThemeObj, nodeEnvModule, oneToMultiMorph, ortho, parsePadding, parseStroke, parseSvgPath, pathCanvasPickModule, pathMathPickModule, pathModule, pathToBezierCurves, point$3 as point, pointEqual, pointInterpolation, pointInterpolationHighPerformance, pointsEqual, pointsInterpolation, polygonCanvasPickModule, polygonMathPickModule, polygonModule, preLoadAllModule, pyramid3dCanvasPickModule, pyramid3dModule, rafBasedSto, rect3dCanvasPickModule, rect3dModule, rectCanvasPickModule, rectFillVisible, rectMathPickModule, rectModule, rectStrokeVisible, recursiveCallBinarySplit, registerArc, registerArc3d, registerArc3dGraphic, registerArcGraphic, registerArea, registerAreaGraphic, registerCircle, registerCircleGraphic, registerDirectionalLight, registerFlexLayoutPlugin, registerGlyph, registerGlyphGraphic, registerGroup, registerGroupGraphic, registerHtmlAttributePlugin, registerImage, registerImageGraphic, registerLine, registerLineGraphic, registerOrthoCamera, registerPath, registerPathGraphic, registerPolygon, registerPolygonGraphic, registerPyramid3d, registerPyramid3dGraphic, registerReactAttributePlugin, registerRect, registerRect3d, registerRect3dGraphic, registerRectGraphic, registerRichtext, registerRichtextGraphic, registerShadowRoot, registerShadowRootGraphic, registerSymbol, registerSymbolGraphic, registerText, registerTextGraphic, registerViewTransform3dPlugin, registerWrapText, registerWrapTextGraphic, renderCommandList, rewriteProto, richTextMathPickModule, richtextCanvasPickModule, richtextModule, rotateX, rotateY, rotateZ, roughModule, runFill, runStroke, scaleMat4, segments, shouldUseMat4, snapLength, splitArc, splitArea, splitCircle, splitGraphic, splitLine, splitPath, splitPolygon, splitRect, splitToGrids, strCommandMap, strokeVisible, symbolCanvasPickModule, symbolMathPickModule, symbolModule, taroEnvModule, textAttributesToStyle, textCanvasPickModule, textDrawOffsetX, textDrawOffsetY, textLayoutOffsetY, textMathPickModule, textModule, transformKeys, transformMat4, transformUtil, translate, ttEnvModule, version, verticalLayout, vglobal, waitForAllSubLayers, wrapCanvas, wrapContext, wxEnvModule, xul };
28657
+ export { ACustomAnimate, ARC3D_NUMBER_TYPE, ARC_NUMBER_TYPE, AREA_NUMBER_TYPE, AbstractGraphicRender, Animate, AnimateGroup, AnimateGroup1, AnimateMode, AnimateStatus, AnimateStepType, Application, Arc, Arc3d, Arc3dRender, ArcRender, ArcRenderContribution, Area, AreaRender, AreaRenderContribution, AttributeAnimate, AttributeUpdateType, AutoEnablePlugins, BaseCanvas, BaseEnvContribution, BaseRender, BaseRenderContributionTime, BaseWindowHandlerContribution, Basis, BeforeRenderConstribution, BoundsContext, BoundsPicker, BrowserEnvContribution, CIRCLE_NUMBER_TYPE, Canvas3DDrawItemInterceptor, Canvas3DPickItemInterceptor, CanvasArc3dPicker, CanvasArcPicker, CanvasAreaPicker, CanvasCirclePicker, CanvasFactory, CanvasGlyphPicker, CanvasGroupPicker, CanvasImagePicker, CanvasLinePicker, CanvasPathPicker, CanvasPickerContribution, CanvasPolygonPicker, CanvasPyramid3dPicker, CanvasRect3dPicker, CanvasRectPicker, CanvasRichTextPicker, CanvasSymbolPicker, CanvasTextLayout, CanvasTextPicker, CbAnimate, Circle, CircleRender, CircleRenderContribution, ClipAngleAnimate, ClipDirectionAnimate, ClipGraphicAnimate, ClipRadiusAnimate, ColorInterpolate, ColorStore, ColorType, CommonDrawItemInterceptorContribution, CommonRenderContribution, Container, ContainerModule, Context2dFactory, ContributionProvider, CurveContext, CurveTypeEnum, CustomEvent, CustomPath2D, CustomSymbolClass, DebugDrawItemInterceptorContribution, DefaultArcAllocate, DefaultArcAttribute, DefaultArcRenderContribution, DefaultAreaAllocate, DefaultAreaAttribute, DefaultAreaTextureRenderContribution, DefaultAttribute, DefaultBaseBackgroundRenderContribution, DefaultBaseInteractiveRenderContribution, DefaultBaseTextureRenderContribution, DefaultCanvasAllocate, DefaultCanvasArcRender, DefaultCanvasAreaRender, DefaultCanvasCircleRender, DefaultCanvasGroupRender, DefaultCanvasImageRender, DefaultCanvasLineRender, DefaultCanvasPathRender, DefaultCanvasPolygonRender, DefaultCanvasRectRender, DefaultCanvasSymbolRender, DefaultCanvasTextRender, DefaultCircleAllocate, DefaultCircleAttribute, DefaultCircleRenderContribution, DefaultConnectAttribute, DefaultDebugAttribute, DefaultFillStyle, DefaultGlobal, DefaultGlobalPickerService, DefaultGlyphAttribute, DefaultGraphicAllocate, DefaultGraphicMemoryManager, DefaultGraphicService, DefaultGraphicUtil, DefaultGroupAttribute, DefaultGroupBackgroundRenderContribution, DefaultImageAttribute, DefaultImageBackgroundRenderContribution, DefaultImageRenderContribution, DefaultLayerService, DefaultLayout, DefaultLineAllocate, DefaultLineAttribute, DefaultMat4Allocate, DefaultMatrixAllocate, DefaultMorphingAnimateConfig, DefaultPathAllocate, DefaultPathAttribute, DefaultPickService, DefaultPickStyle, DefaultPolygonAttribute, DefaultRect3dAttribute, DefaultRectAllocate, DefaultRectAttribute, DefaultRectRenderContribution, DefaultRenderService, DefaultRichTextAttribute, DefaultRichTextIconAttribute, DefaultStateAnimateConfig, DefaultStrokeStyle, DefaultStyle, DefaultSymbolAllocate, DefaultSymbolAttribute, DefaultSymbolRenderContribution, DefaultTextAllocate, DefaultTextAttribute, DefaultTextMeasureContribution, DefaultTextStyle, DefaultTicker, DefaultTimeline, DefaultTransform, DefaultTransformUtil, DefaultWindow, Direction$1 as Direction, DirectionalLight, DragNDrop, DrawContribution, DrawItemInterceptor, DynamicLayerHandlerContribution, Edge, EmptyContext2d, EnvContribution, EventManager, EventSystem, EventTarget, FORMAT_ELEMENT_COMMAND, FORMAT_TEXT_COMMAND, Factory, FadeInPlus, FederatedEvent, FederatedMouseEvent, FederatedPointerEvent, FederatedWheelEvent, FlexLayoutPlugin, Fragment, GLYPH_NUMBER_TYPE, GRAPHIC_UPDATE_TAG_KEY, GROUP_NUMBER_TYPE, Generator, Gesture, GlobalPickerService, Glyph, GlyphRender, Graphic, GraphicAnimate, GraphicCreator$1 as GraphicCreator, GraphicPicker, GraphicRender, GraphicService, GraphicUtil, Group, GroupFadeIn, GroupFadeOut, GroupRender, GroupRenderContribution, GroupUpdateAABBBoundsMode, HtmlAttributePlugin, IContainPointMode, IMAGE_NUMBER_TYPE, Image, ImageRender, ImageRenderContribution, IncreaseCount, IncrementalDrawContribution, InputText, InteractiveDrawItemInterceptorContribution, InteractivePickItemInterceptorContribution, InteractiveSubRenderContribution, LINE_NUMBER_TYPE, Layer, LayerService, Line$1 as Line, LineRender, Linear, LinearClosed, ManualTickHandler, ManualTicker, Mat4Allocate, MathArcPicker, MathAreaPicker, MathCirclePicker, MathGlyphPicker, MathImagePicker, MathLinePicker, MathPathPicker, MathPickerContribution, MathPolygonPicker, MathRectPicker, MathSymbolPicker, MathTextPicker, MatrixAllocate, MeasureModeEnum, Meteor, MonotoneX, MonotoneY, MorphingPath, MotionPath, MultiToOneMorphingPath, NOWORK_ANIMATE_ATTR, Node, OrthoCamera, PATH_NUMBER_TYPE, POLYGON_NUMBER_TYPE, PURE_STYLE_KEY, PYRAMID3D_NUMBER_TYPE, Path, PathRender, PathRenderContribution, PickItemInterceptor, PickerService, PluginService, Polygon, PolygonRender, PolygonRenderContribution, Pyramid3d, Pyramid3dRender, RAFTickHandler, REACT_TO_CANOPUS_EVENTS, REACT_TO_CANOPUS_EVENTS_LIST, RECT3D_NUMBER_TYPE, RECT_NUMBER_TYPE, RICHTEXT_NUMBER_TYPE, RafBasedSTO, ReactAttributePlugin, Rect, Rect3DRender, Rect3d, RectRender, RectRenderContribution, ReflectSegContext, RenderSelector, RenderService, ResourceLoader, RichText, RichTextEditPlugin, RichTextRender, RotateBySphereAnimate, SVG_ATTRIBUTE_MAP, SVG_ATTRIBUTE_MAP_KEYS, SVG_PARSE_ATTRIBUTE_MAP, SVG_PARSE_ATTRIBUTE_MAP_KEYS, SYMBOL_NUMBER_TYPE, SegContext, ShadowRoot, ShadowRootDrawItemInterceptorContribution, ShadowRootPickItemInterceptorContribution, SplitRectAfterRenderContribution, SplitRectBeforeRenderContribution, Stage, StaticLayerHandlerContribution, Step$1 as Step, StreamLight, SubAnimate, Symbol$1 as Symbol, SymbolRender, SymbolRenderContribution, TEXT_NUMBER_TYPE, TagPointsUpdate, Text, TextDirection, TextMeasureContribution, TextRender, TextRenderContribution, Theme, TimeOutTickHandler, TransformUtil, UpdateTag, VArc, VArc3d, VArea, VCircle, VGlobal, VGlyph, VGroup, VImage, VLine, VPath, VPolygon, VPyramid3d, VRect, VRect3d, VRichText, VSymbol, VText, VWindow, ViewTransform3dPlugin, VirtualLayerHandlerContribution, WILDCARD, WindowHandlerContribution, WrapText, XMLParser, _interpolateColor, _registerArc, addArcToBezierPath$1 as addArcToBezierPath, addAttributeToPrototype, alignBezierCurves, alignSubpath, application, applyTransformOnBezierCurves, arc3dCanvasPickModule, arc3dModule, arcCanvasPickModule, arcMathPickModule, arcModule, areaCanvasPickModule, areaMathPickModule, areaModule, bezier, bezierCurversToPath, binarySplitPolygon, bindContributionProvider, bindContributionProviderNoSingletonScope, boundStroke, browserEnvModule, builtInSymbolStrMap, builtinSymbols, builtinSymbolsMap, calcLineCache, calculateArcCornerRadius, calculateLineHeight, canvasAllocate, centroidOfSubpath, circleBounds, circleCanvasPickModule, circleMathPickModule, circleModule, clock, cloneGraphic, colorEqual, colorStringInterpolationToStr, container, cornerTangents, createArc, createArc3d, createArea, createCircle, createColor, createConicalGradient, createGlyph, createGroup, createImage, createImageElement$1 as createImageElement, createLine, createMat4, createPath, createPolygon, createPyramid3d, createRect, createRect3d, createRectPath, createRichText, createShadowRoot, createStage, createSymbol, createText, createWrapText, cubicCalc, cubicLength, cubicPointAt, cubicSubdivide, decodeReactDom, defaultArcAllocate, defaultArcBackgroundRenderContribution, defaultArcRenderContribution, defaultArcTextureRenderContribution, defaultAreaAllocate, defaultBaseBackgroundRenderContribution, defaultBaseTextureRenderContribution, defaultCircleAllocate, defaultCircleBackgroundRenderContribution, defaultCircleRenderContribution, defaultCircleTextureRenderContribution, defaultGraphicMemoryManager, defaultGroupBackgroundRenderContribution, defaultImageBackgroundRenderContribution, defaultImageRenderContribution, defaultLineAllocate, defaultPathAllocate, defaultRectAllocate, defaultRectBackgroundRenderContribution, defaultRectRenderContribution, defaultRectTextureRenderContribution, defaultSymbolAllocate, defaultSymbolBackgroundRenderContribution, defaultSymbolRenderContribution, defaultSymbolTextureRenderContribution, defaultTextAllocate, defaultTicker, defaultTimeline, drawArc, drawArcPath$1 as drawArcPath, drawAreaSegments, drawIncrementalAreaSegments, drawIncrementalSegments, drawPathProxy, drawSegments, enumCommandMap, feishuEnvModule, fillVisible, findBestMorphingRotation, findNextGraphic, flatten_simplify, foreach, foreachAsync, genBasisSegments, genBasisTypeSegments, genLinearClosedSegments, genLinearClosedTypeSegments, genLinearSegments, genLinearTypeSegments, genMonotoneXSegments, genMonotoneXTypeSegments, genMonotoneYSegments, genMonotoneYTypeSegments, genNumberType, genStepSegments, genStepTypeSegments, getAttributeFromDefaultAttrList, getConicGradientAt, getCurrentEnv, getExtraModelMatrix, getModelMatrix, getRichTextBounds, getScaledStroke, getTextBounds, getTheme, getThemeFromGroup, globalTheme, glyphCanvasPickModule, glyphMathPickModule, glyphModule, graphicCreator, graphicService, graphicUtil, harmonyEnvModule, identityMat4, imageCanvasPickModule, imageMathPickModule, imageModule, incrementalAddTo, initAllEnv, initBrowserEnv, initFeishuEnv, initHarmonyEnv, initLynxEnv, initNodeEnv, initTTEnv, initTaroEnv, initWxEnv, inject, injectable, interpolateColor, interpolateGradientConicalColor, interpolateGradientLinearColor, interpolateGradientRadialColor, interpolatePureColorArray, intersect, isBrowserEnv, isNodeEnv, isSvg, isTransformKey, isXML, jsx, layerService, lineCanvasPickModule, lineMathPickModule, lineModule, loadAllEnv, loadAllModule, loadBrowserEnv, loadFeishuEnv, loadHarmonyEnv, loadLynxEnv, loadNodeEnv, loadTTEnv, loadTaroEnv, loadWxEnv, lookAt, lynxEnvModule, mat3Tomat4, mat4Allocate, matrixAllocate, morphPath, multiInject, multiToOneMorph, multiplyMat4Mat3, multiplyMat4Mat4, named, newThemeObj, nodeEnvModule, oneToMultiMorph, ortho, parsePadding, parseStroke, parseSvgPath, pathCanvasPickModule, pathMathPickModule, pathModule, pathToBezierCurves, point$3 as point, pointEqual, pointInterpolation, pointInterpolationHighPerformance, pointsEqual, pointsInterpolation, polygonCanvasPickModule, polygonMathPickModule, polygonModule, preLoadAllModule, pyramid3dCanvasPickModule, pyramid3dModule, rafBasedSto, rect3dCanvasPickModule, rect3dModule, rectCanvasPickModule, rectFillVisible, rectMathPickModule, rectModule, rectStrokeVisible, recursiveCallBinarySplit, registerArc, registerArc3d, registerArc3dGraphic, registerArcGraphic, registerArea, registerAreaGraphic, registerCircle, registerCircleGraphic, registerDirectionalLight, registerFlexLayoutPlugin, registerGlyph, registerGlyphGraphic, registerGroup, registerGroupGraphic, registerHtmlAttributePlugin, registerImage, registerImageGraphic, registerLine, registerLineGraphic, registerOrthoCamera, registerPath, registerPathGraphic, registerPolygon, registerPolygonGraphic, registerPyramid3d, registerPyramid3dGraphic, registerReactAttributePlugin, registerRect, registerRect3d, registerRect3dGraphic, registerRectGraphic, registerRichtext, registerRichtextGraphic, registerShadowRoot, registerShadowRootGraphic, registerSymbol, registerSymbolGraphic, registerText, registerTextGraphic, registerViewTransform3dPlugin, registerWrapText, registerWrapTextGraphic, renderCommandList, rewriteProto, richTextMathPickModule, richtextCanvasPickModule, richtextModule, rotateX, rotateY, rotateZ, roughModule, runFill, runStroke, scaleMat4, segments, shouldUseMat4, snapLength, splitArc, splitArea, splitCircle, splitGraphic, splitLine, splitPath, splitPolygon, splitRect, splitToGrids, strCommandMap, strokeVisible, symbolCanvasPickModule, symbolMathPickModule, symbolModule, taroEnvModule, textAttributesToStyle, textCanvasPickModule, textDrawOffsetX, textDrawOffsetY, textLayoutOffsetY, textMathPickModule, textModule, transformKeys, transformMat4, transformUtil, translate, ttEnvModule, version, verticalLayout, vglobal, waitForAllSubLayers, wrapCanvas, wrapContext, wxEnvModule, xul };