@visactor/vrender-core 0.20.6-beta.0 → 0.20.7-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/cjs/animate/custom-animate.js +2 -2
  2. package/cjs/animate/custom-animate.js.map +1 -1
  3. package/cjs/graphic/arc.js +2 -1
  4. package/cjs/graphic/arc.js.map +1 -1
  5. package/cjs/graphic/glyph.js +1 -1
  6. package/cjs/graphic/glyph.js.map +1 -1
  7. package/cjs/graphic/graphic.d.ts +7 -1
  8. package/cjs/graphic/graphic.js +30 -15
  9. package/cjs/graphic/graphic.js.map +1 -1
  10. package/cjs/graphic/group.js +1 -0
  11. package/cjs/graphic/group.js.map +1 -1
  12. package/cjs/graphic/text.d.ts +3 -1
  13. package/cjs/graphic/text.js +21 -0
  14. package/cjs/graphic/text.js.map +1 -1
  15. package/cjs/interface/graphic.d.ts +2 -1
  16. package/cjs/interface/graphic.js.map +1 -1
  17. package/cjs/render/contributions/render/draw-interceptor.js +3 -1
  18. package/cjs/render/contributions/render/draw-interceptor.js.map +1 -1
  19. package/dist/index.es.js +66 -6
  20. package/es/animate/custom-animate.js +2 -2
  21. package/es/animate/custom-animate.js.map +1 -1
  22. package/es/graphic/arc.js +2 -1
  23. package/es/graphic/arc.js.map +1 -1
  24. package/es/graphic/glyph.js +1 -1
  25. package/es/graphic/glyph.js.map +1 -1
  26. package/es/graphic/graphic.d.ts +7 -1
  27. package/es/graphic/graphic.js +17 -1
  28. package/es/graphic/graphic.js.map +1 -1
  29. package/es/graphic/group.js +1 -0
  30. package/es/graphic/group.js.map +1 -1
  31. package/es/graphic/text.d.ts +3 -1
  32. package/es/graphic/text.js +22 -1
  33. package/es/graphic/text.js.map +1 -1
  34. package/es/interface/graphic.d.ts +2 -1
  35. package/es/interface/graphic.js.map +1 -1
  36. package/es/render/contributions/render/draw-interceptor.js +3 -1
  37. package/es/render/contributions/render/draw-interceptor.js.map +1 -1
  38. package/package.json +4 -4
@@ -1,5 +1,5 @@
1
1
  import type { ICustomPath2D } from './../interface/path';
2
- import type { Dict, IPointLike, IAABBBounds } from '@visactor/vutils';
2
+ import type { Dict, IPointLike, IAABBBounds, IOBBBounds } from '@visactor/vutils';
3
3
  import { Matrix, Point } from '@visactor/vutils';
4
4
  import type { GraphicType, IAnimateConfig, IGraphicAttribute, IGraphic, IGraphicAnimateParams, IGraphicJson, ISetAttributeContext, ITransform, GraphicReleaseStatus } from '../interface/graphic';
5
5
  import { Node } from './node-tree';
@@ -61,6 +61,8 @@ export declare abstract class Graphic<T extends Partial<IGraphicAttribute> = Par
61
61
  in3dMode?: boolean;
62
62
  protected _AABBBounds: IAABBBounds;
63
63
  get AABBBounds(): IAABBBounds;
64
+ protected _OBBBounds?: IOBBBounds;
65
+ get OBBBounds(): IOBBBounds;
64
66
  protected _globalAABBBounds: IAABBBounds;
65
67
  get globalAABBBounds(): IAABBBounds;
66
68
  protected _transMatrix: Matrix;
@@ -83,6 +85,8 @@ export declare abstract class Graphic<T extends Partial<IGraphicAttribute> = Par
83
85
  finalAttrs?: T;
84
86
  pathProxy?: ICustomPath2D;
85
87
  attachedThemeGraphic?: IGraphic;
88
+ protected updateAABBBoundsStamp: number;
89
+ protected updateOBBBoundsStamp?: number;
86
90
  constructor(params?: T);
87
91
  setMode(mode: '2d' | '3d'): void;
88
92
  set3dMode(): void;
@@ -90,8 +94,10 @@ export declare abstract class Graphic<T extends Partial<IGraphicAttribute> = Par
90
94
  getOffsetXY(attr?: ITransform, includeScroll?: boolean): Point;
91
95
  onAnimateBind(animate: IAnimate | ISubAnimate): void;
92
96
  protected tryUpdateAABBBounds(full?: boolean): IAABBBounds;
97
+ protected tryUpdateOBBBounds(): IOBBBounds;
93
98
  protected combindShadowAABBBounds(bounds: IAABBBounds): void;
94
99
  abstract getGraphicTheme(): T;
100
+ protected doUpdateOBBBounds(): IOBBBounds;
95
101
  protected abstract updateAABBBounds(attribute: T, symbolTheme: Required<T>, aabbBounds: IAABBBounds, full?: boolean): IAABBBounds;
96
102
  protected doUpdateAABBBounds(full?: boolean): IAABBBounds;
97
103
  updatePathProxyAABBBounds(aabbBounds: IAABBBounds): boolean;
@@ -4,12 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
5
  }), exports.Graphic = exports.NOWORK_ANIMATE_ATTR = exports.GRAPHIC_UPDATE_TAG_KEY = exports.PURE_STYLE_KEY = void 0;
6
6
 
7
- const vutils_1 = require("@visactor/vutils"), node_tree_1 = require("./node-tree"), event_1 = require("../event"), config_1 = require("./config"), application_1 = require("../application"), animate_1 = require("../animate"), interpolate_1 = require("../color-string/interpolate"), custom_path2d_1 = require("../common/custom-path2d"), loader_1 = require("../resource-loader/loader"), enums_1 = require("../common/enums"), bounds_context_1 = require("../common/bounds-context"), render_command_list_1 = require("../common/render-command-list"), utils_1 = require("../common/utils"), tempMatrix = new vutils_1.Matrix, tempBounds = new vutils_1.AABBBounds;
7
+ const vutils_1 = require("@visactor/vutils"), vutils_2 = require("@visactor/vutils"), node_tree_1 = require("./node-tree"), event_1 = require("../event"), config_1 = require("./config"), application_1 = require("../application"), animate_1 = require("../animate"), interpolate_1 = require("../color-string/interpolate"), custom_path2d_1 = require("../common/custom-path2d"), loader_1 = require("../resource-loader/loader"), enums_1 = require("../common/enums"), bounds_context_1 = require("../common/bounds-context"), render_command_list_1 = require("../common/render-command-list"), utils_1 = require("../common/utils"), tempMatrix = new vutils_2.Matrix, tempBounds = new vutils_2.AABBBounds;
8
8
 
9
9
  exports.PURE_STYLE_KEY = [ "stroke", "opacity", "strokeOpacity", "lineDash", "lineDashOffset", "lineCap", "lineJoin", "miterLimit", "fill", "fillOpacity" ],
10
10
  exports.GRAPHIC_UPDATE_TAG_KEY = [ "lineWidth", "scaleX", "scaleY", "angle", "anchor", "visible" ];
11
11
 
12
- const tempConstantXYKey = [ "x", "y" ], tempConstantScaleXYKey = [ "scaleX", "scaleY" ], tempConstantAngleKey = [ "angle" ], point = new vutils_1.Point;
12
+ const tempConstantXYKey = [ "x", "y" ], tempConstantScaleXYKey = [ "scaleX", "scaleY" ], tempConstantAngleKey = [ "angle" ], point = new vutils_2.Point;
13
13
 
14
14
  exports.NOWORK_ANIMATE_ATTR = {
15
15
  strokeSeg: 1,
@@ -53,6 +53,9 @@ class Graphic extends node_tree_1.Node {
53
53
  get AABBBounds() {
54
54
  return this.tryUpdateAABBBounds("imprecise" === this.attribute.boundsMode);
55
55
  }
56
+ get OBBBounds() {
57
+ return this.tryUpdateOBBBounds();
58
+ }
56
59
  get globalAABBBounds() {
57
60
  return this.tryUpdateGlobalAABBBounds();
58
61
  }
@@ -64,8 +67,9 @@ class Graphic extends node_tree_1.Node {
64
67
  }
65
68
  constructor(params = {}) {
66
69
  var _a;
67
- super(), this._AABBBounds = new vutils_1.AABBBounds, this._updateTag = enums_1.UpdateTag.INIT,
68
- this.attribute = params, this.valid = this.isValid(), params.background ? this.loadImage(null !== (_a = params.background.background) && void 0 !== _a ? _a : params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic);
70
+ super(), this._AABBBounds = new vutils_2.AABBBounds, this._updateTag = enums_1.UpdateTag.INIT,
71
+ this.attribute = params, this.valid = this.isValid(), this.updateAABBBoundsStamp = 0,
72
+ params.background ? this.loadImage(null !== (_a = params.background.background) && void 0 !== _a ? _a : params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic);
69
73
  }
70
74
  setMode(mode) {
71
75
  "3d" === mode ? this.set3dMode() : this.set2dMode();
@@ -96,13 +100,24 @@ class Graphic extends node_tree_1.Node {
96
100
  return application_1.application.graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, !0),
97
101
  bounds;
98
102
  }
103
+ tryUpdateOBBBounds() {
104
+ if (this._OBBBounds || (this._OBBBounds = new vutils_1.OBBBounds), this.tryUpdateAABBBounds(),
105
+ this.updateOBBBoundsStamp === this.updateAABBBoundsStamp) return this._OBBBounds;
106
+ if (this.updateOBBBoundsStamp = this.updateAABBBoundsStamp, !this.valid) return this._OBBBounds.clear(),
107
+ this._OBBBounds;
108
+ return this.doUpdateOBBBounds();
109
+ }
99
110
  combindShadowAABBBounds(bounds) {
100
111
  if (this.shadowRoot) {
101
112
  const b = this.shadowRoot.AABBBounds.clone();
102
113
  bounds.union(b);
103
114
  }
104
115
  }
116
+ doUpdateOBBBounds() {
117
+ return this._OBBBounds;
118
+ }
105
119
  doUpdateAABBBounds(full) {
120
+ this.updateAABBBoundsStamp++;
106
121
  const graphicTheme = this.getGraphicTheme();
107
122
  this._AABBBounds.clear();
108
123
  const attribute = this.attribute, bounds = this.updateAABBBounds(attribute, graphicTheme, this._AABBBounds, full), {boundsPadding: boundsPadding = graphicTheme.boundsPadding} = attribute, paddingArray = (0,
@@ -136,7 +151,7 @@ class Graphic extends node_tree_1.Node {
136
151
  return !0;
137
152
  }
138
153
  tryUpdateLocalTransMatrix(clearTag = !0) {
139
- return this._transMatrix || (this._transMatrix = new vutils_1.Matrix), this.shouldUpdateLocalMatrix() && (this.doUpdateLocalMatrix(),
154
+ return this._transMatrix || (this._transMatrix = new vutils_2.Matrix), this.shouldUpdateLocalMatrix() && (this.doUpdateLocalMatrix(),
140
155
  clearTag && this.clearUpdateLocalPositionTag()), this._transMatrix;
141
156
  }
142
157
  shouldUpdateAABBBounds() {
@@ -165,7 +180,7 @@ class Graphic extends node_tree_1.Node {
165
180
  containsPoint(x, y, mode, picker) {
166
181
  if (!picker) return !1;
167
182
  if (mode === enums_1.IContainPointMode.GLOBAL) {
168
- const point = new vutils_1.Point(x, y);
183
+ const point = new vutils_2.Point(x, y);
169
184
  this.parent && this.parent.globalTransMatrix.transformPoint(point, point), x = point.x,
170
185
  y = point.y;
171
186
  }
@@ -192,7 +207,7 @@ class Graphic extends node_tree_1.Node {
192
207
  const params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate({
193
208
  [key]: value
194
209
  }, this.attribute, key, context);
195
- params ? this._setAttributes(params, forceUpdateTag, context) : (0, vutils_1.isNil)(null === (_a = this.normalAttrs) || void 0 === _a ? void 0 : _a[key]) ? (this.attribute[key] = value,
210
+ params ? this._setAttributes(params, forceUpdateTag, context) : (0, vutils_2.isNil)(null === (_a = this.normalAttrs) || void 0 === _a ? void 0 : _a[key]) ? (this.attribute[key] = value,
196
211
  this.valid = this.isValid(), this.updateShapeAndBoundsTagSetted() || !forceUpdateTag && !this.needUpdateTag(key) ? this.addUpdateBoundTag() : this.addUpdateShapeAndBoundsTag(),
197
212
  this.addUpdatePositionTag(), this.addUpdateLayoutTag(), this.onAttributeUpdate(context)) : this.normalAttrs[key] = value,
198
213
  "background" === key ? this.loadImage(value, !0) : "shadowGraphic" === key && this.setShadowGraphic(value);
@@ -262,7 +277,7 @@ class Graphic extends node_tree_1.Node {
262
277
  const attribute = this.attribute;
263
278
  if (scaleCenter) {
264
279
  let {postMatrix: postMatrix} = this.attribute;
265
- postMatrix || (postMatrix = new vutils_1.Matrix, attribute.postMatrix = postMatrix),
280
+ postMatrix || (postMatrix = new vutils_2.Matrix, attribute.postMatrix = postMatrix),
266
281
  application_1.application.transformUtil.fromMatrix(postMatrix, postMatrix).scale(scaleX, scaleY, scaleCenter);
267
282
  } else attribute.scaleX = (null !== (_a = attribute.scaleX) && void 0 !== _a ? _a : config_1.DefaultTransform.scaleX) * scaleX,
268
283
  attribute.scaleY = (null !== (_b = attribute.scaleY) && void 0 !== _b ? _b : config_1.DefaultTransform.scaleY) * scaleY;
@@ -295,7 +310,7 @@ class Graphic extends node_tree_1.Node {
295
310
  const attribute = this.attribute;
296
311
  if (rotateCenter) {
297
312
  let {postMatrix: postMatrix} = this.attribute;
298
- postMatrix || (postMatrix = new vutils_1.Matrix, attribute.postMatrix = postMatrix),
313
+ postMatrix || (postMatrix = new vutils_2.Matrix, attribute.postMatrix = postMatrix),
299
314
  application_1.application.transformUtil.fromMatrix(postMatrix, postMatrix).rotate(angle, rotateCenter);
300
315
  } else attribute.angle = (null !== (_a = attribute.angle) && void 0 !== _a ? _a : config_1.DefaultTransform.angle) + angle;
301
316
  return this.addUpdatePositionTag(), this.addUpdateBoundTag(), this.addUpdateLayoutTag(),
@@ -337,7 +352,7 @@ class Graphic extends node_tree_1.Node {
337
352
  this.tryUpdateLocalTransMatrix());
338
353
  }
339
354
  hasState(stateName) {
340
- return !(!this.currentStates || !this.currentStates.length) && (!!(0, vutils_1.isNil)(stateName) || this.currentStates.includes(stateName));
355
+ return !(!this.currentStates || !this.currentStates.length) && (!!(0, vutils_2.isNil)(stateName) || this.currentStates.includes(stateName));
341
356
  }
342
357
  getState(stateName) {
343
358
  var _a;
@@ -382,7 +397,7 @@ class Graphic extends node_tree_1.Node {
382
397
  return this.animates && this.animates.forEach((animate => {
383
398
  if (animate.stateNames) {
384
399
  const endProps = animate.getEndProps();
385
- (0, vutils_1.has)(endProps, key) && (value = endProps[key]);
400
+ (0, vutils_2.has)(endProps, key) && (value = endProps[key]);
386
401
  }
387
402
  })), value;
388
403
  }
@@ -488,7 +503,7 @@ class Graphic extends node_tree_1.Node {
488
503
  let _anchor = [ 0, 0 ];
489
504
  const params = {};
490
505
  if (anchor && (_anchor = this.getAnchor(anchor, params)), !scaleCenter || 1 === scaleX && 1 === scaleY) (0,
491
- vutils_1.normalTransform)(this._transMatrix, this._transMatrix.reset(), x, y, scaleX, scaleY, angle, anchor && _anchor); else {
506
+ vutils_2.normalTransform)(this._transMatrix, this._transMatrix.reset(), x, y, scaleX, scaleY, angle, anchor && _anchor); else {
492
507
  const m = this._transMatrix;
493
508
  m.reset(), m.translate(_anchor[0], _anchor[1]), m.rotate(angle), m.translate(-_anchor[0], -_anchor[1]),
494
509
  m.translate(x, y), _anchor = this.getAnchor(scaleCenter, params), application_1.application.transformUtil.fromMatrix(m, m).scale(scaleX, scaleY, {
@@ -614,7 +629,7 @@ class Graphic extends node_tree_1.Node {
614
629
  };
615
630
  }
616
631
  createPathProxy(path) {
617
- return (0, vutils_1.isString)(path, !0) ? this.pathProxy = (new custom_path2d_1.CustomPath2D).fromString(path) : this.pathProxy = new custom_path2d_1.CustomPath2D,
632
+ return (0, vutils_2.isString)(path, !0) ? this.pathProxy = (new custom_path2d_1.CustomPath2D).fromString(path) : this.pathProxy = new custom_path2d_1.CustomPath2D,
618
633
  this.pathProxy;
619
634
  }
620
635
  loadImage(image, background = !1) {
@@ -627,8 +642,8 @@ class Graphic extends node_tree_1.Node {
627
642
  };
628
643
  this.resources.set(url, cache), "string" == typeof image ? (cache.state = "loading",
629
644
  image.startsWith("<svg") ? (loader_1.ResourceLoader.GetSvg(image, this), this.backgroundImg = this.backgroundImg || background) : ((0,
630
- vutils_1.isValidUrl)(image) || image.includes("/") || (0, vutils_1.isBase64)(image)) && (loader_1.ResourceLoader.GetImage(image, this),
631
- this.backgroundImg = this.backgroundImg || background)) : (0, vutils_1.isObject)(image) ? (cache.state = "success",
645
+ vutils_2.isValidUrl)(image) || image.includes("/") || (0, vutils_2.isBase64)(image)) && (loader_1.ResourceLoader.GetImage(image, this),
646
+ this.backgroundImg = this.backgroundImg || background)) : (0, vutils_2.isObject)(image) ? (cache.state = "success",
632
647
  cache.data = image, this.backgroundImg = this.backgroundImg || background) : cache.state = "fail";
633
648
  }
634
649
  setShadowGraphic(graphic) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/graphic/graphic.ts"],"names":[],"mappings":";;;AAEA,6CAW0B;AAY1B,2CAAmC;AAanC,oCAAoD;AACpD,qCAA4C;AAC5C,gDAA6C;AAC7C,wCAAgE;AAChE,6DAA+D;AAC/D,2DAAuD;AACvD,sDAA2D;AAC3D,2CAAoF;AACpF,6DAAyD;AACzD,uEAAkE;AAClE,2CAA+C;AAmC/C,MAAM,UAAU,GAAG,IAAI,eAAM,EAAE,CAAC;AAChC,MAAM,UAAU,GAAG,IAAI,mBAAU,EAAE,CAAC;AAEvB,QAAA,cAAc,GAAG;IAC5B,QAAQ;IACR,SAAS;IACT,eAAe;IACf,UAAU;IACV,gBAAgB;IAChB,SAAS;IACT,UA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CAAC;SACJ;IACH,CAAC;IAED,YAAY,CAAC,eAAwB,KAAK;QACxC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAElC,IAAI,IAAI,CAAC,UAAU,EAAE;YAEnB,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;SACpC;QACD,IAAI,IAAI,CAAC,WAAW,IAAI,YAAY,EAAE;YACpC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAW,EAAE,EAAE;gBACnC,CAAC,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;YAC/B,CAAC,CAAC,CAAC;SACJ;IACH,CAAC;IAED,OAAO;QACL,IAAI,CAAC,aAAa,GAAG,UAAU,CAAC;QAChC,yBAAW,CAAC,cAAc,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAC7C,CAAC;IAES,gBAAgB,CAAC,IAAY,EAAE,OAAa;;QACpD,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,IAAI,IAAI,CAAC,OAAO,EAAE;YACxC,MAAM,WAAW,GAAG,IAAI,mBAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YACnD,WAAW,CAAC,OAAO,GAAG,KAAK,CAAC;YAE3B,WAAmB,CAAC,OAAO,GAAG,MAAA,MAAC,IAAI,CAAC,KAAa,0CAAE,WAAW,0CAAE,OAAO,CAAC;YACzE,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;SACjC;IACH,CAAC;CAKF;AA31CD,0BA21CC;AAED,OAAO,CAAC,KAAK,CAAC,mBAAW,CAAC,CAAC;AAE3B,SAAS,kBAAkB,CAAC,KAAU;IACpC,IAAI,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,MAAM,EAAE;QAC9B,OAAO,IAAI,CAAC;KACb;IACD,OAAO,KAAK,CAAC;AACf,CAAC","file":"graphic.js","sourcesContent":["import type { ICustomPath2D } from './../interface/path';\nimport type { Dict, IPointLike, IAABBBounds } from '@visactor/vutils';\nimport {\n AABBBounds,\n Matrix,\n normalTransform,\n Point,\n isNil,\n has,\n isString,\n isValidUrl,\n isBase64,\n isObject\n} from '@visactor/vutils';\nimport type {\n GraphicType,\n IAnimateConfig,\n IGraphicAttribute,\n IGraphic,\n IGraphicAnimateParams,\n IGraphicJson,\n ISetAttributeContext,\n ITransform,\n GraphicReleaseStatus\n} from '../interface/graphic';\nimport { Node } from './node-tree';\nimport type {\n IAnimate,\n IAnimateTarget,\n IGlyphGraphicAttribute,\n IGroup,\n ILayer,\n IPickerService,\n IShadowRoot,\n IStage,\n IStep,\n ISubAnimate\n} from '../interface';\nimport { EventTarget, CustomEvent } from '../event';\nimport { DefaultTransform } from './config';\nimport { application } from '../application';\nimport { Animate, DefaultStateAnimateConfig } from '../animate';\nimport { interpolateColor } from '../color-string/interpolate';\nimport { CustomPath2D } from '../common/custom-path2d';\nimport { ResourceLoader } from '../resource-loader/loader';\nimport { AttributeUpdateType, IContainPointMode, UpdateTag } from '../common/enums';\nimport { BoundsContext } from '../common/bounds-context';\nimport { renderCommandList } from '../common/render-command-list';\nimport { parsePadding } from '../common/utils';\n\n/**\n * pathProxy参考自zrender\n * BSD 3-Clause License\n\n Copyright (c) 2017, Baidu Inc.\n All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n\n * Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\n * Neither the name of the copyright holder nor the names of its\n contributors may be used to endorse or promote products derived from\n this software without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\n FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\nconst tempMatrix = new Matrix();\nconst tempBounds = new AABBBounds();\n\nexport const PURE_STYLE_KEY = [\n 'stroke',\n 'opacity',\n 'strokeOpacity',\n 'lineDash',\n 'lineDashOffset',\n 'lineCap',\n 'lineJoin',\n 'miterLimit',\n 'fill',\n 'fillOpacity'\n];\n\nexport const GRAPHIC_UPDATE_TAG_KEY = [\n 'lineWidth',\n // 'lineCap',\n // 'lineJoin',\n // 'miterLimit',\n 'scaleX',\n 'scaleY',\n 'angle',\n 'anchor',\n 'visible'\n];\n\nconst tempConstantXYKey = ['x', 'y'];\nconst tempConstantScaleXYKey = ['scaleX', 'scaleY'];\nconst tempConstantAngleKey = ['angle'];\n\nconst point = new Point();\n\nexport const NOWORK_ANIMATE_ATTR = {\n strokeSeg: 1,\n boundsPadding: 2,\n pickMode: 1,\n boundsMode: 1,\n customPickShape: 1,\n pickable: 1,\n childrenPickable: 1,\n visible: 1,\n zIndex: 1,\n layout: 1,\n keepDirIn3d: 1,\n globalZIndex: 1,\n\n outerBorder: 1,\n innerBorder: 1,\n lineDash: 1,\n lineCap: 1,\n lineJoin: 1,\n miterLimit: 2,\n strokeBoundsBuffer: 2,\n\n scaleCenter: 1,\n anchor: 1,\n anchor3d: 1,\n postMatrix: 1,\n\n backgroundMode: 2,\n background: 1,\n texture: 1,\n cursor: 1,\n html: 1\n};\n\n/**\n * globalTransMatrix更新逻辑\n * 1. group的transform修改,会下发到所有下层group,将所有下层的tag修改\n * 2. 叶子graphic每次获取globalTransMatrix都重新计算\n * 3. 所有节点的transform修改,或者globalTransform修改,都会下发到自己的shadowRoot上\n */\n\nexport abstract class Graphic<T extends Partial<IGraphicAttribute> = Partial<IGraphicAttribute>>\n extends Node\n implements IGraphic<T>, IAnimateTarget\n{\n /**\n * Mixes all enumerable properties and methods from a source object to Element.\n * @param source - The source of properties and methods to mix in.\n */\n static mixin(source: Dict<any>): void {\n // in ES8/ES2017, this would be really easy:\n // Object.defineProperties(Element.prototype, Object.getOwnPropertyDescriptors(source));\n\n // get all the enumerable property keys\n const keys = Object.keys(source);\n\n // loop through properties\n for (let i = 0; i < keys.length; ++i) {\n const propertyName = keys[i];\n\n // Set the property using the property descriptor - this works for accessors and normal value properties\n Object.defineProperty(\n Graphic.prototype,\n propertyName,\n Object.getOwnPropertyDescriptor(source, propertyName) as PropertyDecorator\n );\n }\n }\n\n declare _events?: any;\n\n declare onBeforeAttributeUpdate?: (\n val: any,\n attributes: Partial<T>,\n key: null | string | string[],\n context?: ISetAttributeContext\n ) => T | undefined;\n declare parent: any;\n\n declare resources?: Map<\n string,\n { state: 'init' | 'loading' | 'success' | 'fail'; data?: HTMLImageElement | HTMLCanvasElement }\n >;\n declare backgroundImg?: boolean;\n\n declare type: GraphicType;\n declare prefixed: string;\n declare numberType: number;\n declare isContainer?: boolean;\n declare valid: boolean;\n declare stage?: IStage;\n declare layer?: ILayer;\n declare incremental?: number;\n declare glyphHost?: IGraphic<IGlyphGraphicAttribute>;\n declare _onSetStage?: (g: IGraphic, stage: IStage, layer: ILayer) => void;\n // declare _beforeAttributeUpdate?: (key: string | string, value: any) => void;\n // 标记是否是在3d模式下\n declare in3dMode?: boolean;\n\n // aabbBounds,所有图形都需要有,所以初始化即赋值\n protected declare _AABBBounds: IAABBBounds;\n get AABBBounds(): IAABBBounds {\n return this.tryUpdateAABBBounds(this.attribute.boundsMode === 'imprecise');\n }\n // 具有旋转的包围盒,部分图元需要,动态初始化\n // protected declare _OBBBounds?: OBBBounds;\n // get OBBBounds(): OBBBounds {\n // return this.tryUpdateOBBBounds();\n // }\n protected declare _globalAABBBounds: IAABBBounds;\n // 全局包围盒,部分图元需要,动态初始化,建议使用AABBBounds\n get globalAABBBounds(): IAABBBounds {\n return this.tryUpdateGlobalAABBBounds();\n }\n protected declare _transMatrix: Matrix;\n get transMatrix(): Matrix {\n return this.tryUpdateLocalTransMatrix(true);\n }\n protected declare _globalTransMatrix: Matrix;\n get globalTransMatrix(): Matrix {\n return this.tryUpdateGlobalTransMatrix(true);\n }\n protected declare _updateTag: number;\n\n // 上次更新的stamp\n declare stamp?: number;\n\n declare attribute: T;\n\n declare shadowRoot?: IShadowRoot;\n\n declare releaseStatus?: GraphicReleaseStatus;\n\n /** 记录state对应的图形属性 */\n declare states?: Record<string, Partial<T>>;\n /** 当前state值 */\n declare currentStates?: string[];\n /** TODO: state更新对应的动画配置 */\n declare stateAnimateConfig?: IAnimateConfig;\n /** 记录应用state之前,attribute对应的原始图形属性 */\n declare normalAttrs?: Partial<T>;\n /** 获取state图形属性的方法 */\n declare stateProxy?: (stateName: string, targetStates?: string[]) => T;\n declare animates: Map<string | number, IAnimate>;\n\n declare nextAttrs?: T;\n declare prevAttrs?: T;\n declare finalAttrs?: T;\n\n declare pathProxy?: ICustomPath2D;\n // 依附于某个theme,如果该节点不存在parent,那么这个Theme就作为节点的Theme,避免添加到节点前计算属性\n declare attachedThemeGraphic?: IGraphic;\n\n constructor(params: T = {} as T) {\n super();\n this._AABBBounds = new AABBBounds();\n this._updateTag = UpdateTag.INIT;\n this.attribute = params;\n this.valid = this.isValid();\n if (params.background) {\n this.loadImage((params.background as any).background ?? params.background, true);\n } else if (params.shadowGraphic) {\n this.setShadowGraphic(params.shadowGraphic);\n }\n }\n\n setMode(mode: '2d' | '3d') {\n mode === '3d' ? this.set3dMode() : this.set2dMode();\n }\n\n set3dMode() {\n this.in3dMode = true;\n }\n set2dMode() {\n this.in3dMode = false;\n }\n getOffsetXY(attr?: ITransform, includeScroll: boolean = false) {\n const { dx = attr.dx, dy = attr.dy } = this.attribute;\n if (includeScroll && this.parent) {\n // const groupTheme = getTheme(this.parent).group;\n const attribute = this.parent.attribute;\n point.x = dx + (attribute.scrollX ?? 0);\n point.y = dy + (attribute.scrollY ?? 0);\n } else {\n point.x = dx;\n point.y = dy;\n }\n return point;\n }\n\n onAnimateBind(animate: IAnimate | ISubAnimate) {\n this._emitCustomEvent('animate-bind', animate);\n }\n\n protected tryUpdateAABBBounds(full?: boolean): IAABBBounds {\n if (!this.shouldUpdateAABBBounds()) {\n return this._AABBBounds;\n }\n if (!this.valid) {\n this._AABBBounds.clear();\n return this._AABBBounds;\n }\n\n application.graphicService.beforeUpdateAABBBounds(this, this.stage, true, this._AABBBounds);\n const bounds = this.doUpdateAABBBounds(full);\n // this.addUpdateLayoutTag();\n application.graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, true);\n return bounds;\n }\n\n protected combindShadowAABBBounds(bounds: IAABBBounds) {\n // 合并shadowRoot的Bounds\n if (this.shadowRoot) {\n const b = this.shadowRoot.AABBBounds.clone();\n bounds.union(b);\n }\n }\n\n abstract getGraphicTheme(): T;\n\n protected abstract updateAABBBounds(\n attribute: T,\n symbolTheme: Required<T>,\n aabbBounds: IAABBBounds,\n full?: boolean\n ): IAABBBounds;\n\n protected doUpdateAABBBounds(full?: boolean): IAABBBounds {\n const graphicTheme = this.getGraphicTheme();\n this._AABBBounds.clear();\n const attribute = this.attribute;\n const bounds = this.updateAABBBounds(attribute, graphicTheme as Required<T>, this._AABBBounds, full) as AABBBounds;\n\n const { boundsPadding = graphicTheme.boundsPadding } = attribute;\n const paddingArray = parsePadding(boundsPadding);\n if (paddingArray) {\n bounds.expand(paddingArray);\n }\n\n this.clearUpdateBoundTag();\n return bounds;\n }\n\n updatePathProxyAABBBounds(aabbBounds: IAABBBounds): boolean {\n const path = typeof this.pathProxy === 'function' ? (this.pathProxy as any)(this.attribute) : this.pathProxy;\n if (!path) {\n return false;\n }\n const boundsContext = new BoundsContext(aabbBounds);\n renderCommandList(path.commandList, boundsContext, 0, 0);\n return true;\n }\n\n protected tryUpdateGlobalAABBBounds(): IAABBBounds {\n const b = this.AABBBounds;\n if (!this._globalAABBBounds) {\n this._globalAABBBounds = b.clone();\n } else {\n this._globalAABBBounds.setValue(b.x1, b.y1, b.x2, b.y2);\n }\n if (this._globalAABBBounds.empty()) {\n return this._globalAABBBounds;\n }\n // 使用parent的grloalAABBBounds\n // todo: 考虑是否需要性能优化\n if (this.parent) {\n this._globalAABBBounds.transformWithMatrix((this.parent as IGroup).globalTransMatrix);\n }\n return this._globalAABBBounds;\n }\n\n /**\n * 这里都是叶子节点的UpdateGlobalTransMatrix函数,只要走进来就直接计算\n * @param clearTag\n * @returns\n */\n protected tryUpdateGlobalTransMatrix(clearTag: boolean = true): Matrix {\n if (!this._globalTransMatrix) {\n this._globalTransMatrix = this.parent\n ? (this.parent as IGroup).globalTransMatrix.clone()\n : this.transMatrix.clone();\n } else if (this.parent) {\n const m = (this.parent as IGroup).globalTransMatrix;\n this._globalTransMatrix.setValue(m.a, m.b, m.c, m.d, m.e, m.f);\n }\n if (this.shouldUpdateGlobalMatrix()) {\n this.doUpdateGlobalMatrix();\n }\n return this._globalTransMatrix;\n }\n\n shouldUpdateGlobalMatrix(): boolean {\n return true;\n }\n\n protected tryUpdateLocalTransMatrix(clearTag: boolean = true) {\n if (!this._transMatrix) {\n this._transMatrix = new Matrix();\n }\n if (this.shouldUpdateLocalMatrix()) {\n this.doUpdateLocalMatrix();\n clearTag && this.clearUpdateLocalPositionTag();\n }\n return this._transMatrix;\n }\n\n shouldUpdateAABBBounds(): boolean {\n // 如果存在shadowRoot,那么判断shadowRoot是否需要更新\n if (this.shadowRoot) {\n return (\n (!!(this._updateTag & UpdateTag.UPDATE_BOUNDS) || this.shadowRoot.shouldUpdateAABBBounds()) &&\n application.graphicService.validCheck(\n this.attribute,\n this.getGraphicTheme() as Required<T>,\n this._AABBBounds,\n this\n )\n );\n }\n return (\n !!(this._updateTag & UpdateTag.UPDATE_BOUNDS) &&\n application.graphicService.validCheck(\n this.attribute,\n this.getGraphicTheme() as Required<T>,\n this._AABBBounds,\n this\n )\n );\n }\n\n // 自身变化导致的AABBBounds的变化\n shouldSelfChangeUpdateAABBBounds(): boolean {\n // 如果存在shadowRoot,那么判断shadowRoot是否需要更新\n if (this.shadowRoot) {\n return !!(this._updateTag & UpdateTag.UPDATE_BOUNDS) || this.shadowRoot.shouldUpdateAABBBounds();\n }\n return !!(this._updateTag & UpdateTag.UPDATE_BOUNDS);\n }\n\n protected shouldUpdateLocalMatrix(): boolean {\n return !!(this._updateTag & UpdateTag.UPDATE_LOCAL_MATRIX);\n }\n\n isValid(): boolean {\n const attribute = this.attribute;\n return Number.isFinite((attribute.x ?? 0) + (attribute.y ?? 0));\n }\n\n protected _validNumber(num?: number) {\n return num == null || Number.isFinite(num);\n }\n\n shouldUpdateShape(): boolean {\n return !!(this._updateTag & UpdateTag.UPDATE_SHAPE);\n }\n clearUpdateShapeTag() {\n this._updateTag &= UpdateTag.CLEAR_SHAPE;\n }\n\n /**\n * 是否包含某个点(点需要是全局坐标系)\n * @param x\n * @param y\n * @param mode\n * @returns\n */\n containsPoint(x: number, y: number, mode: IContainPointMode, picker?: IPickerService): boolean {\n if (!picker) {\n return false;\n }\n if (mode === IContainPointMode.GLOBAL) {\n // 转换x,y更精准\n const point = new Point(x, y);\n if (this.parent) {\n this.parent.globalTransMatrix.transformPoint(point, point);\n }\n x = point.x;\n y = point.y;\n }\n return picker.containsPoint(this, { x, y });\n }\n\n setAttributes(params: Partial<T>, forceUpdateTag: boolean = false, context?: ISetAttributeContext) {\n params =\n (this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context)) || params;\n\n if (params.background) {\n this.loadImage(params.background, true);\n } else if (params.shadowGraphic) {\n this.setShadowGraphic(params.shadowGraphic);\n }\n this._setAttributes(params, forceUpdateTag, context);\n }\n\n _setAttributes(params: Partial<T>, forceUpdateTag: boolean = false, context?: ISetAttributeContext) {\n const keys = Object.keys(params);\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n\n (this.attribute as any)[key] = (params as any)[key];\n }\n this.valid = this.isValid();\n // 没有设置shape&bounds的tag\n if (!this.updateShapeAndBoundsTagSetted() && (forceUpdateTag || this.needUpdateTags(keys))) {\n this.addUpdateShapeAndBoundsTag();\n } else {\n this.addUpdateBoundTag();\n }\n this.addUpdatePositionTag();\n this.addUpdateLayoutTag();\n this.onAttributeUpdate(context);\n }\n\n setAttribute(key: string, value: any, forceUpdateTag?: boolean, context?: ISetAttributeContext) {\n const params =\n this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate({ [key]: value }, this.attribute, key, context);\n if (!params) {\n if (!isNil((this.normalAttrs as any)?.[key])) {\n (this.normalAttrs as any)[key] = value;\n } else {\n (this.attribute as any)[key] = value;\n this.valid = this.isValid();\n if (!this.updateShapeAndBoundsTagSetted() && (forceUpdateTag || this.needUpdateTag(key))) {\n this.addUpdateShapeAndBoundsTag();\n } else {\n this.addUpdateBoundTag();\n }\n this.addUpdatePositionTag();\n this.addUpdateLayoutTag();\n this.onAttributeUpdate(context);\n }\n } else {\n this._setAttributes(params, forceUpdateTag, context);\n }\n if (key === 'background') {\n this.loadImage(value, true);\n } else if (key === 'shadowGraphic') {\n this.setShadowGraphic(value);\n }\n }\n\n protected needUpdateTags(keys: string[], k: string[] = GRAPHIC_UPDATE_TAG_KEY): boolean {\n for (let i = 0; i < k.length; i++) {\n const attrKey = k[i];\n if (keys.indexOf(attrKey) !== -1) {\n return true;\n }\n }\n return false;\n }\n\n protected needUpdateTag(key: string, k: string[] = GRAPHIC_UPDATE_TAG_KEY): boolean {\n for (let i = 0; i < k.length; i++) {\n const attrKey = k[i];\n if (key === attrKey) {\n return true;\n }\n }\n return false;\n }\n\n initAttributes(params: T) {\n // this.setAttributes(params, true);\n const context = { type: AttributeUpdateType.INIT };\n params =\n (this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context)) || params;\n this.attribute = params;\n if (params.background) {\n this.loadImage(params.background, true);\n } else if (params.shadowGraphic) {\n this.setShadowGraphic(params.shadowGraphic);\n }\n this._updateTag = UpdateTag.INIT;\n this.valid = this.isValid();\n this.onAttributeUpdate(context);\n }\n\n translate(x: number, y: number) {\n if (x === 0 && y === 0) {\n return this;\n }\n const context = {\n type: AttributeUpdateType.TRANSLATE\n };\n const params =\n this.onBeforeAttributeUpdate &&\n this.onBeforeAttributeUpdate({ x, y }, this.attribute, tempConstantXYKey, context);\n if (params) {\n x = params.x;\n y = params.y;\n delete params.x;\n delete params.y;\n this._setAttributes(params);\n }\n const attribute = this.attribute;\n const postMatrix = attribute.postMatrix;\n if (!postMatrix) {\n attribute.x = (attribute.x ?? DefaultTransform.x) + x;\n attribute.y = (attribute.y ?? DefaultTransform.y) + y;\n } else {\n application.transformUtil.fromMatrix(postMatrix, postMatrix).translate(x, y);\n }\n\n this.addUpdatePositionTag();\n this.addUpdateBoundTag();\n this.addUpdateLayoutTag();\n this.onAttributeUpdate(context);\n return this;\n }\n\n translateTo(x: number, y: number) {\n const attribute = this.attribute;\n if (attribute.x === x && attribute.y === y) {\n return this;\n }\n const context = {\n type: AttributeUpdateType.TRANSLATE_TO\n };\n const params =\n this.onBeforeAttributeUpdate &&\n this.onBeforeAttributeUpdate({ x, y }, this.attribute, tempConstantXYKey, context);\n if (params) {\n this._setAttributes(params, false, context);\n return this;\n }\n attribute.x = x;\n attribute.y = y;\n this.addUpdatePositionTag();\n this.addUpdateBoundTag();\n this.addUpdateLayoutTag();\n this.onAttributeUpdate(context);\n return this;\n }\n\n scale(scaleX: number, scaleY: number, scaleCenter?: IPointLike) {\n if (scaleX === 1 && scaleY === 1) {\n return this;\n }\n const context = {\n type: AttributeUpdateType.SCALE\n };\n const params =\n this.onBeforeAttributeUpdate &&\n this.onBeforeAttributeUpdate({ scaleX, scaleY, scaleCenter }, this.attribute, tempConstantScaleXYKey, context);\n if (params) {\n scaleX = params.scaleX;\n scaleY = params.scaleY;\n delete params.scaleX;\n delete params.scaleY;\n this._setAttributes(params);\n }\n const attribute = this.attribute;\n if (!scaleCenter) {\n attribute.scaleX = (attribute.scaleX ?? DefaultTransform.scaleX) * scaleX;\n attribute.scaleY = (attribute.scaleY ?? DefaultTransform.scaleY) * scaleY;\n } else {\n let { postMatrix } = this.attribute;\n if (!postMatrix) {\n postMatrix = new Matrix();\n attribute.postMatrix = postMatrix;\n }\n application.transformUtil.fromMatrix(postMatrix, postMatrix).scale(scaleX, scaleY, scaleCenter);\n }\n this.addUpdatePositionTag();\n this.addUpdateBoundTag();\n this.addUpdateLayoutTag();\n this.onAttributeUpdate(context);\n return this;\n }\n\n scaleTo(scaleX: number, scaleY: number) {\n const attribute = this.attribute;\n if (attribute.scaleX === scaleX && attribute.scaleY === scaleY) {\n return this;\n }\n const context = {\n type: AttributeUpdateType.SCALE_TO\n };\n const params =\n this.onBeforeAttributeUpdate &&\n this.onBeforeAttributeUpdate({ scaleX, scaleY }, this.attribute, tempConstantScaleXYKey, context);\n if (params) {\n this._setAttributes(params, false, context);\n return this;\n }\n attribute.scaleX = scaleX;\n attribute.scaleY = scaleY;\n this.addUpdatePositionTag();\n this.addUpdateBoundTag();\n this.addUpdateLayoutTag();\n this.onAttributeUpdate(context);\n return this;\n }\n\n rotate(angle: number, rotateCenter?: IPointLike) {\n if (angle === 0) {\n return this;\n }\n const context = { type: AttributeUpdateType.ROTATE };\n const params =\n this.onBeforeAttributeUpdate &&\n this.onBeforeAttributeUpdate({ angle, rotateCenter }, this.attribute, tempConstantAngleKey, context);\n if (params) {\n delete params.angle;\n this._setAttributes(params, false, context);\n // return this;\n }\n const attribute = this.attribute;\n if (!rotateCenter) {\n attribute.angle = (attribute.angle ?? DefaultTransform.angle) + angle;\n } else {\n let { postMatrix } = this.attribute;\n if (!postMatrix) {\n postMatrix = new Matrix();\n attribute.postMatrix = postMatrix;\n }\n application.transformUtil.fromMatrix(postMatrix, postMatrix).rotate(angle, rotateCenter);\n }\n this.addUpdatePositionTag();\n this.addUpdateBoundTag();\n this.addUpdateLayoutTag();\n this.onAttributeUpdate(context);\n return this;\n }\n\n rotateTo(angle: number) {\n const attribute = this.attribute;\n if (attribute.angle === angle) {\n return this;\n }\n const context = {\n type: AttributeUpdateType.ROTATE_TO\n };\n const params =\n this.onBeforeAttributeUpdate &&\n this.onBeforeAttributeUpdate(angle, this.attribute, tempConstantAngleKey, context);\n if (params) {\n this._setAttributes(params, false, context);\n return this;\n }\n attribute.angle = angle;\n this.addUpdatePositionTag();\n this.addUpdateBoundTag();\n this.addUpdateLayoutTag();\n this.onAttributeUpdate(context);\n return this;\n }\n\n skewTo(b: number, c: number) {\n return this;\n }\n\n animate(params?: IGraphicAnimateParams) {\n if (!this.animates) {\n this.animates = new Map();\n }\n const animate = new Animate(params?.id, this.stage && this.stage.getTimeline(), params?.slience);\n\n animate.bind(this);\n if (params) {\n const { onStart, onFrame, onEnd, onRemove } = params;\n onStart != null && animate.onStart(onStart);\n onFrame != null && animate.onFrame(onFrame);\n onEnd != null && animate.onEnd(onEnd);\n onRemove != null && animate.onRemove(onRemove);\n animate.interpolateFunc = params.interpolate;\n }\n this.animates.set(animate.id, animate);\n animate.onRemove(() => {\n this.animates.delete(animate.id);\n });\n\n return animate;\n }\n\n onAttributeUpdate(context?: ISetAttributeContext) {\n if (context && context.skipUpdateCallback) {\n return;\n }\n application.graphicService.onAttributeUpdate(this);\n this._emitCustomEvent('afterAttributeUpdate', context);\n }\n\n // hasListener(event: string) {\n // const prefix = this.prefixed;\n // var evt = prefix ? prefix + event : event;\n // return this._events[evt];\n // }\n\n update(d?: { bounds: boolean; trans: boolean }) {\n if (d) {\n d.bounds && this.tryUpdateAABBBounds(this.attribute.boundsMode === 'imprecise');\n d.trans && this.tryUpdateLocalTransMatrix();\n } else {\n this.tryUpdateAABBBounds(this.attribute.boundsMode === 'imprecise');\n this.tryUpdateLocalTransMatrix();\n }\n }\n\n hasState(stateName?: string) {\n if (!this.currentStates || !this.currentStates.length) {\n return false;\n }\n\n if (!isNil(stateName)) {\n return this.currentStates.includes(stateName);\n }\n\n return true;\n }\n getState(stateName: string) {\n return this.states?.[stateName];\n }\n\n applyStateAttrs(attrs: Partial<T>, stateNames: string[], hasAnimation?: boolean, isClear?: boolean) {\n if (hasAnimation) {\n const keys = Object.keys(attrs);\n const noWorkAttrs = this.getNoWorkAnimateAttr();\n const animateAttrs: Partial<T> = {};\n let noAnimateAttrs: Partial<T> | undefined;\n\n keys.forEach(key => {\n if (!noWorkAttrs[key]) {\n (animateAttrs as any)[key] =\n isClear && (attrs as any)[key] === undefined ? this.getDefaultAttribute(key) : (attrs as any)[key];\n } else {\n if (!noAnimateAttrs) {\n noAnimateAttrs = {};\n }\n (noAnimateAttrs as any)[key] = (attrs as any)[key];\n }\n });\n\n const animate = this.animate({ slience: true });\n (animate as any).stateNames = stateNames;\n animate.to(\n animateAttrs,\n this.stateAnimateConfig?.duration ?? DefaultStateAnimateConfig.duration,\n this.stateAnimateConfig?.easing ?? DefaultStateAnimateConfig.easing\n );\n noAnimateAttrs && this.setAttributes(noAnimateAttrs, false, { type: AttributeUpdateType.STATE });\n } else {\n this.stopStateAnimates();\n this.setAttributes(attrs, false, { type: AttributeUpdateType.STATE });\n }\n }\n\n updateNormalAttrs(stateAttrs: Partial<T>) {\n const newNormalAttrs = {};\n if (this.normalAttrs) {\n Object.keys(stateAttrs).forEach(key => {\n if (key in this.normalAttrs) {\n (newNormalAttrs as any)[key] = (this.normalAttrs as any)[key];\n delete (this.normalAttrs as any)[key];\n } else {\n (newNormalAttrs as any)[key] = this.getNormalAttribute(key);\n }\n });\n Object.keys(this.normalAttrs).forEach(key => {\n (stateAttrs as any)[key] = (this.normalAttrs as any)[key];\n });\n } else {\n Object.keys(stateAttrs).forEach(key => {\n (newNormalAttrs as any)[key] = this.getNormalAttribute(key);\n });\n }\n\n this.normalAttrs = newNormalAttrs;\n }\n\n protected stopStateAnimates(type: 'start' | 'end' = 'end') {\n if (this.animates) {\n this.animates.forEach(animate => {\n if ((animate as any).stateNames) {\n animate.stop(type);\n this.animates.delete(animate.id);\n }\n });\n }\n }\n\n private getNormalAttribute(key: string) {\n let value = (this.attribute as any)[key];\n\n if (this.animates) {\n this.animates.forEach(animate => {\n if ((animate as any).stateNames) {\n const endProps = animate.getEndProps();\n if (has(endProps, key)) {\n value = endProps[key];\n }\n }\n });\n }\n\n return value;\n }\n\n clearStates(hasAnimation?: boolean) {\n if (this.hasState() && this.normalAttrs) {\n this.currentStates = [];\n this.applyStateAttrs(this.normalAttrs, this.currentStates, hasAnimation, true);\n } else {\n this.currentStates = [];\n }\n this.normalAttrs = null;\n }\n\n removeState(stateName: string, hasAnimation?: boolean) {\n const index = this.currentStates ? this.currentStates.indexOf(stateName) : -1;\n\n if (index >= 0) {\n const currentStates = this.currentStates.filter(state => state !== stateName);\n\n this.useStates(currentStates, hasAnimation);\n }\n }\n\n toggleState(stateName: string, hasAnimation?: boolean) {\n if (this.hasState(stateName)) {\n this.removeState(stateName, hasAnimation);\n } else {\n const index = this.currentStates ? this.currentStates.indexOf(stateName) : -1;\n if (index < 0) {\n const nextStates = this.currentStates ? this.currentStates.slice() : [];\n nextStates.push(stateName);\n this.useStates(nextStates, hasAnimation);\n }\n }\n }\n\n addState(stateName: string, keepCurrentStates?: boolean, hasAnimation?: boolean) {\n if (\n this.currentStates &&\n this.currentStates.includes(stateName) &&\n (keepCurrentStates || this.currentStates.length === 1)\n ) {\n return;\n }\n\n const newStates =\n keepCurrentStates && this.currentStates?.length ? this.currentStates.concat([stateName]) : [stateName];\n\n this.useStates(newStates, hasAnimation);\n }\n\n useStates(states: string[], hasAnimation?: boolean) {\n if (!states.length) {\n this.clearStates(hasAnimation);\n return;\n }\n\n const isChange =\n this.currentStates?.length !== states.length ||\n states.some((stateName, index) => this.currentStates[index] !== stateName);\n\n if (!isChange) {\n return;\n }\n\n const stateAttrs = {};\n states.forEach(stateName => {\n const attrs = this.stateProxy ? this.stateProxy(stateName, states) : this.states?.[stateName];\n\n if (attrs) {\n Object.assign(stateAttrs, attrs);\n }\n });\n\n this.updateNormalAttrs(stateAttrs);\n\n this.currentStates = states;\n this.applyStateAttrs(stateAttrs, states, hasAnimation);\n }\n\n addUpdateBoundTag() {\n this._updateTag |= UpdateTag.UPDATE_BOUNDS; // for bounds\n if (this.parent) {\n this.parent.addChildUpdateBoundTag();\n }\n if (this.glyphHost) {\n this.glyphHost.addUpdateBoundTag();\n }\n }\n\n addUpdateShapeTag() {\n this._updateTag |= UpdateTag.UPDATE_SHAPE; // for shape\n }\n\n addUpdateShapeAndBoundsTag() {\n this._updateTag |= UpdateTag.UPDATE_SHAPE_AND_BOUNDS; // for shape&bounds\n if (this.parent) {\n this.parent.addChildUpdateBoundTag();\n }\n if (this.glyphHost) {\n this.glyphHost.addUpdateBoundTag();\n }\n }\n\n protected updateShapeAndBoundsTagSetted(): boolean {\n return (this._updateTag & UpdateTag.UPDATE_SHAPE_AND_BOUNDS) === UpdateTag.UPDATE_SHAPE_AND_BOUNDS;\n }\n\n protected clearUpdateBoundTag() {\n this._updateTag &= UpdateTag.CLEAR_BOUNDS;\n }\n /**\n * 更新位置tag,包括全局tag和局部tag\n */\n addUpdatePositionTag() {\n // 更新shadowRoot的全局位置\n this.shadowRoot && this.shadowRoot.addUpdateGlobalPositionTag();\n this._updateTag |= UpdateTag.UPDATE_GLOBAL_LOCAL_MATRIX;\n }\n /**\n * 更新全局位置tag\n */\n addUpdateGlobalPositionTag() {\n // 更新shadowRoot的全局位置\n this.shadowRoot && this.shadowRoot.addUpdateGlobalPositionTag();\n this._updateTag |= UpdateTag.UPDATE_GLOBAL_MATRIX;\n }\n /**\n * 清除局部位置tag\n */\n protected clearUpdateLocalPositionTag() {\n this._updateTag &= UpdateTag.CLEAR_LOCAL_MATRIX;\n }\n /**\n * 清除全局位置tag\n */\n protected clearUpdateGlobalPositionTag() {\n this._updateTag &= UpdateTag.CLEAR_GLOBAL_MATRIX;\n }\n\n addUpdateLayoutTag() {\n this._updateTag |= UpdateTag.UPDATE_LAYOUT;\n }\n\n protected clearUpdateLayoutTag() {\n this._updateTag &= UpdateTag.CLEAR_LAYOUT;\n }\n\n protected needUpdateLayout(): boolean {\n return !!(this._updateTag & UpdateTag.UPDATE_LAYOUT);\n }\n\n protected getAnchor(anchor: [string | number, string | number], params: { b?: IAABBBounds }) {\n const _anchor: [number, number] = [0, 0];\n const getBounds = () => {\n if (params.b) {\n return params.b;\n }\n const { scaleX, scaleY, angle } = this.attribute;\n // 拷贝一份,避免计算bounds的过程中计算matrix,然后matrix又修改了bounds\n tempBounds.copy(this._AABBBounds);\n // @ts-ignore\n this.setAttributes({ scaleX: 1, scaleY: 1, angle: 0 });\n params.b = this.AABBBounds.clone();\n this._AABBBounds.copy(tempBounds);\n // @ts-ignore\n this.setAttributes({ scaleX, scaleY, angle });\n return params.b;\n };\n if (typeof anchor[0] === 'string') {\n const ratio = parseFloat(anchor[0]) / 100;\n const bounds = getBounds();\n _anchor[0] = bounds.x1 + (bounds.x2 - bounds.x1) * ratio;\n } else {\n _anchor[0] = anchor[0];\n }\n if (typeof anchor[1] === 'string') {\n const ratio = parseFloat(anchor[1]) / 100;\n const bounds = getBounds();\n _anchor[1] = bounds.y1 + (bounds.y2 - bounds.y1) * ratio;\n } else {\n _anchor[1] = anchor[1];\n }\n\n return _anchor;\n }\n\n /**\n * 更新局部matrix的具体函数\n */\n protected doUpdateLocalMatrix() {\n const {\n x = DefaultTransform.x,\n y = DefaultTransform.y,\n scaleX = DefaultTransform.scaleX,\n scaleY = DefaultTransform.scaleY,\n angle = DefaultTransform.angle,\n scaleCenter,\n anchor,\n postMatrix\n } = this.attribute;\n let _anchor: [number, number] = [0, 0];\n const params = {};\n if (anchor) {\n _anchor = this.getAnchor(anchor, params);\n }\n if (scaleCenter && (scaleX !== 1 || scaleY !== 1)) {\n const m = this._transMatrix;\n m.reset();\n m.translate(_anchor[0], _anchor[1]);\n m.rotate(angle);\n m.translate(-_anchor[0], -_anchor[1]);\n\n m.translate(x, y);\n // m.translate(scaleCenter[0] * scaleX, scaleCenter[1] * scaleY);\n // 计算bounds\n _anchor = this.getAnchor(scaleCenter, params);\n application.transformUtil.fromMatrix(m, m).scale(scaleX, scaleY, { x: _anchor[0], y: _anchor[1] });\n // m.translate(-scaleCenter[0], -scaleCenter[1]);\n } else {\n normalTransform(this._transMatrix, this._transMatrix.reset(), x, y, scaleX, scaleY, angle, anchor && _anchor);\n }\n const p = this.getOffsetXY(DefaultTransform);\n this._transMatrix.e += p.x;\n this._transMatrix.f += p.y;\n\n if (postMatrix) {\n const m1 = tempMatrix.setValue(\n postMatrix.a,\n postMatrix.b,\n postMatrix.c,\n postMatrix.d,\n postMatrix.e,\n postMatrix.f\n );\n const m2 = this._transMatrix;\n m1.multiply(m2.a, m2.b, m2.c, m2.d, m2.e, m2.f);\n m2.setValue(m1.a, m1.b, m1.c, m1.d, m1.e, m1.f);\n }\n }\n /**\n * 更新全局matrix的具体函数\n */\n protected doUpdateGlobalMatrix() {\n // 基于parent的matrix修改\n if (this.parent) {\n this._globalTransMatrix.multiply(\n this.transMatrix.a,\n this.transMatrix.b,\n this.transMatrix.c,\n this.transMatrix.d,\n this.transMatrix.e,\n this.transMatrix.f\n );\n const { scrollX = 0, scrollY = 0 } = this.parent.attribute;\n this._globalTransMatrix.translate(scrollX, scrollY);\n }\n }\n\n setStage(stage?: IStage, layer?: ILayer) {\n if (this.stage !== stage) {\n this.stage = stage;\n this.layer = layer;\n this.setStageToShadowRoot(stage, layer);\n if (this.animates && this.animates.size) {\n const timeline = stage.getTimeline();\n this.animates.forEach(a => {\n a.setTimeline(timeline);\n });\n }\n this._onSetStage && this._onSetStage(this, stage, layer);\n application.graphicService.onSetStage(this, stage);\n }\n }\n\n setStageToShadowRoot(stage?: IStage, layer?: ILayer) {\n if (this.shadowRoot) {\n this.shadowRoot.setStage(stage, layer);\n }\n }\n\n onAddStep(step: IStep) {\n return;\n }\n onStop(props?: Partial<T>): void {\n if (props) {\n this.setAttributes(props, false, { type: AttributeUpdateType.ANIMATE_END });\n }\n }\n // step时调用\n onStep(subAnimate: ISubAnimate, animate: IAnimate, step: IStep, ratio: number, end: boolean) {\n const nextAttributes = {};\n if (step.customAnimate) {\n step.customAnimate.update(end, ratio, nextAttributes);\n } else {\n const nextProps = step.props;\n const nextParsedProps = step.parsedProps;\n const propKeys = step.propKeys;\n this.stepInterpolate(\n subAnimate,\n animate,\n nextAttributes,\n step,\n ratio,\n end,\n nextProps,\n undefined,\n nextParsedProps,\n propKeys\n );\n }\n this.setAttributes(nextAttributes, false, {\n type: AttributeUpdateType.ANIMATE_UPDATE,\n animationState: {\n ratio,\n end,\n step,\n isFirstFrameOfStep: subAnimate.getLastStep() !== step\n }\n });\n this.stage && this.stage.renderNextFrame();\n }\n\n stepInterpolate(\n subAnimate: ISubAnimate,\n animate: IAnimate,\n nextAttributes: Record<string, any>,\n step: IStep,\n ratio: number,\n end: boolean,\n nextProps: Record<string, any>,\n lastProps?: Record<string, any>,\n nextParsedProps?: any,\n propKeys?: string[]\n ) {\n if (!propKeys) {\n propKeys = Object.keys(nextProps);\n step.propKeys = propKeys;\n }\n if (end) {\n step.propKeys.forEach(key => {\n if (!animate.validAttr(key)) {\n return;\n }\n nextAttributes[key] = nextProps[key];\n });\n } else {\n propKeys.forEach(key => {\n // 如果属性不合法,那直接return\n if (!animate.validAttr(key)) {\n return;\n }\n const nextStepVal = nextProps[key];\n const lastStepVal = (lastProps && lastProps[key]) ?? subAnimate.getLastPropByName(key, step);\n if (nextStepVal == null || lastStepVal == null || nextStepVal === lastStepVal) {\n // 用户直接调用stepInterpolate可能会走进来,如果传入的参数出现null或者undefined,直接赋值最终的值\n nextAttributes[key] = nextStepVal;\n return;\n }\n let match: boolean;\n match =\n animate.interpolateFunc && animate.interpolateFunc(key, ratio, lastStepVal, nextStepVal, nextAttributes);\n if (match) {\n return;\n }\n match = animate.customInterpolate(key, ratio, lastStepVal, nextStepVal, this, nextAttributes);\n if (match) {\n return;\n }\n if (!this.defaultInterpolate(nextStepVal, lastStepVal, key, nextAttributes, nextParsedProps, ratio)) {\n this._interpolate(key, ratio, lastStepVal, nextStepVal, nextAttributes);\n }\n });\n }\n\n step.parsedProps = nextParsedProps;\n }\n\n defaultInterpolate(\n nextStepVal: any,\n lastStepVal: any,\n key: string,\n nextAttributes: Record<string, any>,\n nextParsedProps: any,\n ratio: number\n ) {\n if (Number.isFinite(nextStepVal)) {\n nextAttributes[key] = lastStepVal + (nextStepVal - lastStepVal) * ratio;\n return true;\n } else if (key === 'fill') {\n if (!nextParsedProps) {\n nextParsedProps = {};\n }\n // 保存解析的结果到step\n const fillColorArray: [number, number, number, number] = nextParsedProps.fillColorArray;\n const color = interpolateColor(lastStepVal, fillColorArray ?? nextStepVal, ratio, false, (fArray, tArray) => {\n nextParsedProps.fillColorArray = tArray;\n });\n if (color) {\n nextAttributes[key] = color;\n }\n return true;\n } else if (key === 'stroke') {\n if (!nextParsedProps) {\n nextParsedProps = {};\n }\n // 保存解析的结果到step\n const strokeColorArray: [number, number, number, number] = nextParsedProps.strokeColorArray;\n const color = interpolateColor(lastStepVal, strokeColorArray ?? nextStepVal, ratio, false, (fArray, tArray) => {\n nextParsedProps.strokeColorArray = tArray;\n });\n if (color) {\n nextAttributes[key] = color;\n }\n return true;\n } else if (key === 'shadowColor') {\n if (!nextParsedProps) {\n nextParsedProps = {};\n }\n // 保存解析的结果到step\n const shadowColorArray: [number, number, number, number] = nextParsedProps.shadowColorArray;\n const color = interpolateColor(lastStepVal, shadowColorArray ?? nextStepVal, ratio, true, (fArray, tArray) => {\n nextParsedProps.shadowColorArray = tArray;\n });\n if (color) {\n nextAttributes[key] = color;\n }\n\n return true;\n }\n\n return false;\n }\n\n protected _interpolate(key: string, ratio: number, lastStepVal: any, nextStepVal: any, nextAttributes: any) {\n return;\n }\n\n getDefaultAttribute(name: string) {\n return (this.getGraphicTheme() as any)[name];\n }\n\n // 获取属性\n getComputedAttribute(name: string) {\n return (this.attribute as any)[name] ?? this.getDefaultAttribute(name);\n }\n /**\n * 添加onSetStage钩子\n * @param cb 回调函数\n * @param immediate 是否立刻执行,如果在回调添加之前stage就已经绑定,那么如果第二个参数为true就立刻执行回调\n */\n onSetStage(cb: (g: IGraphic, stage: IStage) => void, immediate: boolean = false) {\n this._onSetStage = cb;\n if (immediate && this.stage) {\n cb(this, this.stage);\n }\n }\n\n /******************** shadow graphic *********************/\n attachShadow(shadowRoot?: IShadowRoot) {\n if (shadowRoot) {\n shadowRoot.shadowHost = this;\n }\n\n this.shadowRoot = shadowRoot ?? application.graphicService.creator.shadowRoot(this);\n this.addUpdateBoundTag();\n this.shadowRoot.setStage(this.stage, this.layer);\n return this.shadowRoot;\n }\n\n detachShadow() {\n if (this.shadowRoot) {\n this.addUpdateBoundTag();\n this.shadowRoot = null;\n }\n }\n\n toJson(): IGraphicJson {\n return {\n attribute: this.attribute,\n _uid: this._uid,\n type: this.type,\n name: this.name,\n children: this.children.map((item: IGraphic) => item.toJson())\n };\n }\n\n createPathProxy(path?: string) {\n if (isString(path, true)) {\n this.pathProxy = new CustomPath2D().fromString(path as string);\n } else {\n this.pathProxy = new CustomPath2D();\n }\n\n return this.pathProxy;\n }\n\n loadImage(image: any, background: boolean = false) {\n if (!image || (background && backgroundNotImage(image))) {\n return;\n }\n const url = image;\n if (!this.resources) {\n this.resources = new Map();\n }\n const cache: {\n state: 'loading' | 'success' | 'init' | 'fail';\n data: any;\n } = {\n data: 'init',\n state: null\n };\n this.resources.set(url, cache);\n if (typeof image === 'string') {\n cache.state = 'loading';\n if (image.startsWith('<svg')) {\n // TODO 封装isSvg到@visactor/vutils\n ResourceLoader.GetSvg(image, this);\n this.backgroundImg = this.backgroundImg || background;\n } else if (isValidUrl(image) || image.includes('/') || isBase64(image)) {\n ResourceLoader.GetImage(image, this);\n this.backgroundImg = this.backgroundImg || background;\n }\n } else if (isObject(image)) {\n (cache.state = 'success'), (cache.data = image);\n this.backgroundImg = this.backgroundImg || background;\n } else {\n cache.state = 'fail';\n }\n }\n\n setShadowGraphic(graphic: IGraphic) {\n if (!graphic) {\n this.detachShadow();\n } else {\n const root = this.attachShadow();\n root.add(graphic);\n }\n }\n\n imageLoadSuccess(url: string, image: HTMLImageElement, cb?: () => void) {\n // 更新属性\n // this.resourceState = 'success';\n // this.resource = image;\n if (!this.resources) {\n return;\n }\n const res = this.resources.get(url);\n if (!res) {\n return;\n }\n res.state = 'success';\n res.data = image;\n\n cb && cb();\n\n // 触发重绘\n // 暂时全量,TODO 启动局部重绘\n // this.stage.enableDirtyBounds();\n // this.stage.dirty(this.AABBBounds);\n this.addUpdateBoundTag(); // 添加bounds更新tag重绘才会绘制这个mark\n this.stage && this.stage.renderNextFrame();\n }\n\n imageLoadFail(url: string, cb?: () => void) {\n if (!this.resources) {\n return;\n }\n const res = this.resources.get(url);\n if (!res) {\n return;\n }\n res.state = 'fail';\n\n cb && cb();\n }\n\n private _stopAnimates(animates: Map<string | number, IAnimate>) {\n if (animates) {\n animates.forEach(animate => {\n animate.stop();\n });\n }\n }\n\n stopAnimates(stopChildren: boolean = false) {\n this._stopAnimates(this.animates);\n\n if (this.shadowRoot) {\n // 停止所有影子节点的动画\n this.shadowRoot.stopAnimates(true);\n }\n if (this.isContainer && stopChildren) {\n this.forEachChildren((c: IGraphic) => {\n c.stopAnimates(stopChildren);\n });\n }\n }\n\n release(): void {\n this.releaseStatus = 'released';\n application.graphicService.onRelease(this);\n }\n\n protected _emitCustomEvent(type: string, context?: any) {\n if (this._events && type in this._events) {\n const changeEvent = new CustomEvent(type, context);\n changeEvent.bubbles = false;\n\n (changeEvent as any).manager = (this.stage as any)?.eventSystem?.manager;\n this.dispatchEvent(changeEvent);\n }\n }\n\n abstract getNoWorkAnimateAttr(): Record<string, number>;\n\n abstract clone(): IGraphic<any>;\n}\n\nGraphic.mixin(EventTarget);\n\nfunction backgroundNotImage(image: any) {\n if (image.fill || image.stroke) {\n return true;\n }\n return false;\n}\n"]}
1
+ {"version":3,"sources":["../src/graphic/graphic.ts"],"names":[],"mappings":";;;AAEA,6CAA6C;AAC7C,6CAW0B;AAY1B,2CAAmC;AAanC,oCAAoD;AACpD,qCAA4C;AAC5C,gDAA6C;AAC7C,wCAAgE;AAChE,6DAA+D;AAC/D,2DAAuD;AACvD,sDAA2D;AAC3D,2CAAoF;AACpF,6DAAyD;AACzD,uEAAkE;AAClE,2CAA+C;AAmC/C,MAAM,UAAU,GAAG,IAAI,eAAM,EAAE,CAAC;AAChC,MAAM,UAAU,GAAG,IAAI,mBAAU,EAAE,CAAC;AAEvB,QAAA,cAAc,GAAG;IAC5B,QAAQ;IACR,SAAS;IACT,eAAe;IACf,UAAU;IACV,gBAAgB;IAChB,SAAS;IACT,UAAU;IACV,YAAY;IACZ,MAAM;IACN,aAAa;CACd,CAAC;AAEW,QAAA,sBAAsB,GAAG;IACpC,WAAW;IAIX,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,SAAS;CACV,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AACrC,MAAM,sBAAsB,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AACpD,MAAM,oBAAoB,GAAG,CAAC,OAAO,CAAC,CAAC;AAEvC,MAAM,KAAK,GAAG,IAAI,cAAK,EAAE,CAAC;AAEb,QAAA,mBAAmB,GAAG;IACjC,SAAS,EAAE,CAAC;IACZ,aAAa,EAAE,CAAC;IAChB,QAAQ,EAAE,CAAC;IACX,UAAU,EAAE,CAAC;IACb,eAAe,EAAE,CAAC;IAClB,QAAQ,EAAE,CAAC;IACX,gBAAgB,EAAE,CAAC;IACnB,OAAO,EAAE,CAAC;IACV,MAAM,EAAE,CAAC;IACT,MAAM,E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I,CAAC;KACb;IACD,OAAO,KAAK,CAAC;AACf,CAAC","file":"graphic.js","sourcesContent":["import type { ICustomPath2D } from './../interface/path';\nimport type { Dict, IPointLike, IAABBBounds, IOBBBounds } from '@visactor/vutils';\nimport { OBBBounds } from '@visactor/vutils';\nimport {\n AABBBounds,\n Matrix,\n normalTransform,\n Point,\n isNil,\n has,\n isString,\n isValidUrl,\n isBase64,\n isObject\n} from '@visactor/vutils';\nimport type {\n GraphicType,\n IAnimateConfig,\n IGraphicAttribute,\n IGraphic,\n IGraphicAnimateParams,\n IGraphicJson,\n ISetAttributeContext,\n ITransform,\n GraphicReleaseStatus\n} from '../interface/graphic';\nimport { Node } from './node-tree';\nimport type {\n IAnimate,\n IAnimateTarget,\n IGlyphGraphicAttribute,\n IGroup,\n ILayer,\n IPickerService,\n IShadowRoot,\n IStage,\n IStep,\n ISubAnimate\n} from '../interface';\nimport { EventTarget, CustomEvent } from '../event';\nimport { DefaultTransform } from './config';\nimport { application } from '../application';\nimport { Animate, DefaultStateAnimateConfig } from '../animate';\nimport { interpolateColor } from '../color-string/interpolate';\nimport { CustomPath2D } from '../common/custom-path2d';\nimport { ResourceLoader } from '../resource-loader/loader';\nimport { AttributeUpdateType, IContainPointMode, UpdateTag } from '../common/enums';\nimport { BoundsContext } from '../common/bounds-context';\nimport { renderCommandList } from '../common/render-command-list';\nimport { parsePadding } from '../common/utils';\n\n/**\n * pathProxy参考自zrender\n * BSD 3-Clause License\n\n Copyright (c) 2017, Baidu Inc.\n All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n\n * Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\n * Neither the name of the copyright holder nor the names of its\n contributors may be used to endorse or promote products derived from\n this software without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\n FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\nconst tempMatrix = new Matrix();\nconst tempBounds = new AABBBounds();\n\nexport const PURE_STYLE_KEY = [\n 'stroke',\n 'opacity',\n 'strokeOpacity',\n 'lineDash',\n 'lineDashOffset',\n 'lineCap',\n 'lineJoin',\n 'miterLimit',\n 'fill',\n 'fillOpacity'\n];\n\nexport const GRAPHIC_UPDATE_TAG_KEY = [\n 'lineWidth',\n // 'lineCap',\n // 'lineJoin',\n // 'miterLimit',\n 'scaleX',\n 'scaleY',\n 'angle',\n 'anchor',\n 'visible'\n];\n\nconst tempConstantXYKey = ['x', 'y'];\nconst tempConstantScaleXYKey = ['scaleX', 'scaleY'];\nconst tempConstantAngleKey = ['angle'];\n\nconst point = new Point();\n\nexport const NOWORK_ANIMATE_ATTR = {\n strokeSeg: 1,\n boundsPadding: 2,\n pickMode: 1,\n boundsMode: 1,\n customPickShape: 1,\n pickable: 1,\n childrenPickable: 1,\n visible: 1,\n zIndex: 1,\n layout: 1,\n keepDirIn3d: 1,\n globalZIndex: 1,\n\n outerBorder: 1,\n innerBorder: 1,\n lineDash: 1,\n lineCap: 1,\n lineJoin: 1,\n miterLimit: 2,\n strokeBoundsBuffer: 2,\n\n scaleCenter: 1,\n anchor: 1,\n anchor3d: 1,\n postMatrix: 1,\n\n backgroundMode: 2,\n background: 1,\n texture: 1,\n cursor: 1,\n html: 1\n};\n\n/**\n * globalTransMatrix更新逻辑\n * 1. group的transform修改,会下发到所有下层group,将所有下层的tag修改\n * 2. 叶子graphic每次获取globalTransMatrix都重新计算\n * 3. 所有节点的transform修改,或者globalTransform修改,都会下发到自己的shadowRoot上\n */\n\nexport abstract class Graphic<T extends Partial<IGraphicAttribute> = Partial<IGraphicAttribute>>\n extends Node\n implements IGraphic<T>, IAnimateTarget\n{\n /**\n * Mixes all enumerable properties and methods from a source object to Element.\n * @param source - The source of properties and methods to mix in.\n */\n static mixin(source: Dict<any>): void {\n // in ES8/ES2017, this would be really easy:\n // Object.defineProperties(Element.prototype, Object.getOwnPropertyDescriptors(source));\n\n // get all the enumerable property keys\n const keys = Object.keys(source);\n\n // loop through properties\n for (let i = 0; i < keys.length; ++i) {\n const propertyName = keys[i];\n\n // Set the property using the property descriptor - this works for accessors and normal value properties\n Object.defineProperty(\n Graphic.prototype,\n propertyName,\n Object.getOwnPropertyDescriptor(source, propertyName) as PropertyDecorator\n );\n }\n }\n\n declare _events?: any;\n\n declare onBeforeAttributeUpdate?: (\n val: any,\n attributes: Partial<T>,\n key: null | string | string[],\n context?: ISetAttributeContext\n ) => T | undefined;\n declare parent: any;\n\n declare resources?: Map<\n string,\n { state: 'init' | 'loading' | 'success' | 'fail'; data?: HTMLImageElement | HTMLCanvasElement }\n >;\n declare backgroundImg?: boolean;\n\n declare type: GraphicType;\n declare prefixed: string;\n declare numberType: number;\n declare isContainer?: boolean;\n declare valid: boolean;\n declare stage?: IStage;\n declare layer?: ILayer;\n declare incremental?: number;\n declare glyphHost?: IGraphic<IGlyphGraphicAttribute>;\n declare _onSetStage?: (g: IGraphic, stage: IStage, layer: ILayer) => void;\n // declare _beforeAttributeUpdate?: (key: string | string, value: any) => void;\n // 标记是否是在3d模式下\n declare in3dMode?: boolean;\n\n // aabbBounds,所有图形都需要有,所以初始化即赋值\n protected declare _AABBBounds: IAABBBounds;\n get AABBBounds(): IAABBBounds {\n return this.tryUpdateAABBBounds(this.attribute.boundsMode === 'imprecise');\n }\n // 具有旋转的包围盒,部分图元需要,动态初始化\n protected declare _OBBBounds?: IOBBBounds;\n get OBBBounds(): IOBBBounds {\n return this.tryUpdateOBBBounds();\n }\n protected declare _globalAABBBounds: IAABBBounds;\n // 全局包围盒,部分图元需要,动态初始化,建议使用AABBBounds\n get globalAABBBounds(): IAABBBounds {\n return this.tryUpdateGlobalAABBBounds();\n }\n protected declare _transMatrix: Matrix;\n get transMatrix(): Matrix {\n return this.tryUpdateLocalTransMatrix(true);\n }\n protected declare _globalTransMatrix: Matrix;\n get globalTransMatrix(): Matrix {\n return this.tryUpdateGlobalTransMatrix(true);\n }\n protected declare _updateTag: number;\n\n // 上次更新的stamp\n declare stamp?: number;\n\n declare attribute: T;\n\n declare shadowRoot?: IShadowRoot;\n\n declare releaseStatus?: GraphicReleaseStatus;\n\n /** 记录state对应的图形属性 */\n declare states?: Record<string, Partial<T>>;\n /** 当前state值 */\n declare currentStates?: string[];\n /** TODO: state更新对应的动画配置 */\n declare stateAnimateConfig?: IAnimateConfig;\n /** 记录应用state之前,attribute对应的原始图形属性 */\n declare normalAttrs?: Partial<T>;\n /** 获取state图形属性的方法 */\n declare stateProxy?: (stateName: string, targetStates?: string[]) => T;\n declare animates: Map<string | number, IAnimate>;\n\n declare nextAttrs?: T;\n declare prevAttrs?: T;\n declare finalAttrs?: T;\n\n declare pathProxy?: ICustomPath2D;\n // 依附于某个theme,如果该节点不存在parent,那么这个Theme就作为节点的Theme,避免添加到节点前计算属性\n declare attachedThemeGraphic?: IGraphic;\n protected updateAABBBoundsStamp: number;\n protected updateOBBBoundsStamp?: number;\n\n constructor(params: T = {} as T) {\n super();\n this._AABBBounds = new AABBBounds();\n this._updateTag = UpdateTag.INIT;\n this.attribute = params;\n this.valid = this.isValid();\n this.updateAABBBoundsStamp = 0;\n if (params.background) {\n this.loadImage((params.background as any).background ?? params.background, true);\n } else if (params.shadowGraphic) {\n this.setShadowGraphic(params.shadowGraphic);\n }\n }\n\n setMode(mode: '2d' | '3d') {\n mode === '3d' ? this.set3dMode() : this.set2dMode();\n }\n\n set3dMode() {\n this.in3dMode = true;\n }\n set2dMode() {\n this.in3dMode = false;\n }\n getOffsetXY(attr?: ITransform, includeScroll: boolean = false) {\n const { dx = attr.dx, dy = attr.dy } = this.attribute;\n if (includeScroll && this.parent) {\n // const groupTheme = getTheme(this.parent).group;\n const attribute = this.parent.attribute;\n point.x = dx + (attribute.scrollX ?? 0);\n point.y = dy + (attribute.scrollY ?? 0);\n } else {\n point.x = dx;\n point.y = dy;\n }\n return point;\n }\n\n onAnimateBind(animate: IAnimate | ISubAnimate) {\n this._emitCustomEvent('animate-bind', animate);\n }\n\n protected tryUpdateAABBBounds(full?: boolean): IAABBBounds {\n if (!this.shouldUpdateAABBBounds()) {\n return this._AABBBounds;\n }\n if (!this.valid) {\n this._AABBBounds.clear();\n return this._AABBBounds;\n }\n\n application.graphicService.beforeUpdateAABBBounds(this, this.stage, true, this._AABBBounds);\n const bounds = this.doUpdateAABBBounds(full);\n // this.addUpdateLayoutTag();\n application.graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, true);\n return bounds;\n }\n\n protected tryUpdateOBBBounds(): IOBBBounds {\n if (!this._OBBBounds) {\n this._OBBBounds = new OBBBounds();\n }\n // 尝试更新AABBBounds\n this.tryUpdateAABBBounds();\n // 如果AABBBounds和OBBBounds不一致,则重新计算OBBBounds\n if (this.updateOBBBoundsStamp === this.updateAABBBoundsStamp) {\n return this._OBBBounds;\n }\n this.updateOBBBoundsStamp = this.updateAABBBoundsStamp;\n if (!this.valid) {\n this._OBBBounds.clear();\n return this._OBBBounds;\n }\n\n const bounds = this.doUpdateOBBBounds();\n return bounds;\n }\n\n protected combindShadowAABBBounds(bounds: IAABBBounds) {\n // 合并shadowRoot的Bounds\n if (this.shadowRoot) {\n const b = this.shadowRoot.AABBBounds.clone();\n bounds.union(b);\n }\n }\n\n abstract getGraphicTheme(): T;\n\n protected doUpdateOBBBounds(): IOBBBounds {\n return this._OBBBounds;\n }\n\n protected abstract updateAABBBounds(\n attribute: T,\n symbolTheme: Required<T>,\n aabbBounds: IAABBBounds,\n full?: boolean\n ): IAABBBounds;\n\n protected doUpdateAABBBounds(full?: boolean): IAABBBounds {\n this.updateAABBBoundsStamp++;\n const graphicTheme = this.getGraphicTheme();\n this._AABBBounds.clear();\n const attribute = this.attribute;\n const bounds = this.updateAABBBounds(attribute, graphicTheme as Required<T>, this._AABBBounds, full) as AABBBounds;\n\n const { boundsPadding = graphicTheme.boundsPadding } = attribute;\n const paddingArray = parsePadding(boundsPadding);\n if (paddingArray) {\n bounds.expand(paddingArray);\n }\n\n this.clearUpdateBoundTag();\n return bounds;\n }\n\n updatePathProxyAABBBounds(aabbBounds: IAABBBounds): boolean {\n const path = typeof this.pathProxy === 'function' ? (this.pathProxy as any)(this.attribute) : this.pathProxy;\n if (!path) {\n return false;\n }\n const boundsContext = new BoundsContext(aabbBounds);\n renderCommandList(path.commandList, boundsContext, 0, 0);\n return true;\n }\n\n protected tryUpdateGlobalAABBBounds(): IAABBBounds {\n const b = this.AABBBounds;\n if (!this._globalAABBBounds) {\n this._globalAABBBounds = b.clone();\n } else {\n this._globalAABBBounds.setValue(b.x1, b.y1, b.x2, b.y2);\n }\n if (this._globalAABBBounds.empty()) {\n return this._globalAABBBounds;\n }\n // 使用parent的grloalAABBBounds\n // todo: 考虑是否需要性能优化\n if (this.parent) {\n this._globalAABBBounds.transformWithMatrix((this.parent as IGroup).globalTransMatrix);\n }\n return this._globalAABBBounds;\n }\n\n /**\n * 这里都是叶子节点的UpdateGlobalTransMatrix函数,只要走进来就直接计算\n * @param clearTag\n * @returns\n */\n protected tryUpdateGlobalTransMatrix(clearTag: boolean = true): Matrix {\n if (!this._globalTransMatrix) {\n this._globalTransMatrix = this.parent\n ? (this.parent as IGroup).globalTransMatrix.clone()\n : this.transMatrix.clone();\n } else if (this.parent) {\n const m = (this.parent as IGroup).globalTransMatrix;\n this._globalTransMatrix.setValue(m.a, m.b, m.c, m.d, m.e, m.f);\n }\n if (this.shouldUpdateGlobalMatrix()) {\n this.doUpdateGlobalMatrix();\n }\n return this._globalTransMatrix;\n }\n\n shouldUpdateGlobalMatrix(): boolean {\n return true;\n }\n\n protected tryUpdateLocalTransMatrix(clearTag: boolean = true) {\n if (!this._transMatrix) {\n this._transMatrix = new Matrix();\n }\n if (this.shouldUpdateLocalMatrix()) {\n this.doUpdateLocalMatrix();\n clearTag && this.clearUpdateLocalPositionTag();\n }\n return this._transMatrix;\n }\n\n shouldUpdateAABBBounds(): boolean {\n // 如果存在shadowRoot,那么判断shadowRoot是否需要更新\n if (this.shadowRoot) {\n return (\n (!!(this._updateTag & UpdateTag.UPDATE_BOUNDS) || this.shadowRoot.shouldUpdateAABBBounds()) &&\n application.graphicService.validCheck(\n this.attribute,\n this.getGraphicTheme() as Required<T>,\n this._AABBBounds,\n this\n )\n );\n }\n return (\n !!(this._updateTag & UpdateTag.UPDATE_BOUNDS) &&\n application.graphicService.validCheck(\n this.attribute,\n this.getGraphicTheme() as Required<T>,\n this._AABBBounds,\n this\n )\n );\n }\n\n // 自身变化导致的AABBBounds的变化\n shouldSelfChangeUpdateAABBBounds(): boolean {\n // 如果存在shadowRoot,那么判断shadowRoot是否需要更新\n if (this.shadowRoot) {\n return !!(this._updateTag & UpdateTag.UPDATE_BOUNDS) || this.shadowRoot.shouldUpdateAABBBounds();\n }\n return !!(this._updateTag & UpdateTag.UPDATE_BOUNDS);\n }\n\n protected shouldUpdateLocalMatrix(): boolean {\n return !!(this._updateTag & UpdateTag.UPDATE_LOCAL_MATRIX);\n }\n\n isValid(): boolean {\n const attribute = this.attribute;\n return Number.isFinite((attribute.x ?? 0) + (attribute.y ?? 0));\n }\n\n protected _validNumber(num?: number) {\n return num == null || Number.isFinite(num);\n }\n\n shouldUpdateShape(): boolean {\n return !!(this._updateTag & UpdateTag.UPDATE_SHAPE);\n }\n clearUpdateShapeTag() {\n this._updateTag &= UpdateTag.CLEAR_SHAPE;\n }\n\n /**\n * 是否包含某个点(点需要是全局坐标系)\n * @param x\n * @param y\n * @param mode\n * @returns\n */\n containsPoint(x: number, y: number, mode: IContainPointMode, picker?: IPickerService): boolean {\n if (!picker) {\n return false;\n }\n if (mode === IContainPointMode.GLOBAL) {\n // 转换x,y更精准\n const point = new Point(x, y);\n if (this.parent) {\n this.parent.globalTransMatrix.transformPoint(point, point);\n }\n x = point.x;\n y = point.y;\n }\n return picker.containsPoint(this, { x, y });\n }\n\n setAttributes(params: Partial<T>, forceUpdateTag: boolean = false, context?: ISetAttributeContext) {\n params =\n (this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context)) || params;\n\n if (params.background) {\n this.loadImage(params.background, true);\n } else if (params.shadowGraphic) {\n this.setShadowGraphic(params.shadowGraphic);\n }\n this._setAttributes(params, forceUpdateTag, context);\n }\n\n _setAttributes(params: Partial<T>, forceUpdateTag: boolean = false, context?: ISetAttributeContext) {\n const keys = Object.keys(params);\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n\n (this.attribute as any)[key] = (params as any)[key];\n }\n this.valid = this.isValid();\n // 没有设置shape&bounds的tag\n if (!this.updateShapeAndBoundsTagSetted() && (forceUpdateTag || this.needUpdateTags(keys))) {\n this.addUpdateShapeAndBoundsTag();\n } else {\n this.addUpdateBoundTag();\n }\n this.addUpdatePositionTag();\n this.addUpdateLayoutTag();\n this.onAttributeUpdate(context);\n }\n\n setAttribute(key: string, value: any, forceUpdateTag?: boolean, context?: ISetAttributeContext) {\n const params =\n this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate({ [key]: value }, this.attribute, key, context);\n if (!params) {\n if (!isNil((this.normalAttrs as any)?.[key])) {\n (this.normalAttrs as any)[key] = value;\n } else {\n (this.attribute as any)[key] = value;\n this.valid = this.isValid();\n if (!this.updateShapeAndBoundsTagSetted() && (forceUpdateTag || this.needUpdateTag(key))) {\n this.addUpdateShapeAndBoundsTag();\n } else {\n this.addUpdateBoundTag();\n }\n this.addUpdatePositionTag();\n this.addUpdateLayoutTag();\n this.onAttributeUpdate(context);\n }\n } else {\n this._setAttributes(params, forceUpdateTag, context);\n }\n if (key === 'background') {\n this.loadImage(value, true);\n } else if (key === 'shadowGraphic') {\n this.setShadowGraphic(value);\n }\n }\n\n protected needUpdateTags(keys: string[], k: string[] = GRAPHIC_UPDATE_TAG_KEY): boolean {\n for (let i = 0; i < k.length; i++) {\n const attrKey = k[i];\n if (keys.indexOf(attrKey) !== -1) {\n return true;\n }\n }\n return false;\n }\n\n protected needUpdateTag(key: string, k: string[] = GRAPHIC_UPDATE_TAG_KEY): boolean {\n for (let i = 0; i < k.length; i++) {\n const attrKey = k[i];\n if (key === attrKey) {\n return true;\n }\n }\n return false;\n }\n\n initAttributes(params: T) {\n // this.setAttributes(params, true);\n const context = { type: AttributeUpdateType.INIT };\n params =\n (this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context)) || params;\n this.attribute = params;\n if (params.background) {\n this.loadImage(params.background, true);\n } else if (params.shadowGraphic) {\n this.setShadowGraphic(params.shadowGraphic);\n }\n this._updateTag = UpdateTag.INIT;\n this.valid = this.isValid();\n this.onAttributeUpdate(context);\n }\n\n translate(x: number, y: number) {\n if (x === 0 && y === 0) {\n return this;\n }\n const context = {\n type: AttributeUpdateType.TRANSLATE\n };\n const params =\n this.onBeforeAttributeUpdate &&\n this.onBeforeAttributeUpdate({ x, y }, this.attribute, tempConstantXYKey, context);\n if (params) {\n x = params.x;\n y = params.y;\n delete params.x;\n delete params.y;\n this._setAttributes(params);\n }\n const attribute = this.attribute;\n const postMatrix = attribute.postMatrix;\n if (!postMatrix) {\n attribute.x = (attribute.x ?? DefaultTransform.x) + x;\n attribute.y = (attribute.y ?? DefaultTransform.y) + y;\n } else {\n application.transformUtil.fromMatrix(postMatrix, postMatrix).translate(x, y);\n }\n\n this.addUpdatePositionTag();\n this.addUpdateBoundTag();\n this.addUpdateLayoutTag();\n this.onAttributeUpdate(context);\n return this;\n }\n\n translateTo(x: number, y: number) {\n const attribute = this.attribute;\n if (attribute.x === x && attribute.y === y) {\n return this;\n }\n const context = {\n type: AttributeUpdateType.TRANSLATE_TO\n };\n const params =\n this.onBeforeAttributeUpdate &&\n this.onBeforeAttributeUpdate({ x, y }, this.attribute, tempConstantXYKey, context);\n if (params) {\n this._setAttributes(params, false, context);\n return this;\n }\n attribute.x = x;\n attribute.y = y;\n this.addUpdatePositionTag();\n this.addUpdateBoundTag();\n this.addUpdateLayoutTag();\n this.onAttributeUpdate(context);\n return this;\n }\n\n scale(scaleX: number, scaleY: number, scaleCenter?: IPointLike) {\n if (scaleX === 1 && scaleY === 1) {\n return this;\n }\n const context = {\n type: AttributeUpdateType.SCALE\n };\n const params =\n this.onBeforeAttributeUpdate &&\n this.onBeforeAttributeUpdate({ scaleX, scaleY, scaleCenter }, this.attribute, tempConstantScaleXYKey, context);\n if (params) {\n scaleX = params.scaleX;\n scaleY = params.scaleY;\n delete params.scaleX;\n delete params.scaleY;\n this._setAttributes(params);\n }\n const attribute = this.attribute;\n if (!scaleCenter) {\n attribute.scaleX = (attribute.scaleX ?? DefaultTransform.scaleX) * scaleX;\n attribute.scaleY = (attribute.scaleY ?? DefaultTransform.scaleY) * scaleY;\n } else {\n let { postMatrix } = this.attribute;\n if (!postMatrix) {\n postMatrix = new Matrix();\n attribute.postMatrix = postMatrix;\n }\n application.transformUtil.fromMatrix(postMatrix, postMatrix).scale(scaleX, scaleY, scaleCenter);\n }\n this.addUpdatePositionTag();\n this.addUpdateBoundTag();\n this.addUpdateLayoutTag();\n this.onAttributeUpdate(context);\n return this;\n }\n\n scaleTo(scaleX: number, scaleY: number) {\n const attribute = this.attribute;\n if (attribute.scaleX === scaleX && attribute.scaleY === scaleY) {\n return this;\n }\n const context = {\n type: AttributeUpdateType.SCALE_TO\n };\n const params =\n this.onBeforeAttributeUpdate &&\n this.onBeforeAttributeUpdate({ scaleX, scaleY }, this.attribute, tempConstantScaleXYKey, context);\n if (params) {\n this._setAttributes(params, false, context);\n return this;\n }\n attribute.scaleX = scaleX;\n attribute.scaleY = scaleY;\n this.addUpdatePositionTag();\n this.addUpdateBoundTag();\n this.addUpdateLayoutTag();\n this.onAttributeUpdate(context);\n return this;\n }\n\n rotate(angle: number, rotateCenter?: IPointLike) {\n if (angle === 0) {\n return this;\n }\n const context = { type: AttributeUpdateType.ROTATE };\n const params =\n this.onBeforeAttributeUpdate &&\n this.onBeforeAttributeUpdate({ angle, rotateCenter }, this.attribute, tempConstantAngleKey, context);\n if (params) {\n delete params.angle;\n this._setAttributes(params, false, context);\n // return this;\n }\n const attribute = this.attribute;\n if (!rotateCenter) {\n attribute.angle = (attribute.angle ?? DefaultTransform.angle) + angle;\n } else {\n let { postMatrix } = this.attribute;\n if (!postMatrix) {\n postMatrix = new Matrix();\n attribute.postMatrix = postMatrix;\n }\n application.transformUtil.fromMatrix(postMatrix, postMatrix).rotate(angle, rotateCenter);\n }\n this.addUpdatePositionTag();\n this.addUpdateBoundTag();\n this.addUpdateLayoutTag();\n this.onAttributeUpdate(context);\n return this;\n }\n\n rotateTo(angle: number) {\n const attribute = this.attribute;\n if (attribute.angle === angle) {\n return this;\n }\n const context = {\n type: AttributeUpdateType.ROTATE_TO\n };\n const params =\n this.onBeforeAttributeUpdate &&\n this.onBeforeAttributeUpdate(angle, this.attribute, tempConstantAngleKey, context);\n if (params) {\n this._setAttributes(params, false, context);\n return this;\n }\n attribute.angle = angle;\n this.addUpdatePositionTag();\n this.addUpdateBoundTag();\n this.addUpdateLayoutTag();\n this.onAttributeUpdate(context);\n return this;\n }\n\n skewTo(b: number, c: number) {\n return this;\n }\n\n animate(params?: IGraphicAnimateParams) {\n if (!this.animates) {\n this.animates = new Map();\n }\n const animate = new Animate(params?.id, this.stage && this.stage.getTimeline(), params?.slience);\n\n animate.bind(this);\n if (params) {\n const { onStart, onFrame, onEnd, onRemove } = params;\n onStart != null && animate.onStart(onStart);\n onFrame != null && animate.onFrame(onFrame);\n onEnd != null && animate.onEnd(onEnd);\n onRemove != null && animate.onRemove(onRemove);\n animate.interpolateFunc = params.interpolate;\n }\n this.animates.set(animate.id, animate);\n animate.onRemove(() => {\n this.animates.delete(animate.id);\n });\n\n return animate;\n }\n\n onAttributeUpdate(context?: ISetAttributeContext) {\n if (context && context.skipUpdateCallback) {\n return;\n }\n application.graphicService.onAttributeUpdate(this);\n this._emitCustomEvent('afterAttributeUpdate', context);\n }\n\n // hasListener(event: string) {\n // const prefix = this.prefixed;\n // var evt = prefix ? prefix + event : event;\n // return this._events[evt];\n // }\n\n update(d?: { bounds: boolean; trans: boolean }) {\n if (d) {\n d.bounds && this.tryUpdateAABBBounds(this.attribute.boundsMode === 'imprecise');\n d.trans && this.tryUpdateLocalTransMatrix();\n } else {\n this.tryUpdateAABBBounds(this.attribute.boundsMode === 'imprecise');\n this.tryUpdateLocalTransMatrix();\n }\n }\n\n hasState(stateName?: string) {\n if (!this.currentStates || !this.currentStates.length) {\n return false;\n }\n\n if (!isNil(stateName)) {\n return this.currentStates.includes(stateName);\n }\n\n return true;\n }\n getState(stateName: string) {\n return this.states?.[stateName];\n }\n\n applyStateAttrs(attrs: Partial<T>, stateNames: string[], hasAnimation?: boolean, isClear?: boolean) {\n if (hasAnimation) {\n const keys = Object.keys(attrs);\n const noWorkAttrs = this.getNoWorkAnimateAttr();\n const animateAttrs: Partial<T> = {};\n let noAnimateAttrs: Partial<T> | undefined;\n\n keys.forEach(key => {\n if (!noWorkAttrs[key]) {\n (animateAttrs as any)[key] =\n isClear && (attrs as any)[key] === undefined ? this.getDefaultAttribute(key) : (attrs as any)[key];\n } else {\n if (!noAnimateAttrs) {\n noAnimateAttrs = {};\n }\n (noAnimateAttrs as any)[key] = (attrs as any)[key];\n }\n });\n\n const animate = this.animate({ slience: true });\n (animate as any).stateNames = stateNames;\n animate.to(\n animateAttrs,\n this.stateAnimateConfig?.duration ?? DefaultStateAnimateConfig.duration,\n this.stateAnimateConfig?.easing ?? DefaultStateAnimateConfig.easing\n );\n noAnimateAttrs && this.setAttributes(noAnimateAttrs, false, { type: AttributeUpdateType.STATE });\n } else {\n this.stopStateAnimates();\n this.setAttributes(attrs, false, { type: AttributeUpdateType.STATE });\n }\n }\n\n updateNormalAttrs(stateAttrs: Partial<T>) {\n const newNormalAttrs = {};\n if (this.normalAttrs) {\n Object.keys(stateAttrs).forEach(key => {\n if (key in this.normalAttrs) {\n (newNormalAttrs as any)[key] = (this.normalAttrs as any)[key];\n delete (this.normalAttrs as any)[key];\n } else {\n (newNormalAttrs as any)[key] = this.getNormalAttribute(key);\n }\n });\n Object.keys(this.normalAttrs).forEach(key => {\n (stateAttrs as any)[key] = (this.normalAttrs as any)[key];\n });\n } else {\n Object.keys(stateAttrs).forEach(key => {\n (newNormalAttrs as any)[key] = this.getNormalAttribute(key);\n });\n }\n\n this.normalAttrs = newNormalAttrs;\n }\n\n protected stopStateAnimates(type: 'start' | 'end' = 'end') {\n if (this.animates) {\n this.animates.forEach(animate => {\n if ((animate as any).stateNames) {\n animate.stop(type);\n this.animates.delete(animate.id);\n }\n });\n }\n }\n\n private getNormalAttribute(key: string) {\n let value = (this.attribute as any)[key];\n\n if (this.animates) {\n this.animates.forEach(animate => {\n if ((animate as any).stateNames) {\n const endProps = animate.getEndProps();\n if (has(endProps, key)) {\n value = endProps[key];\n }\n }\n });\n }\n\n return value;\n }\n\n clearStates(hasAnimation?: boolean) {\n if (this.hasState() && this.normalAttrs) {\n this.currentStates = [];\n this.applyStateAttrs(this.normalAttrs, this.currentStates, hasAnimation, true);\n } else {\n this.currentStates = [];\n }\n this.normalAttrs = null;\n }\n\n removeState(stateName: string, hasAnimation?: boolean) {\n const index = this.currentStates ? this.currentStates.indexOf(stateName) : -1;\n\n if (index >= 0) {\n const currentStates = this.currentStates.filter(state => state !== stateName);\n\n this.useStates(currentStates, hasAnimation);\n }\n }\n\n toggleState(stateName: string, hasAnimation?: boolean) {\n if (this.hasState(stateName)) {\n this.removeState(stateName, hasAnimation);\n } else {\n const index = this.currentStates ? this.currentStates.indexOf(stateName) : -1;\n if (index < 0) {\n const nextStates = this.currentStates ? this.currentStates.slice() : [];\n nextStates.push(stateName);\n this.useStates(nextStates, hasAnimation);\n }\n }\n }\n\n addState(stateName: string, keepCurrentStates?: boolean, hasAnimation?: boolean) {\n if (\n this.currentStates &&\n this.currentStates.includes(stateName) &&\n (keepCurrentStates || this.currentStates.length === 1)\n ) {\n return;\n }\n\n const newStates =\n keepCurrentStates && this.currentStates?.length ? this.currentStates.concat([stateName]) : [stateName];\n\n this.useStates(newStates, hasAnimation);\n }\n\n useStates(states: string[], hasAnimation?: boolean) {\n if (!states.length) {\n this.clearStates(hasAnimation);\n return;\n }\n\n const isChange =\n this.currentStates?.length !== states.length ||\n states.some((stateName, index) => this.currentStates[index] !== stateName);\n\n if (!isChange) {\n return;\n }\n\n const stateAttrs = {};\n states.forEach(stateName => {\n const attrs = this.stateProxy ? this.stateProxy(stateName, states) : this.states?.[stateName];\n\n if (attrs) {\n Object.assign(stateAttrs, attrs);\n }\n });\n\n this.updateNormalAttrs(stateAttrs);\n\n this.currentStates = states;\n this.applyStateAttrs(stateAttrs, states, hasAnimation);\n }\n\n addUpdateBoundTag() {\n this._updateTag |= UpdateTag.UPDATE_BOUNDS; // for bounds\n if (this.parent) {\n this.parent.addChildUpdateBoundTag();\n }\n if (this.glyphHost) {\n this.glyphHost.addUpdateBoundTag();\n }\n }\n\n addUpdateShapeTag() {\n this._updateTag |= UpdateTag.UPDATE_SHAPE; // for shape\n }\n\n addUpdateShapeAndBoundsTag() {\n this._updateTag |= UpdateTag.UPDATE_SHAPE_AND_BOUNDS; // for shape&bounds\n if (this.parent) {\n this.parent.addChildUpdateBoundTag();\n }\n if (this.glyphHost) {\n this.glyphHost.addUpdateBoundTag();\n }\n }\n\n protected updateShapeAndBoundsTagSetted(): boolean {\n return (this._updateTag & UpdateTag.UPDATE_SHAPE_AND_BOUNDS) === UpdateTag.UPDATE_SHAPE_AND_BOUNDS;\n }\n\n protected clearUpdateBoundTag() {\n this._updateTag &= UpdateTag.CLEAR_BOUNDS;\n }\n /**\n * 更新位置tag,包括全局tag和局部tag\n */\n addUpdatePositionTag() {\n // 更新shadowRoot的全局位置\n this.shadowRoot && this.shadowRoot.addUpdateGlobalPositionTag();\n this._updateTag |= UpdateTag.UPDATE_GLOBAL_LOCAL_MATRIX;\n }\n /**\n * 更新全局位置tag\n */\n addUpdateGlobalPositionTag() {\n // 更新shadowRoot的全局位置\n this.shadowRoot && this.shadowRoot.addUpdateGlobalPositionTag();\n this._updateTag |= UpdateTag.UPDATE_GLOBAL_MATRIX;\n }\n /**\n * 清除局部位置tag\n */\n protected clearUpdateLocalPositionTag() {\n this._updateTag &= UpdateTag.CLEAR_LOCAL_MATRIX;\n }\n /**\n * 清除全局位置tag\n */\n protected clearUpdateGlobalPositionTag() {\n this._updateTag &= UpdateTag.CLEAR_GLOBAL_MATRIX;\n }\n\n addUpdateLayoutTag() {\n this._updateTag |= UpdateTag.UPDATE_LAYOUT;\n }\n\n protected clearUpdateLayoutTag() {\n this._updateTag &= UpdateTag.CLEAR_LAYOUT;\n }\n\n protected needUpdateLayout(): boolean {\n return !!(this._updateTag & UpdateTag.UPDATE_LAYOUT);\n }\n\n protected getAnchor(anchor: [string | number, string | number], params: { b?: IAABBBounds }) {\n const _anchor: [number, number] = [0, 0];\n const getBounds = () => {\n if (params.b) {\n return params.b;\n }\n const { scaleX, scaleY, angle } = this.attribute;\n // 拷贝一份,避免计算bounds的过程中计算matrix,然后matrix又修改了bounds\n tempBounds.copy(this._AABBBounds);\n // @ts-ignore\n this.setAttributes({ scaleX: 1, scaleY: 1, angle: 0 });\n params.b = this.AABBBounds.clone();\n this._AABBBounds.copy(tempBounds);\n // @ts-ignore\n this.setAttributes({ scaleX, scaleY, angle });\n return params.b;\n };\n if (typeof anchor[0] === 'string') {\n const ratio = parseFloat(anchor[0]) / 100;\n const bounds = getBounds();\n _anchor[0] = bounds.x1 + (bounds.x2 - bounds.x1) * ratio;\n } else {\n _anchor[0] = anchor[0];\n }\n if (typeof anchor[1] === 'string') {\n const ratio = parseFloat(anchor[1]) / 100;\n const bounds = getBounds();\n _anchor[1] = bounds.y1 + (bounds.y2 - bounds.y1) * ratio;\n } else {\n _anchor[1] = anchor[1];\n }\n\n return _anchor;\n }\n\n /**\n * 更新局部matrix的具体函数\n */\n protected doUpdateLocalMatrix() {\n const {\n x = DefaultTransform.x,\n y = DefaultTransform.y,\n scaleX = DefaultTransform.scaleX,\n scaleY = DefaultTransform.scaleY,\n angle = DefaultTransform.angle,\n scaleCenter,\n anchor,\n postMatrix\n } = this.attribute;\n let _anchor: [number, number] = [0, 0];\n const params = {};\n if (anchor) {\n _anchor = this.getAnchor(anchor, params);\n }\n if (scaleCenter && (scaleX !== 1 || scaleY !== 1)) {\n const m = this._transMatrix;\n m.reset();\n m.translate(_anchor[0], _anchor[1]);\n m.rotate(angle);\n m.translate(-_anchor[0], -_anchor[1]);\n\n m.translate(x, y);\n // m.translate(scaleCenter[0] * scaleX, scaleCenter[1] * scaleY);\n // 计算bounds\n _anchor = this.getAnchor(scaleCenter, params);\n application.transformUtil.fromMatrix(m, m).scale(scaleX, scaleY, { x: _anchor[0], y: _anchor[1] });\n // m.translate(-scaleCenter[0], -scaleCenter[1]);\n } else {\n normalTransform(this._transMatrix, this._transMatrix.reset(), x, y, scaleX, scaleY, angle, anchor && _anchor);\n }\n const p = this.getOffsetXY(DefaultTransform);\n this._transMatrix.e += p.x;\n this._transMatrix.f += p.y;\n\n if (postMatrix) {\n const m1 = tempMatrix.setValue(\n postMatrix.a,\n postMatrix.b,\n postMatrix.c,\n postMatrix.d,\n postMatrix.e,\n postMatrix.f\n );\n const m2 = this._transMatrix;\n m1.multiply(m2.a, m2.b, m2.c, m2.d, m2.e, m2.f);\n m2.setValue(m1.a, m1.b, m1.c, m1.d, m1.e, m1.f);\n }\n }\n /**\n * 更新全局matrix的具体函数\n */\n protected doUpdateGlobalMatrix() {\n // 基于parent的matrix修改\n if (this.parent) {\n this._globalTransMatrix.multiply(\n this.transMatrix.a,\n this.transMatrix.b,\n this.transMatrix.c,\n this.transMatrix.d,\n this.transMatrix.e,\n this.transMatrix.f\n );\n const { scrollX = 0, scrollY = 0 } = this.parent.attribute;\n this._globalTransMatrix.translate(scrollX, scrollY);\n }\n }\n\n setStage(stage?: IStage, layer?: ILayer) {\n if (this.stage !== stage) {\n this.stage = stage;\n this.layer = layer;\n this.setStageToShadowRoot(stage, layer);\n if (this.animates && this.animates.size) {\n const timeline = stage.getTimeline();\n this.animates.forEach(a => {\n a.setTimeline(timeline);\n });\n }\n this._onSetStage && this._onSetStage(this, stage, layer);\n application.graphicService.onSetStage(this, stage);\n }\n }\n\n setStageToShadowRoot(stage?: IStage, layer?: ILayer) {\n if (this.shadowRoot) {\n this.shadowRoot.setStage(stage, layer);\n }\n }\n\n onAddStep(step: IStep) {\n return;\n }\n onStop(props?: Partial<T>): void {\n if (props) {\n this.setAttributes(props, false, { type: AttributeUpdateType.ANIMATE_END });\n }\n }\n // step时调用\n onStep(subAnimate: ISubAnimate, animate: IAnimate, step: IStep, ratio: number, end: boolean) {\n const nextAttributes = {};\n if (step.customAnimate) {\n step.customAnimate.update(end, ratio, nextAttributes);\n } else {\n const nextProps = step.props;\n const nextParsedProps = step.parsedProps;\n const propKeys = step.propKeys;\n this.stepInterpolate(\n subAnimate,\n animate,\n nextAttributes,\n step,\n ratio,\n end,\n nextProps,\n undefined,\n nextParsedProps,\n propKeys\n );\n }\n this.setAttributes(nextAttributes, false, {\n type: AttributeUpdateType.ANIMATE_UPDATE,\n animationState: {\n ratio,\n end,\n step,\n isFirstFrameOfStep: subAnimate.getLastStep() !== step\n }\n });\n this.stage && this.stage.renderNextFrame();\n }\n\n stepInterpolate(\n subAnimate: ISubAnimate,\n animate: IAnimate,\n nextAttributes: Record<string, any>,\n step: IStep,\n ratio: number,\n end: boolean,\n nextProps: Record<string, any>,\n lastProps?: Record<string, any>,\n nextParsedProps?: any,\n propKeys?: string[]\n ) {\n if (!propKeys) {\n propKeys = Object.keys(nextProps);\n step.propKeys = propKeys;\n }\n if (end) {\n step.propKeys.forEach(key => {\n if (!animate.validAttr(key)) {\n return;\n }\n nextAttributes[key] = nextProps[key];\n });\n } else {\n propKeys.forEach(key => {\n // 如果属性不合法,那直接return\n if (!animate.validAttr(key)) {\n return;\n }\n const nextStepVal = nextProps[key];\n const lastStepVal = (lastProps && lastProps[key]) ?? subAnimate.getLastPropByName(key, step);\n if (nextStepVal == null || lastStepVal == null || nextStepVal === lastStepVal) {\n // 用户直接调用stepInterpolate可能会走进来,如果传入的参数出现null或者undefined,直接赋值最终的值\n nextAttributes[key] = nextStepVal;\n return;\n }\n let match: boolean;\n match =\n animate.interpolateFunc && animate.interpolateFunc(key, ratio, lastStepVal, nextStepVal, nextAttributes);\n if (match) {\n return;\n }\n match = animate.customInterpolate(key, ratio, lastStepVal, nextStepVal, this, nextAttributes);\n if (match) {\n return;\n }\n if (!this.defaultInterpolate(nextStepVal, lastStepVal, key, nextAttributes, nextParsedProps, ratio)) {\n this._interpolate(key, ratio, lastStepVal, nextStepVal, nextAttributes);\n }\n });\n }\n\n step.parsedProps = nextParsedProps;\n }\n\n defaultInterpolate(\n nextStepVal: any,\n lastStepVal: any,\n key: string,\n nextAttributes: Record<string, any>,\n nextParsedProps: any,\n ratio: number\n ) {\n if (Number.isFinite(nextStepVal)) {\n nextAttributes[key] = lastStepVal + (nextStepVal - lastStepVal) * ratio;\n return true;\n } else if (key === 'fill') {\n if (!nextParsedProps) {\n nextParsedProps = {};\n }\n // 保存解析的结果到step\n const fillColorArray: [number, number, number, number] = nextParsedProps.fillColorArray;\n const color = interpolateColor(lastStepVal, fillColorArray ?? nextStepVal, ratio, false, (fArray, tArray) => {\n nextParsedProps.fillColorArray = tArray;\n });\n if (color) {\n nextAttributes[key] = color;\n }\n return true;\n } else if (key === 'stroke') {\n if (!nextParsedProps) {\n nextParsedProps = {};\n }\n // 保存解析的结果到step\n const strokeColorArray: [number, number, number, number] = nextParsedProps.strokeColorArray;\n const color = interpolateColor(lastStepVal, strokeColorArray ?? nextStepVal, ratio, false, (fArray, tArray) => {\n nextParsedProps.strokeColorArray = tArray;\n });\n if (color) {\n nextAttributes[key] = color;\n }\n return true;\n } else if (key === 'shadowColor') {\n if (!nextParsedProps) {\n nextParsedProps = {};\n }\n // 保存解析的结果到step\n const shadowColorArray: [number, number, number, number] = nextParsedProps.shadowColorArray;\n const color = interpolateColor(lastStepVal, shadowColorArray ?? nextStepVal, ratio, true, (fArray, tArray) => {\n nextParsedProps.shadowColorArray = tArray;\n });\n if (color) {\n nextAttributes[key] = color;\n }\n\n return true;\n }\n\n return false;\n }\n\n protected _interpolate(key: string, ratio: number, lastStepVal: any, nextStepVal: any, nextAttributes: any) {\n return;\n }\n\n getDefaultAttribute(name: string) {\n return (this.getGraphicTheme() as any)[name];\n }\n\n // 获取属性\n getComputedAttribute(name: string) {\n return (this.attribute as any)[name] ?? this.getDefaultAttribute(name);\n }\n /**\n * 添加onSetStage钩子\n * @param cb 回调函数\n * @param immediate 是否立刻执行,如果在回调添加之前stage就已经绑定,那么如果第二个参数为true就立刻执行回调\n */\n onSetStage(cb: (g: IGraphic, stage: IStage) => void, immediate: boolean = false) {\n this._onSetStage = cb;\n if (immediate && this.stage) {\n cb(this, this.stage);\n }\n }\n\n /******************** shadow graphic *********************/\n attachShadow(shadowRoot?: IShadowRoot) {\n if (shadowRoot) {\n shadowRoot.shadowHost = this;\n }\n\n this.shadowRoot = shadowRoot ?? application.graphicService.creator.shadowRoot(this);\n this.addUpdateBoundTag();\n this.shadowRoot.setStage(this.stage, this.layer);\n return this.shadowRoot;\n }\n\n detachShadow() {\n if (this.shadowRoot) {\n this.addUpdateBoundTag();\n this.shadowRoot = null;\n }\n }\n\n toJson(): IGraphicJson {\n return {\n attribute: this.attribute,\n _uid: this._uid,\n type: this.type,\n name: this.name,\n children: this.children.map((item: IGraphic) => item.toJson())\n };\n }\n\n createPathProxy(path?: string) {\n if (isString(path, true)) {\n this.pathProxy = new CustomPath2D().fromString(path as string);\n } else {\n this.pathProxy = new CustomPath2D();\n }\n\n return this.pathProxy;\n }\n\n loadImage(image: any, background: boolean = false) {\n if (!image || (background && backgroundNotImage(image))) {\n return;\n }\n const url = image;\n if (!this.resources) {\n this.resources = new Map();\n }\n const cache: {\n state: 'loading' | 'success' | 'init' | 'fail';\n data: any;\n } = {\n data: 'init',\n state: null\n };\n this.resources.set(url, cache);\n if (typeof image === 'string') {\n cache.state = 'loading';\n if (image.startsWith('<svg')) {\n // TODO 封装isSvg到@visactor/vutils\n ResourceLoader.GetSvg(image, this);\n this.backgroundImg = this.backgroundImg || background;\n } else if (isValidUrl(image) || image.includes('/') || isBase64(image)) {\n ResourceLoader.GetImage(image, this);\n this.backgroundImg = this.backgroundImg || background;\n }\n } else if (isObject(image)) {\n (cache.state = 'success'), (cache.data = image);\n this.backgroundImg = this.backgroundImg || background;\n } else {\n cache.state = 'fail';\n }\n }\n\n setShadowGraphic(graphic: IGraphic) {\n if (!graphic) {\n this.detachShadow();\n } else {\n const root = this.attachShadow();\n root.add(graphic);\n }\n }\n\n imageLoadSuccess(url: string, image: HTMLImageElement, cb?: () => void) {\n // 更新属性\n // this.resourceState = 'success';\n // this.resource = image;\n if (!this.resources) {\n return;\n }\n const res = this.resources.get(url);\n if (!res) {\n return;\n }\n res.state = 'success';\n res.data = image;\n\n cb && cb();\n\n // 触发重绘\n // 暂时全量,TODO 启动局部重绘\n // this.stage.enableDirtyBounds();\n // this.stage.dirty(this.AABBBounds);\n this.addUpdateBoundTag(); // 添加bounds更新tag重绘才会绘制这个mark\n this.stage && this.stage.renderNextFrame();\n }\n\n imageLoadFail(url: string, cb?: () => void) {\n if (!this.resources) {\n return;\n }\n const res = this.resources.get(url);\n if (!res) {\n return;\n }\n res.state = 'fail';\n\n cb && cb();\n }\n\n private _stopAnimates(animates: Map<string | number, IAnimate>) {\n if (animates) {\n animates.forEach(animate => {\n animate.stop();\n });\n }\n }\n\n stopAnimates(stopChildren: boolean = false) {\n this._stopAnimates(this.animates);\n\n if (this.shadowRoot) {\n // 停止所有影子节点的动画\n this.shadowRoot.stopAnimates(true);\n }\n if (this.isContainer && stopChildren) {\n this.forEachChildren((c: IGraphic) => {\n c.stopAnimates(stopChildren);\n });\n }\n }\n\n release(): void {\n this.releaseStatus = 'released';\n application.graphicService.onRelease(this);\n }\n\n protected _emitCustomEvent(type: string, context?: any) {\n if (this._events && type in this._events) {\n const changeEvent = new CustomEvent(type, context);\n changeEvent.bubbles = false;\n\n (changeEvent as any).manager = (this.stage as any)?.eventSystem?.manager;\n this.dispatchEvent(changeEvent);\n }\n }\n\n abstract getNoWorkAnimateAttr(): Record<string, number>;\n\n abstract clone(): IGraphic<any>;\n}\n\nGraphic.mixin(EventTarget);\n\nfunction backgroundNotImage(image: any) {\n if (image.fill || image.stroke) {\n return true;\n }\n return false;\n}\n"]}
@@ -84,6 +84,7 @@ class Group extends graphic_1.Graphic {
84
84
  originalAABBBounds.copy(aabbBounds), originalAABBBounds;
85
85
  }
86
86
  doUpdateAABBBounds() {
87
+ this.updateAABBBoundsStamp++;
87
88
  const bounds = super.doUpdateAABBBounds();
88
89
  return this.parent && this.parent.addChildUpdateBoundTag(), this._emitCustomEvent("AAABBBoundsChange"),
89
90
  bounds;