@visactor/vrender-core 1.0.0-alpha.6 → 1.0.0-alpha.7
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/core/stage.d.ts +2 -1
- package/cjs/core/stage.js +4 -3
- package/cjs/core/stage.js.map +1 -1
- package/cjs/graphic/graphic-service/graphic-module.js +1 -2
- package/cjs/graphic/graphic-service/graphic-module.js.map +1 -1
- package/cjs/graphic/graphic.js +7 -4
- package/cjs/graphic/graphic.js.map +1 -1
- package/cjs/graphic/group.js +14 -7
- package/cjs/graphic/group.js.map +1 -1
- package/cjs/interface/stage.d.ts +2 -0
- package/cjs/interface/stage.js.map +1 -1
- package/cjs/plugins/builtin-plugin/auto-render-plugin.js +9 -8
- package/cjs/plugins/builtin-plugin/auto-render-plugin.js.map +1 -1
- package/cjs/plugins/builtin-plugin/dirty-bounds-plugin.js +14 -11
- package/cjs/plugins/builtin-plugin/dirty-bounds-plugin.js.map +1 -1
- package/cjs/plugins/builtin-plugin/flex-layout-plugin.js +13 -10
- package/cjs/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
- package/cjs/plugins/builtin-plugin/html-attribute-plugin.js +0 -1
- package/cjs/plugins/builtin-plugin/html-attribute-plugin.js.map +1 -1
- package/cjs/plugins/builtin-plugin/incremental-auto-render-plugin.js +8 -5
- package/cjs/plugins/builtin-plugin/incremental-auto-render-plugin.js.map +1 -1
- package/dist/index.es.js +94 -58
- package/es/core/stage.d.ts +2 -1
- package/es/core/stage.js +5 -2
- package/es/core/stage.js.map +1 -1
- package/es/graphic/graphic-service/graphic-module.js +1 -1
- package/es/graphic/graphic-service/graphic-module.js.map +1 -1
- package/es/graphic/graphic.js +7 -4
- package/es/graphic/graphic.js.map +1 -1
- package/es/graphic/group.js +15 -8
- package/es/graphic/group.js.map +1 -1
- package/es/interface/stage.d.ts +2 -0
- package/es/interface/stage.js.map +1 -1
- package/es/plugins/builtin-plugin/auto-render-plugin.js +8 -8
- package/es/plugins/builtin-plugin/auto-render-plugin.js.map +1 -1
- package/es/plugins/builtin-plugin/dirty-bounds-plugin.js +13 -12
- package/es/plugins/builtin-plugin/dirty-bounds-plugin.js.map +1 -1
- package/es/plugins/builtin-plugin/flex-layout-plugin.js +12 -11
- package/es/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
- package/es/plugins/builtin-plugin/html-attribute-plugin.js +0 -1
- package/es/plugins/builtin-plugin/html-attribute-plugin.js.map +1 -1
- package/es/plugins/builtin-plugin/incremental-auto-render-plugin.js +8 -5
- package/es/plugins/builtin-plugin/incremental-auto-render-plugin.js.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/plugins/builtin-plugin/incremental-auto-render-plugin.ts"],"names":[],"mappings":";;;AACA,mDAAgD;AAChD,sDAAmD;AAEnD,MAAa,2BAA2B;IAAxC;QACE,SAAI,GAAkC,6BAA6B,CAAC;QACpE,gBAAW,GAAiB,YAAY,CAAC;QAE/B,4BAAuB,GAAgB,IAAI,GAAG,EAAE,CAAC;QACjD,wBAAmB,GAAY,KAAK,CAAC;QAC/C,mBAAc,GAA0B,EAAE,CAAC;QAC3C,SAAI,GAAW,qBAAS,CAAC,kBAAkB,EAAE,CAAC;QAC9C,QAAG,GAAW,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"sources":["../src/plugins/builtin-plugin/incremental-auto-render-plugin.ts"],"names":[],"mappings":";;;AACA,mDAAgD;AAChD,sDAAmD;AAEnD,MAAa,2BAA2B;IAAxC;QACE,SAAI,GAAkC,6BAA6B,CAAC;QACpE,gBAAW,GAAiB,YAAY,CAAC;QAE/B,4BAAuB,GAAgB,IAAI,GAAG,EAAE,CAAC;QACjD,wBAAmB,GAAY,KAAK,CAAC;QAC/C,mBAAc,GAA0B,EAAE,CAAC;QAC3C,SAAI,GAAW,qBAAS,CAAC,kBAAkB,EAAE,CAAC;QA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AC,SAAS,EAAE;oBACpC,OAAO;iBACR;gBACD,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBACvD,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC,gBAAgB,EAAE;oBAC3C,OAAO;iBACR;gBACD,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,kBAChD,KAAK;oBACL,KAAK,EACL,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,EAClC,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,mBAAmB,EAAE,EAE/C,KAAK,EAAE,aAAa,EACpB,aAAa,EAAE,KAAK,CAAC,aAAa,EAClC,YAAY,EAAE,KAAK,EACnB,SAAS,EAAE,KAAK,CAAC,IAAI,EACrB,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,gBAAgB,EAAE,CAAC,UAAU,EAAE,IACpD,IAAI,CAAC,cAAc,EACtB,CAAC;YACL,CAAC,CAAC,CAAC;YACH,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC;YACzB,IAAI,CAAC,uBAAuB,CAAC,KAAK,EAAE,CAAC;SACtC;IACH,CAAC;CACF;AAzFD,kEAyFC","file":"incremental-auto-render-plugin.js","sourcesContent":["import type { IGroup, IPlugin, IPluginService, IDrawContext } from '../../interface';\nimport { application } from '../../application';\nimport { Generator } from '../../common/generator';\n\nexport class IncrementalAutoRenderPlugin implements IPlugin {\n name: 'IncrementalAutoRenderPlugin' = 'IncrementalAutoRenderPlugin';\n activeEvent: 'onRegister' = 'onRegister';\n pluginService: IPluginService;\n protected nextFrameRenderGroupSet: Set<IGroup> = new Set();\n protected willNextFrameRender: boolean = false;\n nextUserParams: Partial<IDrawContext> = {};\n _uid: number = Generator.GenAutoIncrementId();\n key: string = this.name + this._uid;\n\n activate(context: IPluginService): void {\n this.pluginService = context;\n const stage = this.pluginService.stage;\n if (!stage) {\n return;\n }\n stage.graphicService.hooks.onAddIncremental.tap(this.key, (graphic, group, stage) => {\n if (graphic.glyphHost) {\n graphic = graphic.glyphHost;\n }\n if (graphic.stage === context.stage && graphic.stage != null) {\n this.nextUserParams.startAtId = group._uid;\n this.renderNextFrame(group);\n }\n });\n stage.graphicService.hooks.onClearIncremental.tap(this.key, (group, stage) => {\n if (group.stage === context.stage && group.stage != null) {\n this.nextUserParams.startAtId = group._uid;\n this.nextUserParams.restartIncremental = true;\n this.renderNextFrame(group);\n }\n });\n }\n deactivate(context: IPluginService): void {\n const stage = this.pluginService.stage;\n if (!stage) {\n return;\n }\n stage.graphicService.hooks.onAddIncremental.taps = stage.graphicService.hooks.onAddIncremental.taps.filter(item => {\n return item.name !== this.key;\n });\n stage.graphicService.hooks.onClearIncremental.taps = stage.graphicService.hooks.onClearIncremental.taps.filter(\n item => {\n return item.name !== this.key;\n }\n );\n }\n\n renderNextFrame(group: IGroup): void {\n this.nextFrameRenderGroupSet.add(group);\n if (!this.willNextFrameRender) {\n this.willNextFrameRender = true;\n application.global.getRequestAnimationFrame()(() => {\n this._doRenderInThisFrame();\n this.willNextFrameRender = false;\n });\n }\n }\n\n _doRenderInThisFrame() {\n const stage = this.pluginService.stage;\n if (this.nextFrameRenderGroupSet.size) {\n this.nextFrameRenderGroupSet.forEach(group => {\n const layer = group.layer;\n if (!layer || !group.layer.subLayers) {\n return;\n }\n const subLayer = group.layer.subLayers.get(group._uid);\n if (!subLayer || !subLayer.drawContribution) {\n return;\n }\n subLayer.drawContribution.draw(stage.renderService, {\n stage,\n layer,\n viewBox: stage.window.getViewBox(),\n transMatrix: stage.window.getViewBoxTransform(),\n // TODO: 多图层时不应该再用默认background\n clear: 'transparent',\n renderService: stage.renderService,\n updateBounds: false,\n startAtId: group._uid,\n context: subLayer.layer.getNativeHandler().getContext(),\n ...this.nextUserParams\n });\n });\n this.nextUserParams = {};\n this.nextFrameRenderGroupSet.clear();\n }\n }\n}\n"]}
|
package/dist/index.es.js
CHANGED
|
@@ -10949,6 +10949,7 @@ class Graphic extends Node {
|
|
|
10949
10949
|
this._emitCustomEvent('animate-bind', animate);
|
|
10950
10950
|
}
|
|
10951
10951
|
tryUpdateAABBBounds() {
|
|
10952
|
+
var _a, _b;
|
|
10952
10953
|
const full = this.attribute.boundsMode === 'imprecise';
|
|
10953
10954
|
if (!this.shouldUpdateAABBBounds()) {
|
|
10954
10955
|
return this._AABBBounds;
|
|
@@ -10957,9 +10958,9 @@ class Graphic extends Node {
|
|
|
10957
10958
|
this._AABBBounds.clear();
|
|
10958
10959
|
return this._AABBBounds;
|
|
10959
10960
|
}
|
|
10960
|
-
|
|
10961
|
+
(_a = this.stage) === null || _a === void 0 ? void 0 : _a.graphicService.beforeUpdateAABBBounds(this, this.stage, true, this._AABBBounds);
|
|
10961
10962
|
const bounds = this.doUpdateAABBBounds(full);
|
|
10962
|
-
|
|
10963
|
+
(_b = this.stage) === null || _b === void 0 ? void 0 : _b.graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, true);
|
|
10963
10964
|
if (this.attribute.boundsMode === 'empty') {
|
|
10964
10965
|
bounds.clear();
|
|
10965
10966
|
}
|
|
@@ -11450,10 +11451,11 @@ class Graphic extends Node {
|
|
|
11450
11451
|
return this;
|
|
11451
11452
|
}
|
|
11452
11453
|
onAttributeUpdate(context) {
|
|
11454
|
+
var _a;
|
|
11453
11455
|
if (context && context.skipUpdateCallback) {
|
|
11454
11456
|
return;
|
|
11455
11457
|
}
|
|
11456
|
-
|
|
11458
|
+
(_a = this.stage) === null || _a === void 0 ? void 0 : _a.graphicService.onAttributeUpdate(this);
|
|
11457
11459
|
this._emitCustomEvent('afterAttributeUpdate', context);
|
|
11458
11460
|
}
|
|
11459
11461
|
update(d) {
|
|
@@ -11745,6 +11747,7 @@ class Graphic extends Node {
|
|
|
11745
11747
|
}
|
|
11746
11748
|
}
|
|
11747
11749
|
setStage(stage, layer) {
|
|
11750
|
+
var _a;
|
|
11748
11751
|
if (this.stage !== stage) {
|
|
11749
11752
|
this.stage = stage;
|
|
11750
11753
|
this.layer = layer;
|
|
@@ -11759,7 +11762,7 @@ class Graphic extends Node {
|
|
|
11759
11762
|
});
|
|
11760
11763
|
}
|
|
11761
11764
|
this._onSetStage && this._onSetStage(this, stage, layer);
|
|
11762
|
-
|
|
11765
|
+
(_a = this.stage) === null || _a === void 0 ? void 0 : _a.graphicService.onSetStage(this, stage);
|
|
11763
11766
|
}
|
|
11764
11767
|
}
|
|
11765
11768
|
setStageToShadowRoot(stage, layer) {
|
|
@@ -12011,14 +12014,15 @@ class Group extends Graphic {
|
|
|
12011
12014
|
return false;
|
|
12012
12015
|
}
|
|
12013
12016
|
tryUpdateAABBBounds() {
|
|
12017
|
+
var _a, _b;
|
|
12014
12018
|
if (!this.shouldUpdateAABBBounds()) {
|
|
12015
12019
|
return this._AABBBounds;
|
|
12016
12020
|
}
|
|
12017
|
-
|
|
12021
|
+
(_a = this.stage) === null || _a === void 0 ? void 0 : _a.graphicService.beforeUpdateAABBBounds(this, this.stage, true, this._AABBBounds);
|
|
12018
12022
|
const selfChange = this.shouldSelfChangeUpdateAABBBounds();
|
|
12019
12023
|
const bounds = this.doUpdateAABBBounds();
|
|
12020
12024
|
this.addUpdateLayoutTag();
|
|
12021
|
-
|
|
12025
|
+
(_b = this.stage) === null || _b === void 0 ? void 0 : _b.graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, selfChange);
|
|
12022
12026
|
if (this.attribute.boundsMode === 'empty') {
|
|
12023
12027
|
bounds.clear();
|
|
12024
12028
|
}
|
|
@@ -12087,19 +12091,21 @@ class Group extends Graphic {
|
|
|
12087
12091
|
return this.theme.getTheme(this);
|
|
12088
12092
|
}
|
|
12089
12093
|
incrementalAppendChild(node) {
|
|
12094
|
+
var _a;
|
|
12090
12095
|
const data = super.appendChild(node);
|
|
12091
12096
|
if (this.stage && data) {
|
|
12092
12097
|
data.stage = this.stage;
|
|
12093
12098
|
data.layer = this.layer;
|
|
12094
12099
|
}
|
|
12095
12100
|
this.addUpdateBoundTag();
|
|
12096
|
-
|
|
12101
|
+
(_a = this.stage) === null || _a === void 0 ? void 0 : _a.graphicService.onAddIncremental(node, this, this.stage);
|
|
12097
12102
|
return data;
|
|
12098
12103
|
}
|
|
12099
12104
|
incrementalClearChild() {
|
|
12105
|
+
var _a;
|
|
12100
12106
|
super.removeAllChild();
|
|
12101
12107
|
this.addUpdateBoundTag();
|
|
12102
|
-
|
|
12108
|
+
(_a = this.stage) === null || _a === void 0 ? void 0 : _a.graphicService.onClearIncremental(this, this.stage);
|
|
12103
12109
|
return;
|
|
12104
12110
|
}
|
|
12105
12111
|
_updateChildToStage(child) {
|
|
@@ -12127,15 +12133,17 @@ class Group extends Graphic {
|
|
|
12127
12133
|
return this._updateChildToStage(super.insertInto(newNode, idx));
|
|
12128
12134
|
}
|
|
12129
12135
|
removeChild(child) {
|
|
12136
|
+
var _a;
|
|
12130
12137
|
const data = super.removeChild(child);
|
|
12131
12138
|
child.stage = null;
|
|
12132
|
-
|
|
12139
|
+
(_a = this.stage) === null || _a === void 0 ? void 0 : _a.graphicService.onRemove(child);
|
|
12133
12140
|
this.addUpdateBoundTag();
|
|
12134
12141
|
return data;
|
|
12135
12142
|
}
|
|
12136
12143
|
removeAllChild(deep = false) {
|
|
12137
12144
|
this.forEachChildren((child) => {
|
|
12138
|
-
|
|
12145
|
+
var _a;
|
|
12146
|
+
(_a = this.stage) === null || _a === void 0 ? void 0 : _a.graphicService.onRemove(child);
|
|
12139
12147
|
if (deep && child.isContainer) {
|
|
12140
12148
|
child.removeAllChild(deep);
|
|
12141
12149
|
}
|
|
@@ -12144,12 +12152,13 @@ class Group extends Graphic {
|
|
|
12144
12152
|
this.addUpdateBoundTag();
|
|
12145
12153
|
}
|
|
12146
12154
|
setStage(stage, layer) {
|
|
12155
|
+
var _a;
|
|
12147
12156
|
if (this.stage !== stage) {
|
|
12148
12157
|
this.stage = stage;
|
|
12149
12158
|
this.layer = layer;
|
|
12150
12159
|
this.setStageToShadowRoot(stage, layer);
|
|
12151
12160
|
this._onSetStage && this._onSetStage(this, stage, layer);
|
|
12152
|
-
|
|
12161
|
+
(_a = this.stage) === null || _a === void 0 ? void 0 : _a.graphicService.onSetStage(this, stage);
|
|
12153
12162
|
this.forEachChildren(item => {
|
|
12154
12163
|
item.setStage(stage, this.layer);
|
|
12155
12164
|
});
|
|
@@ -21100,7 +21109,7 @@ var pickModule = new ContainerModule((bind, unbind, isBound) => {
|
|
|
21100
21109
|
});
|
|
21101
21110
|
|
|
21102
21111
|
var graphicModule = new ContainerModule(bind => {
|
|
21103
|
-
bind(GraphicService).to(DefaultGraphicService)
|
|
21112
|
+
bind(GraphicService).to(DefaultGraphicService);
|
|
21104
21113
|
bind(GraphicCreator$1).toConstantValue(graphicCreator);
|
|
21105
21114
|
});
|
|
21106
21115
|
|
|
@@ -22121,9 +22130,13 @@ class AutoRenderPlugin {
|
|
|
22121
22130
|
}
|
|
22122
22131
|
activate(context) {
|
|
22123
22132
|
this.pluginService = context;
|
|
22124
|
-
|
|
22125
|
-
|
|
22126
|
-
|
|
22133
|
+
const stage = this.pluginService.stage;
|
|
22134
|
+
if (!stage) {
|
|
22135
|
+
return;
|
|
22136
|
+
}
|
|
22137
|
+
stage.graphicService.hooks.onAttributeUpdate.tap(this.key, this.handleChange);
|
|
22138
|
+
stage.graphicService.hooks.onSetStage.tap(this.key, this.handleChange);
|
|
22139
|
+
stage.graphicService.hooks.onRemove.tap(this.key, this.handleChange);
|
|
22127
22140
|
}
|
|
22128
22141
|
deactivate(context) {
|
|
22129
22142
|
const filterByName = (taps) => {
|
|
@@ -22131,9 +22144,13 @@ class AutoRenderPlugin {
|
|
|
22131
22144
|
return item.name !== this.key;
|
|
22132
22145
|
});
|
|
22133
22146
|
};
|
|
22134
|
-
|
|
22135
|
-
|
|
22136
|
-
|
|
22147
|
+
const stage = this.pluginService.stage;
|
|
22148
|
+
if (!stage) {
|
|
22149
|
+
return;
|
|
22150
|
+
}
|
|
22151
|
+
stage.graphicService.hooks.onAttributeUpdate.taps = filterByName(stage.graphicService.hooks.onAttributeUpdate.taps);
|
|
22152
|
+
stage.graphicService.hooks.onSetStage.taps = filterByName(stage.graphicService.hooks.onSetStage.taps);
|
|
22153
|
+
stage.graphicService.hooks.onRemove.taps = filterByName(stage.graphicService.hooks.onRemove.taps);
|
|
22137
22154
|
}
|
|
22138
22155
|
}
|
|
22139
22156
|
|
|
@@ -22218,7 +22235,11 @@ class IncrementalAutoRenderPlugin {
|
|
|
22218
22235
|
}
|
|
22219
22236
|
activate(context) {
|
|
22220
22237
|
this.pluginService = context;
|
|
22221
|
-
|
|
22238
|
+
const stage = this.pluginService.stage;
|
|
22239
|
+
if (!stage) {
|
|
22240
|
+
return;
|
|
22241
|
+
}
|
|
22242
|
+
stage.graphicService.hooks.onAddIncremental.tap(this.key, (graphic, group, stage) => {
|
|
22222
22243
|
if (graphic.glyphHost) {
|
|
22223
22244
|
graphic = graphic.glyphHost;
|
|
22224
22245
|
}
|
|
@@ -22227,7 +22248,7 @@ class IncrementalAutoRenderPlugin {
|
|
|
22227
22248
|
this.renderNextFrame(group);
|
|
22228
22249
|
}
|
|
22229
22250
|
});
|
|
22230
|
-
|
|
22251
|
+
stage.graphicService.hooks.onClearIncremental.tap(this.key, (group, stage) => {
|
|
22231
22252
|
if (group.stage === context.stage && group.stage != null) {
|
|
22232
22253
|
this.nextUserParams.startAtId = group._uid;
|
|
22233
22254
|
this.nextUserParams.restartIncremental = true;
|
|
@@ -22236,14 +22257,16 @@ class IncrementalAutoRenderPlugin {
|
|
|
22236
22257
|
});
|
|
22237
22258
|
}
|
|
22238
22259
|
deactivate(context) {
|
|
22239
|
-
|
|
22240
|
-
|
|
22241
|
-
|
|
22242
|
-
|
|
22243
|
-
|
|
22244
|
-
|
|
22245
|
-
|
|
22246
|
-
|
|
22260
|
+
const stage = this.pluginService.stage;
|
|
22261
|
+
if (!stage) {
|
|
22262
|
+
return;
|
|
22263
|
+
}
|
|
22264
|
+
stage.graphicService.hooks.onAddIncremental.taps = stage.graphicService.hooks.onAddIncremental.taps.filter(item => {
|
|
22265
|
+
return item.name !== this.key;
|
|
22266
|
+
});
|
|
22267
|
+
stage.graphicService.hooks.onClearIncremental.taps = stage.graphicService.hooks.onClearIncremental.taps.filter(item => {
|
|
22268
|
+
return item.name !== this.key;
|
|
22269
|
+
});
|
|
22247
22270
|
}
|
|
22248
22271
|
renderNextFrame(group) {
|
|
22249
22272
|
this.nextFrameRenderGroupSet.add(group);
|
|
@@ -22292,7 +22315,11 @@ class DirtyBoundsPlugin {
|
|
|
22292
22315
|
}
|
|
22293
22316
|
stage.dirtyBounds.clear();
|
|
22294
22317
|
});
|
|
22295
|
-
|
|
22318
|
+
const stage = this.pluginService.stage;
|
|
22319
|
+
if (!stage) {
|
|
22320
|
+
return;
|
|
22321
|
+
}
|
|
22322
|
+
stage.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key, (graphic, stage, willUpdate, bounds) => {
|
|
22296
22323
|
if (graphic.glyphHost) {
|
|
22297
22324
|
graphic = graphic.glyphHost;
|
|
22298
22325
|
}
|
|
@@ -22307,7 +22334,7 @@ class DirtyBoundsPlugin {
|
|
|
22307
22334
|
stage.dirty(globalBounds, graphic.parent && graphic.parent.globalTransMatrix);
|
|
22308
22335
|
}
|
|
22309
22336
|
});
|
|
22310
|
-
|
|
22337
|
+
stage.graphicService.hooks.afterUpdateAABBBounds.tap(this.key, (graphic, stage, bounds, params, selfChange) => {
|
|
22311
22338
|
if (!(stage && stage === this.pluginService.stage && stage.renderCount)) {
|
|
22312
22339
|
return;
|
|
22313
22340
|
}
|
|
@@ -22316,7 +22343,7 @@ class DirtyBoundsPlugin {
|
|
|
22316
22343
|
}
|
|
22317
22344
|
stage.dirty(params.globalAABBBounds);
|
|
22318
22345
|
});
|
|
22319
|
-
|
|
22346
|
+
stage.graphicService.hooks.clearAABBBounds.tap(this.key, (graphic, stage, bounds) => {
|
|
22320
22347
|
if (!(stage && stage === this.pluginService.stage && stage.renderCount)) {
|
|
22321
22348
|
return;
|
|
22322
22349
|
}
|
|
@@ -22324,7 +22351,7 @@ class DirtyBoundsPlugin {
|
|
|
22324
22351
|
stage.dirty(bounds);
|
|
22325
22352
|
}
|
|
22326
22353
|
});
|
|
22327
|
-
|
|
22354
|
+
stage.graphicService.hooks.onRemove.tap(this.key, (graphic) => {
|
|
22328
22355
|
const stage = graphic.stage;
|
|
22329
22356
|
if (!(stage && stage === this.pluginService.stage && stage.renderCount)) {
|
|
22330
22357
|
return;
|
|
@@ -22335,22 +22362,25 @@ class DirtyBoundsPlugin {
|
|
|
22335
22362
|
});
|
|
22336
22363
|
}
|
|
22337
22364
|
deactivate(context) {
|
|
22338
|
-
|
|
22339
|
-
|
|
22340
|
-
|
|
22341
|
-
|
|
22342
|
-
|
|
22343
|
-
|
|
22365
|
+
const stage = this.pluginService.stage;
|
|
22366
|
+
if (!stage) {
|
|
22367
|
+
return;
|
|
22368
|
+
}
|
|
22369
|
+
stage.graphicService.hooks.beforeUpdateAABBBounds.taps =
|
|
22370
|
+
stage.graphicService.hooks.beforeUpdateAABBBounds.taps.filter(item => {
|
|
22344
22371
|
return item.name !== this.key;
|
|
22345
22372
|
});
|
|
22346
|
-
|
|
22347
|
-
|
|
22373
|
+
stage.graphicService.hooks.afterUpdateAABBBounds.taps =
|
|
22374
|
+
stage.graphicService.hooks.afterUpdateAABBBounds.taps.filter(item => {
|
|
22348
22375
|
return item.name !== this.key;
|
|
22349
22376
|
});
|
|
22350
|
-
|
|
22377
|
+
stage.graphicService.hooks.clearAABBBounds.taps = stage.graphicService.hooks.clearAABBBounds.taps.filter(item => {
|
|
22351
22378
|
return item.name !== this.key;
|
|
22352
22379
|
});
|
|
22353
|
-
|
|
22380
|
+
stage.hooks.afterRender.taps = stage.hooks.afterRender.taps.filter(item => {
|
|
22381
|
+
return item.name !== this.key;
|
|
22382
|
+
});
|
|
22383
|
+
stage.graphicService.hooks.onRemove.taps = stage.graphicService.hooks.onRemove.taps.filter(item => {
|
|
22354
22384
|
return item.name !== this.key;
|
|
22355
22385
|
});
|
|
22356
22386
|
}
|
|
@@ -22538,6 +22568,7 @@ class Stage extends Group {
|
|
|
22538
22568
|
this.renderService = container.get(RenderService);
|
|
22539
22569
|
this.pluginService = container.get(PluginService);
|
|
22540
22570
|
this.layerService = container.get(LayerService);
|
|
22571
|
+
this.graphicService = container.get(GraphicService);
|
|
22541
22572
|
this.pluginService.active(this, params);
|
|
22542
22573
|
this.window.create({
|
|
22543
22574
|
width: params.width,
|
|
@@ -22581,7 +22612,7 @@ class Stage extends Group {
|
|
|
22581
22612
|
this.supportInteractiveLayer = params.interactiveLayer !== false;
|
|
22582
22613
|
if (!params.optimize) {
|
|
22583
22614
|
params.optimize = {
|
|
22584
|
-
tickRenderMode: '
|
|
22615
|
+
tickRenderMode: 'effect'
|
|
22585
22616
|
};
|
|
22586
22617
|
}
|
|
22587
22618
|
this.optmize(params.optimize);
|
|
@@ -26845,8 +26876,6 @@ class HtmlAttributePlugin {
|
|
|
26845
26876
|
context.stage.hooks.afterRender.taps = context.stage.hooks.afterRender.taps.filter(item => {
|
|
26846
26877
|
return item.name !== this.key;
|
|
26847
26878
|
});
|
|
26848
|
-
application.graphicService.hooks.onRemove.unTap(this.key);
|
|
26849
|
-
application.graphicService.hooks.onRelease.unTap(this.key);
|
|
26850
26879
|
this.release();
|
|
26851
26880
|
}
|
|
26852
26881
|
getWrapContainer(stage, userContainer, domParams) {
|
|
@@ -27590,7 +27619,11 @@ class FlexLayoutPlugin {
|
|
|
27590
27619
|
}
|
|
27591
27620
|
activate(context) {
|
|
27592
27621
|
this.pluginService = context;
|
|
27593
|
-
|
|
27622
|
+
const stage = this.pluginService.stage;
|
|
27623
|
+
if (!stage) {
|
|
27624
|
+
return;
|
|
27625
|
+
}
|
|
27626
|
+
stage.graphicService.hooks.onAttributeUpdate.tap(this.key, graphic => {
|
|
27594
27627
|
if (graphic.glyphHost) {
|
|
27595
27628
|
graphic = graphic.glyphHost;
|
|
27596
27629
|
}
|
|
@@ -27599,7 +27632,7 @@ class FlexLayoutPlugin {
|
|
|
27599
27632
|
}
|
|
27600
27633
|
this.tryLayout(graphic, false);
|
|
27601
27634
|
});
|
|
27602
|
-
|
|
27635
|
+
stage.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key, (graphic, stage, willUpdate, bounds) => {
|
|
27603
27636
|
if (graphic.glyphHost) {
|
|
27604
27637
|
graphic = graphic.glyphHost;
|
|
27605
27638
|
}
|
|
@@ -27611,7 +27644,7 @@ class FlexLayoutPlugin {
|
|
|
27611
27644
|
}
|
|
27612
27645
|
_tempBounds.copy(bounds);
|
|
27613
27646
|
});
|
|
27614
|
-
|
|
27647
|
+
stage.graphicService.hooks.afterUpdateAABBBounds.tap(this.key, (graphic, stage, bounds, params, selfChange) => {
|
|
27615
27648
|
if (!(stage && stage === this.pluginService.stage)) {
|
|
27616
27649
|
return;
|
|
27617
27650
|
}
|
|
@@ -27622,7 +27655,7 @@ class FlexLayoutPlugin {
|
|
|
27622
27655
|
this.tryLayout(graphic, false);
|
|
27623
27656
|
}
|
|
27624
27657
|
});
|
|
27625
|
-
|
|
27658
|
+
stage.graphicService.hooks.onSetStage.tap(this.key, graphic => {
|
|
27626
27659
|
if (graphic.glyphHost) {
|
|
27627
27660
|
graphic = graphic.glyphHost;
|
|
27628
27661
|
}
|
|
@@ -27630,19 +27663,22 @@ class FlexLayoutPlugin {
|
|
|
27630
27663
|
});
|
|
27631
27664
|
}
|
|
27632
27665
|
deactivate(context) {
|
|
27633
|
-
|
|
27634
|
-
|
|
27635
|
-
|
|
27636
|
-
|
|
27637
|
-
|
|
27638
|
-
|
|
27666
|
+
const stage = this.pluginService.stage;
|
|
27667
|
+
if (!stage) {
|
|
27668
|
+
return;
|
|
27669
|
+
}
|
|
27670
|
+
stage.graphicService.hooks.onAttributeUpdate.taps = stage.graphicService.hooks.onAttributeUpdate.taps.filter(item => {
|
|
27671
|
+
return item.name !== this.key;
|
|
27672
|
+
});
|
|
27673
|
+
stage.graphicService.hooks.beforeUpdateAABBBounds.taps =
|
|
27674
|
+
stage.graphicService.hooks.beforeUpdateAABBBounds.taps.filter(item => {
|
|
27639
27675
|
return item.name !== this.key;
|
|
27640
27676
|
});
|
|
27641
|
-
|
|
27642
|
-
|
|
27677
|
+
stage.graphicService.hooks.afterUpdateAABBBounds.taps =
|
|
27678
|
+
stage.graphicService.hooks.afterUpdateAABBBounds.taps.filter(item => {
|
|
27643
27679
|
return item.name !== this.key;
|
|
27644
27680
|
});
|
|
27645
|
-
|
|
27681
|
+
stage.graphicService.hooks.onSetStage.taps = stage.graphicService.hooks.onSetStage.taps.filter(item => {
|
|
27646
27682
|
return item.name !== this.key;
|
|
27647
27683
|
});
|
|
27648
27684
|
}
|
package/es/core/stage.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IAABBBounds, IBounds, IBoundsLike, IMatrix } from '@visactor/vutils';
|
|
2
|
-
import type { IExportType, IStage, IStageParams, ILayer, IColor, IOption3D, ICamera, vec3, IDirectionLight, ITicker, IRenderService, IPickerService, IPluginService, ISyncHook, IDrawContext, IWindow, ILayerService, ITimeline, IOptimizeType, LayerMode, PickResult, IPlugin } from '../interface';
|
|
2
|
+
import type { IExportType, IStage, IStageParams, ILayer, IColor, IOption3D, ICamera, vec3, IDirectionLight, ITicker, IRenderService, IPickerService, IPluginService, ISyncHook, IDrawContext, IWindow, ILayerService, ITimeline, IOptimizeType, LayerMode, PickResult, IPlugin, IGraphicService } from '../interface';
|
|
3
3
|
import type { Layer } from './layer';
|
|
4
4
|
import { Group } from '../graphic/group';
|
|
5
5
|
type IStageState = 'rendering' | 'normal';
|
|
@@ -53,6 +53,7 @@ export declare class Stage extends Group implements IStage {
|
|
|
53
53
|
protected pickerService?: IPickerService;
|
|
54
54
|
readonly pluginService: IPluginService;
|
|
55
55
|
readonly layerService: ILayerService;
|
|
56
|
+
readonly graphicService: IGraphicService;
|
|
56
57
|
private _eventSystem?;
|
|
57
58
|
private get eventSystem();
|
|
58
59
|
protected _beforeRender?: (stage: IStage) => void;
|
package/es/core/stage.js
CHANGED
|
@@ -34,6 +34,8 @@ import { isBrowserEnv } from "../env-check";
|
|
|
34
34
|
|
|
35
35
|
import { Factory } from "../factory";
|
|
36
36
|
|
|
37
|
+
import { GraphicService } from "../graphic";
|
|
38
|
+
|
|
37
39
|
const DefaultConfig = {
|
|
38
40
|
WIDTH: 500,
|
|
39
41
|
HEIGHT: 500,
|
|
@@ -136,7 +138,8 @@ export class Stage extends Group {
|
|
|
136
138
|
}, this.global = application.global, !this.global.env && isBrowserEnv() && this.global.setEnv("browser"),
|
|
137
139
|
this.window = container.get(VWindow), this.renderService = container.get(RenderService),
|
|
138
140
|
this.pluginService = container.get(PluginService), this.layerService = container.get(LayerService),
|
|
139
|
-
this.pluginService.active(this, params),
|
|
141
|
+
this.graphicService = container.get(GraphicService), this.pluginService.active(this, params),
|
|
142
|
+
this.window.create({
|
|
140
143
|
width: params.width,
|
|
141
144
|
height: params.height,
|
|
142
145
|
viewBox: params.viewBox,
|
|
@@ -156,7 +159,7 @@ export class Stage extends Group {
|
|
|
156
159
|
this.hooks.beforeRender.tap("constructor", this.beforeRender), this.hooks.afterRender.tap("constructor", this.afterRender),
|
|
157
160
|
this._beforeRender = params.beforeRender, this._afterRender = params.afterRender,
|
|
158
161
|
this.supportInteractiveLayer = !1 !== params.interactiveLayer, params.optimize || (params.optimize = {
|
|
159
|
-
tickRenderMode: "
|
|
162
|
+
tickRenderMode: "effect"
|
|
160
163
|
}), this.optmize(params.optimize), params.background && isString(this._background) && this._background.includes("/") && this.setAttributes({
|
|
161
164
|
background: this._background
|
|
162
165
|
}), this.initAnimate(params), this.rafId = null !== (_b = params.rafId) && void 0 !== _b ? _b : Math.floor(6 * Math.random());
|