@visactor/vrender-core 0.17.6 → 0.17.7-alpha.1

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.
@@ -42,7 +42,7 @@ let DefaultLayerService = DefaultLayerService_1 = class {
42
42
  var _a;
43
43
  this.tryInit();
44
44
  let layerMode = this.getRecommendedLayerType(options.layerMode);
45
- layerMode = options.canvasId ? "static" : layerMode;
45
+ layerMode = options.main || options.canvasId ? "static" : layerMode;
46
46
  const layerHandler = this.getLayerHandler(layerMode), layer = new layer_1.Layer(stage, this.global, stage.window, Object.assign(Object.assign({
47
47
  main: !1
48
48
  }, options), {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/core/layer-service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,6DAA8D;AAE9D,mCAAgC;AAEhC,4CAAyC;AACzC,2CAIqB;AACrB,gDAA6C;AAGtC,IAAM,mBAAmB,2BAAzB,MAAM,mBAAmB;IAS9B,MAAM,CAAC,eAAe;QACpB,OAAO,GAAG,qBAAmB,CAAC,QAAQ,IAAI,qBAAmB,CAAC,YAAY,EAAE,EAAE,CAAC;IACjF,CAAC;IAED;QACE,IAAI,CAAC,QAAQ,GAAG,IAAI,GAAG,EAAE,CAAC;QAC1B,IAAI,CAAC,MAAM,GAAG,yBAAW,CAAC,MAAM,CAAC;IACnC,CAAC;IAED,OAAO;QACL,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YAChB,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC,MAAM,CAAC,oBAAoB,EAAE,CAAC;YAChE,IAAI,CAAC,sBAAsB,GAAG,IAAI,CAAC,MAAM,CAAC,qBAAqB,EAAE,CAAC;YAClE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;SACpB;IACH,CAAC;IAED,aAAa,CAAC,KAAa;QACzB,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IAED,uBAAuB,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,MAAM,CAAC,GAAG,KAAK,SAAS,EAAE;YACjC,OAAO,EAAE,CAAC;SACX;QACD,OAAO,CAAC,CAAC;IACX,CAAC;;AApGM,4BAAQ,GAAW,gBAAgB,CAAC;AACpC,gCAAY,GAAW,CAAC,CAAC;AAPrB,mBAAmB;IAD/B,IAAA,2BAAU,GAAE;;GACA,mBAAmB,CA2G/B;AA3GY,kDAAmB","file":"layer-service.js","sourcesContent":["import { inject, injectable } from '../common/inversify-lite';\nimport type { ILayer, IStage, IGlobal, ILayerParams, LayerMode, ILayerHandlerContribution } from '../interface';\nimport { Layer } from './layer';\nimport type { ILayerService } from '../interface/core';\nimport { container } from '../container';\nimport {\n DynamicLayerHandlerContribution,\n StaticLayerHandlerContribution,\n VirtualLayerHandlerContribution\n} from './constants';\nimport { application } from '../application';\n\n@injectable()\nexport class DefaultLayerService implements ILayerService {\n declare layerMap: Map<IStage, ILayer[]>;\n declare staticLayerCountInEnv: number;\n declare dynamicLayerCountInEnv: number;\n declare inited: boolean;\n declare global: IGlobal;\n static idprefix: string = 'visactor_layer';\n static prefix_count: number = 0;\n\n static GenerateLayerId() {\n return `${DefaultLayerService.idprefix}_${DefaultLayerService.prefix_count++}`;\n }\n\n constructor() {\n this.layerMap = new Map();\n this.global = application.global;\n }\n\n tryInit() {\n if (!this.inited) {\n this.staticLayerCountInEnv = this.global.getStaticCanvasCount();\n this.dynamicLayerCountInEnv = this.global.getDynamicCanvasCount();\n this.inited = true;\n }\n }\n\n getStageLayer(stage: IStage) {\n return this.layerMap.get(stage);\n }\n\n getRecommendedLayerType(layerMode?: LayerMode): LayerMode {\n if (layerMode) {\n return layerMode;\n }\n // 默认推荐实体canvas,不行就推荐离屏canvas,最次才是virtual\n if (this.staticLayerCountInEnv !== 0) {\n return 'static';\n } else if (this.dynamicLayerCountInEnv !== 0) {\n return 'dynamic';\n }\n return 'virtual';\n }\n\n getLayerHandler(layerMode: LayerMode) {\n let layerHandler: ILayerHandlerContribution;\n if (layerMode === 'static') {\n layerHandler = container.get<ILayerHandlerContribution>(StaticLayerHandlerContribution);\n } else if (layerMode === 'dynamic') {\n layerHandler = container.get<ILayerHandlerContribution>(DynamicLayerHandlerContribution);\n } else {\n layerHandler = container.get<ILayerHandlerContribution>(VirtualLayerHandlerContribution);\n }\n return layerHandler;\n }\n\n createLayer(stage: IStage, options: Partial<ILayerParams> = { main: false }): ILayer {\n this.tryInit();\n let layerMode = this.getRecommendedLayerType(options.layerMode);\n layerMode = options.canvasId ? 'static' : layerMode;\n const layerHandler = this.getLayerHandler(layerMode);\n const layer = new Layer(stage, this.global, stage.window, {\n main: false,\n ...options,\n layerMode,\n canvasId: options.canvasId ?? DefaultLayerService.GenerateLayerId(),\n layerHandler\n });\n const stageLayers = this.layerMap.get(stage) || [];\n stageLayers.push(layer);\n this.layerMap.set(stage, stageLayers);\n this.staticLayerCountInEnv--;\n return layer;\n }\n\n prepareStageLayer(stage: IStage) {\n let mainHandler: ILayerHandlerContribution;\n stage.forEachChildren((l: ILayer) => {\n const handler = l.getNativeHandler();\n if (handler.type === 'virtual') {\n handler.mainHandler = mainHandler;\n mainHandler.secondaryHandlers.push(handler);\n } else {\n mainHandler = handler;\n mainHandler.secondaryHandlers = [];\n }\n });\n }\n\n releaseLayer(stage: IStage, layer: ILayer): void {\n layer.release();\n const stageLayers = this.layerMap.get(stage) || [];\n this.layerMap.set(\n stage,\n stageLayers.filter(l => l !== layer)\n );\n }\n\n layerCount(stage: IStage): number {\n return (this.layerMap.get(stage) || []).length;\n }\n restLayerCount(stage: IStage): number {\n // TODO: 设置精确的值\n if (this.global.env === 'browser') {\n return 10;\n }\n return 0;\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/core/layer-service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,6DAA8D;AAE9D,mCAAgC;AAEhC,4CAAyC;AACzC,2CAIqB;AACrB,gDAA6C;AAGtC,IAAM,mBAAmB,2BAAzB,MAAM,mBAAmB;IAS9B,MAAM,CAAC,eAAe;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iB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;aAC7C;iBAAM;gBACL,WAAW,GAAG,OAAO,CAAC;gBACtB,WAAW,CAAC,iBAAiB,GAAG,EAAE,CAAC;aACpC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,YAAY,CAAC,KAAa,EAAE,KAAa;QACvC,KAAK,CAAC,OAAO,EAAE,CAAC;QAChB,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;QACnD,IAAI,CAAC,QAAQ,CAAC,GAAG,CACf,KAAK,EACL,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,KAAK,CAAC,CACrC,CAAC;IACJ,CAAC;IAED,UAAU,CAAC,KAAa;QACtB,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;IACjD,CAAC;IACD,cAAc,CAAC,KAAa;QAE1B,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,KAAK,SAAS,EAAE;YACjC,OAAO,EAAE,CAAC;SACX;QACD,OAAO,CAAC,CAAC;IACX,CAAC;;AApGM,4BAAQ,GAAW,gBAAgB,CAAC;AACpC,gCAAY,GAAW,CAAC,CAAC;AAPrB,mBAAmB;IAD/B,IAAA,2BAAU,GAAE;;GACA,mBAAmB,CA2G/B;AA3GY,kDAAmB","file":"layer-service.js","sourcesContent":["import { inject, injectable } from '../common/inversify-lite';\nimport type { ILayer, IStage, IGlobal, ILayerParams, LayerMode, ILayerHandlerContribution } from '../interface';\nimport { Layer } from './layer';\nimport type { ILayerService } from '../interface/core';\nimport { container } from '../container';\nimport {\n DynamicLayerHandlerContribution,\n StaticLayerHandlerContribution,\n VirtualLayerHandlerContribution\n} from './constants';\nimport { application } from '../application';\n\n@injectable()\nexport class DefaultLayerService implements ILayerService {\n declare layerMap: Map<IStage, ILayer[]>;\n declare staticLayerCountInEnv: number;\n declare dynamicLayerCountInEnv: number;\n declare inited: boolean;\n declare global: IGlobal;\n static idprefix: string = 'visactor_layer';\n static prefix_count: number = 0;\n\n static GenerateLayerId() {\n return `${DefaultLayerService.idprefix}_${DefaultLayerService.prefix_count++}`;\n }\n\n constructor() {\n this.layerMap = new Map();\n this.global = application.global;\n }\n\n tryInit() {\n if (!this.inited) {\n this.staticLayerCountInEnv = this.global.getStaticCanvasCount();\n this.dynamicLayerCountInEnv = this.global.getDynamicCanvasCount();\n this.inited = true;\n }\n }\n\n getStageLayer(stage: IStage) {\n return this.layerMap.get(stage);\n }\n\n getRecommendedLayerType(layerMode?: LayerMode): LayerMode {\n if (layerMode) {\n return layerMode;\n }\n // 默认推荐实体canvas,不行就推荐离屏canvas,最次才是virtual\n if (this.staticLayerCountInEnv !== 0) {\n return 'static';\n } else if (this.dynamicLayerCountInEnv !== 0) {\n return 'dynamic';\n }\n return 'virtual';\n }\n\n getLayerHandler(layerMode: LayerMode) {\n let layerHandler: ILayerHandlerContribution;\n if (layerMode === 'static') {\n layerHandler = container.get<ILayerHandlerContribution>(StaticLayerHandlerContribution);\n } else if (layerMode === 'dynamic') {\n layerHandler = container.get<ILayerHandlerContribution>(DynamicLayerHandlerContribution);\n } else {\n layerHandler = container.get<ILayerHandlerContribution>(VirtualLayerHandlerContribution);\n }\n return layerHandler;\n }\n\n createLayer(stage: IStage, options: Partial<ILayerParams> = { main: false }): ILayer {\n this.tryInit();\n let layerMode = this.getRecommendedLayerType(options.layerMode);\n layerMode = options.main ? 'static' : options.canvasId ? 'static' : layerMode;\n const layerHandler = this.getLayerHandler(layerMode);\n const layer = new Layer(stage, this.global, stage.window, {\n main: false,\n ...options,\n layerMode,\n canvasId: options.canvasId ?? DefaultLayerService.GenerateLayerId(),\n layerHandler\n });\n const stageLayers = this.layerMap.get(stage) || [];\n stageLayers.push(layer);\n this.layerMap.set(stage, stageLayers);\n this.staticLayerCountInEnv--;\n return layer;\n }\n\n prepareStageLayer(stage: IStage) {\n let mainHandler: ILayerHandlerContribution;\n stage.forEachChildren((l: ILayer) => {\n const handler = l.getNativeHandler();\n if (handler.type === 'virtual') {\n handler.mainHandler = mainHandler;\n mainHandler.secondaryHandlers.push(handler);\n } else {\n mainHandler = handler;\n mainHandler.secondaryHandlers = [];\n }\n });\n }\n\n releaseLayer(stage: IStage, layer: ILayer): void {\n layer.release();\n const stageLayers = this.layerMap.get(stage) || [];\n this.layerMap.set(\n stage,\n stageLayers.filter(l => l !== layer)\n );\n }\n\n layerCount(stage: IStage): number {\n return (this.layerMap.get(stage) || []).length;\n }\n restLayerCount(stage: IStage): number {\n // TODO: 设置精确的值\n if (this.global.env === 'browser') {\n return 10;\n }\n return 0;\n }\n}\n"]}
package/cjs/modules.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import type { IGlobal, IGraphicService } from './interface';
2
2
  import type { IGraphicUtil, ILayerService, ITransformUtil } from './interface/core';
3
+ export declare function preLoadAllModule(): void;
3
4
  export declare const vglobal: IGlobal;
4
5
  export declare const graphicUtil: IGraphicUtil;
5
6
  export declare const transformUtil: ITransformUtil;
package/cjs/modules.js CHANGED
@@ -8,14 +8,20 @@ var __importDefault = this && this.__importDefault || function(mod) {
8
8
 
9
9
  Object.defineProperty(exports, "__esModule", {
10
10
  value: !0
11
- }), exports.layerService = exports.graphicService = exports.transformUtil = exports.graphicUtil = exports.vglobal = void 0;
11
+ }), exports.layerService = exports.graphicService = exports.transformUtil = exports.graphicUtil = exports.vglobal = exports.preLoadAllModule = void 0;
12
12
 
13
13
  const core_modules_1 = __importDefault(require("./core/core-modules")), render_modules_1 = __importDefault(require("./render/render-modules")), pick_modules_1 = __importDefault(require("./picker/pick-modules")), graphic_module_1 = __importDefault(require("./graphic/graphic-service/graphic-module")), plugin_modules_1 = __importDefault(require("./plugins/plugin-modules")), modules_1 = __importDefault(require("./core/contributions/modules")), modules_2 = __importDefault(require("./render/contributions/modules")), constants_1 = require("./core/constants"), application_1 = require("./application"), constants_2 = require("./graphic/constants"), constants_3 = require("./core/constants"), container_1 = require("./container"), constants_4 = require("./constants");
14
14
 
15
- container_1.container.load(core_modules_1.default), container_1.container.load(graphic_module_1.default),
16
- container_1.container.load(render_modules_1.default), container_1.container.load(pick_modules_1.default),
17
- container_1.container.load(plugin_modules_1.default), (0, modules_1.default)(container_1.container),
18
- (0, modules_2.default)(container_1.container), exports.vglobal = container_1.container.get(constants_4.VGlobal),
15
+ let loaded = !1;
16
+
17
+ function preLoadAllModule() {
18
+ loaded || (loaded = !0, container_1.container.load(core_modules_1.default), container_1.container.load(graphic_module_1.default),
19
+ container_1.container.load(render_modules_1.default), container_1.container.load(pick_modules_1.default),
20
+ container_1.container.load(plugin_modules_1.default), (0, modules_1.default)(container_1.container),
21
+ (0, modules_2.default)(container_1.container));
22
+ }
23
+
24
+ exports.preLoadAllModule = preLoadAllModule, preLoadAllModule(), exports.vglobal = container_1.container.get(constants_4.VGlobal),
19
25
  application_1.application.global = exports.vglobal, exports.graphicUtil = container_1.container.get(constants_3.GraphicUtil),
20
26
  application_1.application.graphicUtil = exports.graphicUtil, exports.transformUtil = container_1.container.get(constants_3.TransformUtil),
21
27
  application_1.application.transformUtil = exports.transformUtil, exports.graphicService = container_1.container.get(constants_2.GraphicService),
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/modules.ts"],"names":[],"mappings":";;;;;;AAAA,uEAA6C;AAC7C,6EAAmD;AACnD,yEAA+C;AAE/C,8FAAqE;AACrE,8EAAoD;AACpD,2EAAoE;AACpE,6EAAqE;AAGrE,gDAAgD;AAIhD,+CAA4C;AAE5C,mDAAqD;AACrD,gDAA8D;AAC9D,2CAAwC;AACxC,2CAAsC;AAEtC,qBAAS,CAAC,IAAI,CAAC,sBAAU,CAAC,CAAC;AAC3B,qBAAS,CAAC,IAAI,CAAC,wBAAa,CAAC,CAAC;AAC9B,qBAAS,CAAC,IAAI,CAAC,wBAAY,CAAC,CAAC;AAC7B,qBAAS,CAAC,IAAI,CAAC,sBAAU,CAAC,CAAC;AAE3B,qBAAS,CAAC,IAAI,CAAC,wBAAY,CAAC,CAAC;AAC7B,IAAA,iBAAwB,EAAC,qBAAS,CAAC,CAAC;AACpC,IAAA,iBAAuB,EAAC,qBAAS,CAAC,CAAC;AAKtB,QAAA,OAAO,GAAG,qBAAS,CAAC,GAAG,CAAU,mBAAO,CAAC,CAAC;AACvD,yBAAW,CAAC,MAAM,GAAG,eAAO,CAAC;AAChB,QAAA,WAAW,GAAG,qBAAS,CAAC,GAAG,CAAe,uBAAW,CAAC,CAAC;AACpE,yBAAW,CAAC,WAAW,GAAG,mBAAW,CAAC;AACzB,QAAA,aAAa,GAAG,qBAAS,CAAC,GAAG,CAAiB,yBAAa,CAAC,CAAC;AAC1E,yBAAW,CAAC,aAAa,GAAG,qBAAa,CAAC;AAC7B,QAAA,cAAc,GAAG,qBAAS,CAAC,GAAG,CAAkB,0BAAc,CAAC,CAAC;AAC7E,yBAAW,CAAC,cAAc,GAAG,sBAAc,CAAC;AAa/B,QAAA,YAAY,GAAG,qBAAS,CAAC,GAAG,CAAgB,wBAAY,CAAC,CAAC;AACvE,yBAAW,CAAC,YAAY,GAAG,oBAAY,CAAC","file":"modules.js","sourcesContent":["import coreModule from './core/core-modules';\nimport renderModule from './render/render-modules';\nimport pickModule from './picker/pick-modules';\n// import allocatorModule from './allocator/allocator-modules';\nimport graphicModule from './graphic/graphic-service/graphic-module';\nimport pluginModule from './plugins/plugin-modules';\nimport loadBuiltinContributions from './core/contributions/modules';\nimport loadRenderContributions from './render/contributions/modules';\n// import loadPickContributions from './picker/contributions/modules';\n// import loadCanvasContributions from './canvas/contributions/modules';\nimport { LayerService } from './core/constants';\n// import { IMat4Allocate, IMatrixAllocate, Mat4Allocate, MatrixAllocate } from './allocator/matrix-allocate';\n// import { GlobalPickerService } from './picker/constants';\nimport type { IGlobal, IGraphicService, IPickerService } from './interface';\nimport { application } from './application';\nimport type { IGraphicUtil, ILayerService, ITransformUtil } from './interface/core';\nimport { GraphicService } from './graphic/constants';\nimport { GraphicUtil, TransformUtil } from './core/constants';\nimport { container } from './container';\nimport { VGlobal } from './constants';\n\ncontainer.load(coreModule);\ncontainer.load(graphicModule);\ncontainer.load(renderModule);\ncontainer.load(pickModule);\n// container.load(allocatorModule);\ncontainer.load(pluginModule);\nloadBuiltinContributions(container);\nloadRenderContributions(container);\n// loadPickContributions(container);\n// loadCanvasContributions(container);\n\n// 全局变量\nexport const vglobal = container.get<IGlobal>(VGlobal);\napplication.global = vglobal;\nexport const graphicUtil = container.get<IGraphicUtil>(GraphicUtil);\napplication.graphicUtil = graphicUtil;\nexport const transformUtil = container.get<ITransformUtil>(TransformUtil);\napplication.transformUtil = transformUtil;\nexport const graphicService = container.get<IGraphicService>(GraphicService);\napplication.graphicService = graphicService;\n// export const matrixAllocate = container.get<IMatrixAllocate>(MatrixAllocate);\n// export const mat4Allocate = container.get<IMat4Allocate>(Mat4Allocate);\n// export const canvasAllocate = container.get<ICanvasAllocate>(CanvasAllocate);\n// export const arcAllocate = container.get<IArcAllocate>(ArcAllocate);\n// export const areaAllocate = container.get<IAreaAllocate>(AreaAllocate);\n// export const circleAllocate = container.get<ICircleAllocate>(CircleAllocate);\n// export const lineAllocate = container.get<ILineAllocate>(LineAllocate);\n// export const pathAllocate = container.get<IPathAllocate>(PathAllocate);\n// export const rectAllocate = container.get<IRectAllocate>(RectAllocate);\n// export const symbolAllocate = container.get<ISymbolAllocate>(SymbolAllocate);\n// export const textAllocate = container.get<ITextAllocate>(TextAllocate);\n// export const pickerService = container.get<IPickerService>(GlobalPickerService);\nexport const layerService = container.get<ILayerService>(LayerService);\napplication.layerService = layerService;\n"]}
1
+ {"version":3,"sources":["../src/modules.ts"],"names":[],"mappings":";;;;;;AAAA,uEAA6C;AAC7C,6EAAmD;AACnD,yEAA+C;AAE/C,8FAAqE;AACrE,8EAAoD;AACpD,2EAAoE;AACpE,6EAAqE;AAGrE,gDAAgD;AAIhD,+CAA4C;AAE5C,mDAAqD;AACrD,gDAA8D;AAC9D,2CAAwC;AACxC,2CAAsC;AAEtC,IAAI,MAAM,GAAG,KAAK,CAAC;AACnB,SAAgB,gBAAgB;IAC9B,IAAI,MAAM,EAAE;QACV,OAAO;KACR;IACD,MAAM,GAAG,IAAI,CAAC;IACd,qBAAS,CAAC,IAAI,CAAC,sBAAU,CAAC,CAAC;IAC3B,qBAAS,CAAC,IAAI,CAAC,wBAAa,CAAC,CAAC;IAC9B,qBAAS,CAAC,IAAI,CAAC,wBAAY,CAAC,CAAC;IAC7B,qBAAS,CAAC,IAAI,CAAC,sBAAU,CAAC,CAAC;IAE3B,qBAAS,CAAC,IAAI,CAAC,wBAAY,CAAC,CAAC;IAC7B,IAAA,iBAAwB,EAAC,qBAAS,CAAC,CAAC;IACpC,IAAA,iBAAuB,EAAC,qBAAS,CAAC,CAAC;AACrC,CAAC;AAbD,4CAaC;AAED,gBAAgB,EAAE,CAAC;AAKN,QAAA,OAAO,GAAG,qBAAS,CAAC,GAAG,CAAU,mBAAO,CAAC,CAAC;AACvD,yBAAW,CAAC,MAAM,GAAG,eAAO,CAAC;AAChB,QAAA,WAAW,GAAG,qBAAS,CAAC,GAAG,CAAe,uBAAW,CAAC,CAAC;AACpE,yBAAW,CAAC,WAAW,GAAG,mBAAW,CAAC;AACzB,QAAA,aAAa,GAAG,qBAAS,CAAC,GAAG,CAAiB,yBAAa,CAAC,CAAC;AAC1E,yBAAW,CAAC,aAAa,GAAG,qBAAa,CAAC;AAC7B,QAAA,cAAc,GAAG,qBAAS,CAAC,GAAG,CAAkB,0BAAc,CAAC,CAAC;AAC7E,yBAAW,CAAC,cAAc,GAAG,sBAAc,CAAC;AAa/B,QAAA,YAAY,GAAG,qBAAS,CAAC,GAAG,CAAgB,wBAAY,CAAC,CAAC;AACvE,yBAAW,CAAC,YAAY,GAAG,oBAAY,CAAC","file":"modules.js","sourcesContent":["import coreModule from './core/core-modules';\nimport renderModule from './render/render-modules';\nimport pickModule from './picker/pick-modules';\n// import allocatorModule from './allocator/allocator-modules';\nimport graphicModule from './graphic/graphic-service/graphic-module';\nimport pluginModule from './plugins/plugin-modules';\nimport loadBuiltinContributions from './core/contributions/modules';\nimport loadRenderContributions from './render/contributions/modules';\n// import loadPickContributions from './picker/contributions/modules';\n// import loadCanvasContributions from './canvas/contributions/modules';\nimport { LayerService } from './core/constants';\n// import { IMat4Allocate, IMatrixAllocate, Mat4Allocate, MatrixAllocate } from './allocator/matrix-allocate';\n// import { GlobalPickerService } from './picker/constants';\nimport type { IGlobal, IGraphicService, IPickerService } from './interface';\nimport { application } from './application';\nimport type { IGraphicUtil, ILayerService, ITransformUtil } from './interface/core';\nimport { GraphicService } from './graphic/constants';\nimport { GraphicUtil, TransformUtil } from './core/constants';\nimport { container } from './container';\nimport { VGlobal } from './constants';\n\nlet loaded = false;\nexport function preLoadAllModule() {\n if (loaded) {\n return;\n }\n loaded = true;\n container.load(coreModule);\n container.load(graphicModule);\n container.load(renderModule);\n container.load(pickModule);\n // container.load(allocatorModule);\n container.load(pluginModule);\n loadBuiltinContributions(container);\n loadRenderContributions(container);\n}\n\npreLoadAllModule();\n// loadPickContributions(container);\n// loadCanvasContributions(container);\n\n// 全局变量\nexport const vglobal = container.get<IGlobal>(VGlobal);\napplication.global = vglobal;\nexport const graphicUtil = container.get<IGraphicUtil>(GraphicUtil);\napplication.graphicUtil = graphicUtil;\nexport const transformUtil = container.get<ITransformUtil>(TransformUtil);\napplication.transformUtil = transformUtil;\nexport const graphicService = container.get<IGraphicService>(GraphicService);\napplication.graphicService = graphicService;\n// export const matrixAllocate = container.get<IMatrixAllocate>(MatrixAllocate);\n// export const mat4Allocate = container.get<IMat4Allocate>(Mat4Allocate);\n// export const canvasAllocate = container.get<ICanvasAllocate>(CanvasAllocate);\n// export const arcAllocate = container.get<IArcAllocate>(ArcAllocate);\n// export const areaAllocate = container.get<IAreaAllocate>(AreaAllocate);\n// export const circleAllocate = container.get<ICircleAllocate>(CircleAllocate);\n// export const lineAllocate = container.get<ILineAllocate>(LineAllocate);\n// export const pathAllocate = container.get<IPathAllocate>(PathAllocate);\n// export const rectAllocate = container.get<IRectAllocate>(RectAllocate);\n// export const symbolAllocate = container.get<ISymbolAllocate>(SymbolAllocate);\n// export const textAllocate = container.get<ITextAllocate>(TextAllocate);\n// export const pickerService = container.get<IPickerService>(GlobalPickerService);\nexport const layerService = container.get<ILayerService>(LayerService);\napplication.layerService = layerService;\n"]}
@@ -6,8 +6,9 @@ Object.defineProperty(exports, "__esModule", {
6
6
 
7
7
  const inversify_lite_1 = require("../common/inversify-lite"), constants_1 = require("./constants"), pick_interceptor_1 = require("./pick-interceptor"), contribution_provider_1 = require("../common/contribution-provider");
8
8
 
9
- exports.default = new inversify_lite_1.ContainerModule((bind => {
10
- bind(constants_1.PickerService).toService(constants_1.GlobalPickerService), bind(pick_interceptor_1.Canvas3DPickItemInterceptor).toSelf().inSingletonScope(),
9
+ exports.default = new inversify_lite_1.ContainerModule(((bind, unbind, isBound) => {
10
+ isBound(constants_1.PickerService) || (bind(constants_1.GlobalPickerService).toSelf(),
11
+ bind(constants_1.PickerService).toService(constants_1.GlobalPickerService)), bind(pick_interceptor_1.Canvas3DPickItemInterceptor).toSelf().inSingletonScope(),
11
12
  bind(pick_interceptor_1.PickItemInterceptor).toService(pick_interceptor_1.Canvas3DPickItemInterceptor),
12
13
  bind(pick_interceptor_1.ShadowRootPickItemInterceptorContribution).toSelf().inSingletonScope(),
13
14
  bind(pick_interceptor_1.PickItemInterceptor).toService(pick_interceptor_1.ShadowRootPickItemInterceptorContribution),
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/picker/pick-modules.ts"],"names":[],"mappings":";;AAAA,6DAA2D;AAC3D,2CAAiE;AAIjE,yDAK4B;AAC5B,2EAA2E;AAE3E,kBAAe,IAAI,gCAAe,CAAC,IAAI,CAAC,EAAE;IACxC,IAAI,CAAC,yBAAa,CAAC,CAAC,SAAS,CAAC,+BAAmB,CAAC,CAAC;IAMnD,IAAI,CAAC,8CAA2B,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAC9D,IAAI,CAAC,sCAAmB,CAAC,CAAC,SAAS,CAAC,8CAA2B,CAAC,CAAC;IAGjE,IAAI,CAAC,4DAAyC,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAC5E,IAAI,CAAC,sCAAmB,CAAC,CAAC,SAAS,CAAC,4DAAyC,CAAC,CAAC;IAG/E,IAAI,CAAC,6DAA0C,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAC7E,IAAI,CAAC,sCAAmB,CAAC,CAAC,SAAS,CAAC,6DAA0C,CAAC,CAAC;IAChF,IAAA,gDAAwB,EAAC,IAAI,EAAE,sCAAmB,CAAC,CAAC;AACtD,CAAC,CAAC,CAAC","file":"pick-modules.js","sourcesContent":["import { ContainerModule } from '../common/inversify-lite';\nimport { PickerService, GlobalPickerService } from './constants';\nimport { DefaultGlobalPickerService } from './global-picker-service';\n// import { DefaultCanvasPickerService } from './canvas-picker-service';\n// import { DefaultMathPickerService } from './math-picker-service';\nimport {\n Canvas3DPickItemInterceptor,\n InteractivePickItemInterceptorContribution,\n PickItemInterceptor,\n ShadowRootPickItemInterceptorContribution\n} from './pick-interceptor';\nimport { bindContributionProvider } from '../common/contribution-provider';\n\nexport default new ContainerModule(bind => {\n bind(PickerService).toService(GlobalPickerService);\n\n // bind(DefaultGlobalPickerService).toSelf().inSingletonScope();\n // bind(GlobalPickerService).toService(DefaultGlobalPickerService);\n\n // interceptor\n bind(Canvas3DPickItemInterceptor).toSelf().inSingletonScope();\n bind(PickItemInterceptor).toService(Canvas3DPickItemInterceptor);\n\n // shadow root\n bind(ShadowRootPickItemInterceptorContribution).toSelf().inSingletonScope();\n bind(PickItemInterceptor).toService(ShadowRootPickItemInterceptorContribution);\n\n // interactive\n bind(InteractivePickItemInterceptorContribution).toSelf().inSingletonScope();\n bind(PickItemInterceptor).toService(InteractivePickItemInterceptorContribution);\n bindContributionProvider(bind, PickItemInterceptor);\n});\n"]}
1
+ {"version":3,"sources":["../src/picker/pick-modules.ts"],"names":[],"mappings":";;AAAA,6DAA2D;AAC3D,2CAAiE;AAIjE,yDAK4B;AAC5B,2EAA2E;AAE3E,kBAAe,IAAI,gCAAe,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE;IAC3D,IAAI,CAAC,OAAO,CAAC,yBAAa,CAAC,EAAE;QAC3B,IAAI,CAAC,+BAAmB,CAAC,CAAC,MAAM,EAAE,CAAC;QACnC,IAAI,CAAC,yBAAa,CAAC,CAAC,SAAS,CAAC,+BAAmB,CAAC,CAAC;KACpD;IAOD,IAAI,CAAC,8CAA2B,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAC9D,IAAI,CAAC,sCAAmB,CAAC,CAAC,SAAS,CAAC,8CAA2B,CAAC,CAAC;IAGjE,IAAI,CAAC,4DAAyC,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAC5E,IAAI,CAAC,sCAAmB,CAAC,CAAC,SAAS,CAAC,4DAAyC,CAAC,CAAC;IAG/E,IAAI,CAAC,6DAA0C,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAC7E,IAAI,CAAC,sCAAmB,CAAC,CAAC,SAAS,CAAC,6DAA0C,CAAC,CAAC;IAChF,IAAA,gDAAwB,EAAC,IAAI,EAAE,sCAAmB,CAAC,CAAC;AACtD,CAAC,CAAC,CAAC","file":"pick-modules.js","sourcesContent":["import { ContainerModule } from '../common/inversify-lite';\nimport { PickerService, GlobalPickerService } from './constants';\nimport { DefaultGlobalPickerService } from './global-picker-service';\n// import { DefaultCanvasPickerService } from './canvas-picker-service';\n// import { DefaultMathPickerService } from './math-picker-service';\nimport {\n Canvas3DPickItemInterceptor,\n InteractivePickItemInterceptorContribution,\n PickItemInterceptor,\n ShadowRootPickItemInterceptorContribution\n} from './pick-interceptor';\nimport { bindContributionProvider } from '../common/contribution-provider';\n\nexport default new ContainerModule((bind, unbind, isBound) => {\n if (!isBound(PickerService)) {\n bind(GlobalPickerService).toSelf();\n bind(PickerService).toService(GlobalPickerService);\n }\n // bind(PickerService).toService(GlobalPickerService);\n\n // bind(DefaultGlobalPickerService).toSelf().inSingletonScope();\n // bind(GlobalPickerService).toService(DefaultGlobalPickerService);\n\n // interceptor\n bind(Canvas3DPickItemInterceptor).toSelf().inSingletonScope();\n bind(PickItemInterceptor).toService(Canvas3DPickItemInterceptor);\n\n // shadow root\n bind(ShadowRootPickItemInterceptorContribution).toSelf().inSingletonScope();\n bind(PickItemInterceptor).toService(ShadowRootPickItemInterceptorContribution);\n\n // interactive\n bind(InteractivePickItemInterceptorContribution).toSelf().inSingletonScope();\n bind(PickItemInterceptor).toService(InteractivePickItemInterceptorContribution);\n bindContributionProvider(bind, PickItemInterceptor);\n});\n"]}
package/dist/index.js CHANGED
@@ -12598,7 +12598,7 @@
12598
12598
  var _a;
12599
12599
  this.tryInit();
12600
12600
  let layerMode = this.getRecommendedLayerType(options.layerMode);
12601
- layerMode = options.canvasId ? 'static' : layerMode;
12601
+ layerMode = options.main ? 'static' : options.canvasId ? 'static' : layerMode;
12602
12602
  const layerHandler = this.getLayerHandler(layerMode);
12603
12603
  const layer = new Layer(stage, this.global, stage.window, Object.assign(Object.assign({ main: false }, options), { layerMode, canvasId: (_a = options.canvasId) !== null && _a !== void 0 ? _a : DefaultLayerService_1.GenerateLayerId(), layerHandler }));
12604
12604
  const stageLayers = this.layerMap.get(stage) || [];
@@ -22049,8 +22049,11 @@
22049
22049
  injectable()
22050
22050
  ], exports.Canvas3DPickItemInterceptor);
22051
22051
 
22052
- var pickModule = new ContainerModule(bind => {
22053
- bind(PickerService).toService(GlobalPickerService);
22052
+ var pickModule = new ContainerModule((bind, unbind, isBound) => {
22053
+ if (!isBound(PickerService)) {
22054
+ bind(GlobalPickerService).toSelf();
22055
+ bind(PickerService).toService(GlobalPickerService);
22056
+ }
22054
22057
  bind(exports.Canvas3DPickItemInterceptor).toSelf().inSingletonScope();
22055
22058
  bind(PickItemInterceptor).toService(exports.Canvas3DPickItemInterceptor);
22056
22059
  bind(exports.ShadowRootPickItemInterceptorContribution).toSelf().inSingletonScope();
@@ -23677,13 +23680,21 @@
23677
23680
  container.load(renderModule);
23678
23681
  }
23679
23682
 
23680
- container.load(coreModule);
23681
- container.load(graphicModule);
23682
- container.load(renderModule$1);
23683
- container.load(pickModule);
23684
- container.load(pluginModule);
23685
- load$1(container);
23686
- load(container);
23683
+ let loaded = false;
23684
+ function preLoadAllModule() {
23685
+ if (loaded) {
23686
+ return;
23687
+ }
23688
+ loaded = true;
23689
+ container.load(coreModule);
23690
+ container.load(graphicModule);
23691
+ container.load(renderModule$1);
23692
+ container.load(pickModule);
23693
+ container.load(pluginModule);
23694
+ load$1(container);
23695
+ load(container);
23696
+ }
23697
+ preLoadAllModule();
23687
23698
  const vglobal = container.get(VGlobal);
23688
23699
  application.global = vglobal;
23689
23700
  const graphicUtil = container.get(GraphicUtil);
@@ -27535,6 +27546,7 @@
27535
27546
  exports.pointsEqual = pointsEqual;
27536
27547
  exports.pointsInterpolation = pointsInterpolation;
27537
27548
  exports.polygonModule = polygonModule;
27549
+ exports.preLoadAllModule = preLoadAllModule;
27538
27550
  exports.pyramid3dModule = pyramid3dModule;
27539
27551
  exports.rafBasedSto = rafBasedSto;
27540
27552
  exports.rect3dModule = rect3dModule;