@visactor/vrender-core 0.22.0-vstory.10 → 0.22.0-vstory.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/canvas/util.js +2 -1
- package/cjs/color-string/store.js +1 -2
- package/cjs/graphic/graphic.js +4 -4
- package/cjs/graphic/graphic.js.map +1 -1
- package/cjs/graphic/group.d.ts +1 -0
- package/cjs/graphic/group.js +5 -0
- package/cjs/graphic/group.js.map +1 -1
- package/cjs/plugins/builtin-plugin/richtext-edit-plugin.d.ts +1 -1
- package/cjs/plugins/builtin-plugin/richtext-edit-plugin.js +7 -4
- package/cjs/plugins/builtin-plugin/richtext-edit-plugin.js.map +1 -1
- package/dist/index.es.js +23 -3
- package/es/canvas/util.js +2 -1
- package/es/color-string/store.js +1 -2
- package/es/graphic/graphic.js +5 -5
- package/es/graphic/graphic.js.map +1 -1
- package/es/graphic/group.d.ts +1 -0
- package/es/graphic/group.js +5 -0
- package/es/graphic/group.js.map +1 -1
- package/es/plugins/builtin-plugin/richtext-edit-plugin.d.ts +1 -1
- package/es/plugins/builtin-plugin/richtext-edit-plugin.js +7 -4
- package/es/plugins/builtin-plugin/richtext-edit-plugin.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -12385,6 +12385,7 @@ class Graphic extends Node {
|
|
|
12385
12385
|
}
|
|
12386
12386
|
this.animates.set(animate.id, animate);
|
|
12387
12387
|
animate.onRemove(() => {
|
|
12388
|
+
animate.stop();
|
|
12388
12389
|
this.animates.delete(animate.id);
|
|
12389
12390
|
});
|
|
12390
12391
|
return animate;
|
|
@@ -12685,7 +12686,9 @@ class Graphic extends Node {
|
|
|
12685
12686
|
if (this.animates && this.animates.size) {
|
|
12686
12687
|
const timeline = stage.getTimeline();
|
|
12687
12688
|
this.animates.forEach(a => {
|
|
12688
|
-
a.
|
|
12689
|
+
if (a.timeline === defaultTimeline) {
|
|
12690
|
+
a.setTimeline(timeline);
|
|
12691
|
+
}
|
|
12689
12692
|
});
|
|
12690
12693
|
}
|
|
12691
12694
|
this._onSetStage && this._onSetStage(this, stage, layer);
|
|
@@ -12859,6 +12862,7 @@ class Graphic extends Node {
|
|
|
12859
12862
|
detachShadow() {
|
|
12860
12863
|
if (this.shadowRoot) {
|
|
12861
12864
|
this.addUpdateBoundTag();
|
|
12865
|
+
this.shadowRoot.release(true);
|
|
12862
12866
|
this.shadowRoot = null;
|
|
12863
12867
|
}
|
|
12864
12868
|
}
|
|
@@ -12966,6 +12970,7 @@ class Graphic extends Node {
|
|
|
12966
12970
|
}
|
|
12967
12971
|
release() {
|
|
12968
12972
|
this.releaseStatus = 'released';
|
|
12973
|
+
this.stopAnimates();
|
|
12969
12974
|
application.graphicService.onRelease(this);
|
|
12970
12975
|
}
|
|
12971
12976
|
_emitCustomEvent(type, context) {
|
|
@@ -13780,6 +13785,14 @@ class Group extends Graphic {
|
|
|
13780
13785
|
getNoWorkAnimateAttr() {
|
|
13781
13786
|
return Group.NOWORK_ANIMATE_ATTR;
|
|
13782
13787
|
}
|
|
13788
|
+
release(all) {
|
|
13789
|
+
if (all) {
|
|
13790
|
+
this.forEachChildren((g) => {
|
|
13791
|
+
g.release(all);
|
|
13792
|
+
});
|
|
13793
|
+
}
|
|
13794
|
+
super.release();
|
|
13795
|
+
}
|
|
13783
13796
|
}
|
|
13784
13797
|
Group.NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;
|
|
13785
13798
|
function createGroup(attributes) {
|
|
@@ -27346,7 +27359,7 @@ class Selection {
|
|
|
27346
27359
|
getFormat(key) {
|
|
27347
27360
|
return this.getAllFormat(key)[0];
|
|
27348
27361
|
}
|
|
27349
|
-
getAllFormat(key) {
|
|
27362
|
+
getAllFormat(key, includeUndefined) {
|
|
27350
27363
|
const valSet = new Set();
|
|
27351
27364
|
const minCursorIdx = Math.min(this.selectionStartCursorIdx, this.curCursorIdx);
|
|
27352
27365
|
const maxCursorIdx = Math.max(this.selectionStartCursorIdx, this.curCursorIdx);
|
|
@@ -27355,7 +27368,12 @@ class Selection {
|
|
|
27355
27368
|
}
|
|
27356
27369
|
for (let i = Math.ceil(minCursorIdx); i <= Math.floor(maxCursorIdx); i++) {
|
|
27357
27370
|
const val = this._getFormat(key, i);
|
|
27358
|
-
|
|
27371
|
+
if (includeUndefined) {
|
|
27372
|
+
valSet.add(val);
|
|
27373
|
+
}
|
|
27374
|
+
else {
|
|
27375
|
+
val !== undefined && valSet.add(val);
|
|
27376
|
+
}
|
|
27359
27377
|
}
|
|
27360
27378
|
return Array.from(valSet.values());
|
|
27361
27379
|
}
|
|
@@ -27681,6 +27699,7 @@ class RichTextEditPlugin {
|
|
|
27681
27699
|
else if (this.curCursorIdx > totalCursorCount + 0.1) {
|
|
27682
27700
|
this.curCursorIdx = totalCursorCount + 0.1;
|
|
27683
27701
|
}
|
|
27702
|
+
this.selectionStartCursorIdx = this.curCursorIdx;
|
|
27684
27703
|
const pos = this.computedCursorPosByCursorIdx(this.curCursorIdx, this.currRt);
|
|
27685
27704
|
this.setCursorAndTextArea(pos.x, pos.y1, pos.y2, this.currRt);
|
|
27686
27705
|
this.hideSelection();
|
|
@@ -27924,6 +27943,7 @@ class RichTextEditPlugin {
|
|
|
27924
27943
|
currRt.removeEventListener('pointerleave', this.handleLeave);
|
|
27925
27944
|
}
|
|
27926
27945
|
addAnimateToLine(line) {
|
|
27946
|
+
line.setAttributes({ opacity: 1 });
|
|
27927
27947
|
line.animates &&
|
|
27928
27948
|
line.animates.forEach(animate => {
|
|
27929
27949
|
animate.stop();
|
package/es/canvas/util.js
CHANGED
package/es/color-string/store.js
CHANGED
package/es/graphic/graphic.js
CHANGED
|
@@ -10,7 +10,7 @@ import { DefaultTransform } from "./config";
|
|
|
10
10
|
|
|
11
11
|
import { application } from "../application";
|
|
12
12
|
|
|
13
|
-
import { Animate, DefaultStateAnimateConfig } from "../animate";
|
|
13
|
+
import { Animate, DefaultStateAnimateConfig, defaultTimeline } from "../animate";
|
|
14
14
|
|
|
15
15
|
import { interpolateColor } from "../color-string/interpolate";
|
|
16
16
|
|
|
@@ -359,7 +359,7 @@ export class Graphic extends Node {
|
|
|
359
359
|
animate.interpolateFunc = params.interpolate;
|
|
360
360
|
}
|
|
361
361
|
return this.animates.set(animate.id, animate), animate.onRemove((() => {
|
|
362
|
-
this.animates.delete(animate.id);
|
|
362
|
+
animate.stop(), this.animates.delete(animate.id);
|
|
363
363
|
})), animate;
|
|
364
364
|
}
|
|
365
365
|
onAttributeUpdate(context) {
|
|
@@ -548,7 +548,7 @@ export class Graphic extends Node {
|
|
|
548
548
|
this.animates && this.animates.size) {
|
|
549
549
|
const timeline = stage.getTimeline();
|
|
550
550
|
this.animates.forEach((a => {
|
|
551
|
-
a.setTimeline(timeline);
|
|
551
|
+
a.timeline === defaultTimeline && a.setTimeline(timeline);
|
|
552
552
|
}));
|
|
553
553
|
}
|
|
554
554
|
this._onSetStage && this._onSetStage(this, stage, layer), application.graphicService.onSetStage(this, stage);
|
|
@@ -648,7 +648,7 @@ export class Graphic extends Node {
|
|
|
648
648
|
this.addUpdateBoundTag(), this.shadowRoot.setStage(this.stage, this.layer), this.shadowRoot;
|
|
649
649
|
}
|
|
650
650
|
detachShadow() {
|
|
651
|
-
this.shadowRoot && (this.addUpdateBoundTag(), this.shadowRoot = null);
|
|
651
|
+
this.shadowRoot && (this.addUpdateBoundTag(), this.shadowRoot.release(!0), this.shadowRoot = null);
|
|
652
652
|
}
|
|
653
653
|
toJson() {
|
|
654
654
|
return {
|
|
@@ -704,7 +704,7 @@ export class Graphic extends Node {
|
|
|
704
704
|
}));
|
|
705
705
|
}
|
|
706
706
|
release() {
|
|
707
|
-
this.releaseStatus = "released", application.graphicService.onRelease(this);
|
|
707
|
+
this.releaseStatus = "released", this.stopAnimates(), application.graphicService.onRelease(this);
|
|
708
708
|
}
|
|
709
709
|
_emitCustomEvent(type, context) {
|
|
710
710
|
var _a, _b;
|
|
@@ -1 +1 @@
|
|
|
1
|
-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ic.js","sourcesContent":["import type { ICustomPath2D } from './../interface/path';\nimport type { Dict, IPointLike, IAABBBounds, IOBBBounds } from '@visactor/vutils';\nimport { interpolateNumber, last, 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();\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(): IAABBBounds {\n const full = this.attribute.boundsMode === 'imprecise';\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\n // 直接返回空Bounds,但是前面的流程还是要走\n if (this.attribute.boundsMode === 'empty') {\n bounds.clear();\n }\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(\n params?.id,\n params?.timeline ?? (this.stage && this.stage.getTimeline()),\n params?.slience\n );\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();\n d.trans && this.tryUpdateLocalTransMatrix();\n } else {\n this.tryUpdateAABBBounds();\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 } else if (Array.isArray(nextStepVal) && nextStepVal.length === lastStepVal.length) {\n const nextList = [];\n let valid = true;\n for (let i = 0; i < nextStepVal.length; i++) {\n const v = lastStepVal[i];\n const val = v + (nextStepVal[i] - v) * ratio;\n if (!Number.isFinite(val)) {\n valid = false;\n break;\n }\n nextList.push(val);\n }\n if (valid) {\n nextAttributes[key] = nextList;\n }\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,OAAO,EAA2B,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EACL,UAAU,EACV,MAAM,EACN,eAAe,EACf,KAAK,EACL,KAAK,EACL,GAAG,EACH,QAAQ,EACR,UAAU,EACV,QA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","sourcesContent":["import type { ICustomPath2D } from './../interface/path';\nimport type { Dict, IPointLike, IAABBBounds, IOBBBounds } from '@visactor/vutils';\nimport { interpolateNumber, last, 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, defaultTimeline } 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();\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(): IAABBBounds {\n const full = this.attribute.boundsMode === 'imprecise';\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\n // 直接返回空Bounds,但是前面的流程还是要走\n if (this.attribute.boundsMode === 'empty') {\n bounds.clear();\n }\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(\n params?.id,\n params?.timeline ?? (this.stage && this.stage.getTimeline()),\n params?.slience\n );\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 animate.stop();\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();\n d.trans && this.tryUpdateLocalTransMatrix();\n } else {\n this.tryUpdateAABBBounds();\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 // 设置timeline为所属的stage上的timeline,但如果timeline并不是默认的timeline,就不用覆盖\n const timeline = stage.getTimeline();\n this.animates.forEach(a => {\n if (a.timeline === defaultTimeline) {\n a.setTimeline(timeline);\n }\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 } else if (Array.isArray(nextStepVal) && nextStepVal.length === lastStepVal.length) {\n const nextList = [];\n let valid = true;\n for (let i = 0; i < nextStepVal.length; i++) {\n const v = lastStepVal[i];\n const val = v + (nextStepVal[i] - v) * ratio;\n if (!Number.isFinite(val)) {\n valid = false;\n break;\n }\n nextList.push(val);\n }\n if (valid) {\n nextAttributes[key] = nextList;\n }\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.release(true);\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 this.stopAnimates();\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"]}
|
package/es/graphic/group.d.ts
CHANGED
|
@@ -81,5 +81,6 @@ export declare class Group extends Graphic<IGroupGraphicAttribute> implements IG
|
|
|
81
81
|
createOrUpdateChild<T extends keyof GraphicAttributeMap>(graphicName: string, attributes: GraphicAttributeMap[T], graphicType: T): INode;
|
|
82
82
|
clone(): Group;
|
|
83
83
|
getNoWorkAnimateAttr(): Record<string, number>;
|
|
84
|
+
release(all?: boolean): void;
|
|
84
85
|
}
|
|
85
86
|
export declare function createGroup(attributes: IGroupGraphicAttribute): IGroup;
|
package/es/graphic/group.js
CHANGED
|
@@ -195,6 +195,11 @@ export class Group extends Graphic {
|
|
|
195
195
|
getNoWorkAnimateAttr() {
|
|
196
196
|
return Group.NOWORK_ANIMATE_ATTR;
|
|
197
197
|
}
|
|
198
|
+
release(all) {
|
|
199
|
+
all && this.forEachChildren((g => {
|
|
200
|
+
g.release(all);
|
|
201
|
+
})), super.release();
|
|
202
|
+
}
|
|
198
203
|
}
|
|
199
204
|
|
|
200
205
|
Group.NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;
|