@visactor/vrender-core 0.16.17-alpha.3 → 0.16.17-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/cjs/core/stage.js +3 -3
  2. package/cjs/core/stage.js.map +1 -1
  3. package/cjs/event/event-manager.d.ts +5 -1
  4. package/cjs/event/event-manager.js +11 -7
  5. package/cjs/event/event-manager.js.map +1 -1
  6. package/cjs/event/event-system.js +8 -7
  7. package/cjs/event/event-system.js.map +1 -1
  8. package/cjs/graphic/graphic-service/graphic-service.d.ts +3 -2
  9. package/cjs/graphic/graphic-service/graphic-service.js +19 -2
  10. package/cjs/graphic/graphic-service/graphic-service.js.map +1 -1
  11. package/cjs/graphic/graphic.js +1 -1
  12. package/cjs/graphic/graphic.js.map +1 -1
  13. package/cjs/graphic/richtext.js +1 -1
  14. package/cjs/graphic/richtext.js.map +1 -1
  15. package/cjs/interface/event.d.ts +1 -34
  16. package/cjs/interface/event.js.map +1 -1
  17. package/cjs/interface/stage.d.ts +6 -0
  18. package/cjs/interface/stage.js.map +1 -1
  19. package/dist/index.js +67 -18
  20. package/dist/index.min.js +1 -1
  21. package/es/core/stage.js +3 -3
  22. package/es/core/stage.js.map +1 -1
  23. package/es/event/event-manager.d.ts +5 -1
  24. package/es/event/event-manager.js +11 -7
  25. package/es/event/event-manager.js.map +1 -1
  26. package/es/event/event-system.js +4 -2
  27. package/es/event/event-system.js.map +1 -1
  28. package/es/graphic/graphic-service/graphic-service.d.ts +3 -2
  29. package/es/graphic/graphic-service/graphic-service.js +19 -2
  30. package/es/graphic/graphic-service/graphic-service.js.map +1 -1
  31. package/es/graphic/graphic.js +1 -1
  32. package/es/graphic/graphic.js.map +1 -1
  33. package/es/graphic/richtext.js +1 -1
  34. package/es/graphic/richtext.js.map +1 -1
  35. package/es/interface/event.d.ts +1 -34
  36. package/es/interface/event.js.map +1 -1
  37. package/es/interface/stage.d.ts +6 -0
  38. package/es/interface/stage.js.map +1 -1
  39. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/interface/event.ts"],"names":[],"mappings":"","file":"event.js","sourcesContent":["import type { INode } from './node-tree';\nimport type { Dict, IBounds, IPointLike } from '@visactor/vutils';\nimport type { Cursor, IGraphicAttribute } from './graphic';\nimport type { IDomRectLike, IEventElement } from './common';\nimport type { ICanvas } from './canvas';\nimport type { IGlobal } from './global';\n\nexport interface IEventManager {\n rootTarget: IEventTarget;\n dispatch: any;\n cursor: Cursor | string;\n addEventMapping: (type: string, fn: (e: IFederatedEvent, target: IEventTarget) => void) => void;\n dispatchEvent: (e: IFederatedEvent, type?: string) => void;\n mapEvent: (e: IFederatedEvent) => void;\n propagate: (e: IFederatedEvent, type?: string) => void;\n propagationPath: (target: IEventTarget) => IEventTarget[];\n copyWheelData: (from: IFederatedWheelEvent, to: IFederatedWheelEvent) => void;\n copyPointerData: (from: IFederatedEvent, to: IFederatedEvent) => void;\n copyMouseData: (from: IFederatedEvent, to: IFederatedEvent) => void;\n copyData: (from: IFederatedEvent, to: IFederatedEvent) => void;\n}\n\nexport interface IFederatedEvent<N = Event> {\n bubbles: boolean;\n cancelBubble: boolean;\n cancelable: boolean;\n composed: boolean;\n currentTarget: IEventTarget | null;\n defaultPrevented: boolean;\n eventPhase: number;\n isTrusted: boolean;\n returnValue: boolean;\n srcElement: IEventTarget;\n target: IEventTarget | null;\n timeStamp: number;\n type: string;\n nativeEvent: N;\n originalEvent: IFederatedEvent<N> | null;\n propagationStopped: boolean;\n propagationImmediatelyStopped: boolean;\n path: IEventTarget[];\n manager?: IEventManager;\n detail: any;\n view: any;\n layer: IPointLike;\n get layerX(): number;\n get layerY(): number;\n page: IPointLike;\n get pageX(): number;\n get pageY(): number;\n canvas: IPointLike;\n get x(): number;\n get y(): number;\n get canvasX(): number;\n get canvasY(): number;\n viewport: IPointLike;\n get viewX(): number;\n get viewY(): number;\n composedPath: () => IEventTarget[];\n preventDefault: () => void;\n stopImmediatePropagation: () => void;\n stopPropagation: () => void;\n initEvent: () => void;\n initUIEvent: () => void;\n clone: () => void;\n which: number;\n}\n\nexport interface IFederatedMouseEvent extends IFederatedEvent {\n altKey: boolean;\n button: number;\n buttons: number;\n ctrlKey: boolean;\n metaKey: boolean;\n relatedTarget: EventTarget | null;\n shiftKey: boolean;\n client: IPointLike;\n get clientX(): number;\n get clientY(): number;\n detail: number;\n movement: IPointLike;\n get movementX(): number;\n get movementY(): number;\n offset: IPointLike;\n get offsetX(): number;\n get offsetY(): number;\n global: IPointLike;\n get globalX(): number;\n get globalY(): number;\n screen: IPointLike;\n get screenX(): number;\n get screenY(): number;\n getModifierState: (key: string) => boolean;\n initMouseEvent: (\n _typeArg: string,\n _canBubbleArg: boolean,\n _cancelableArg: boolean,\n _viewArg: Window,\n _detailArg: number,\n _screenXArg: number,\n _screenYArg: number,\n _clientXArg: number,\n _clientYArg: number,\n _ctrlKeyArg: boolean,\n _altKeyArg: boolean,\n _shiftKeyArg: boolean,\n _metaKeyArg: boolean,\n _buttonArg: number,\n _relatedTargetArg: EventTarget\n ) => void;\n}\n\nexport interface IFederatedWheelEvent extends IFederatedMouseEvent {\n deltaMode: number;\n deltaX: number;\n deltaY: number;\n deltaZ: number;\n clone: () => IFederatedWheelEvent;\n}\n\nexport interface IFederatedPointerEvent extends IFederatedMouseEvent {\n pointerId: number;\n width: number;\n height: number;\n isPrimary: boolean;\n pointerType: string;\n pressure: number;\n tangentialPressure: number;\n tiltX: number;\n tiltY: number;\n twist: number;\n detail: number;\n getCoalescedEvents: () => PointerEvent[];\n getPredictedEvents: () => PointerEvent[];\n clone: () => IFederatedPointerEvent;\n}\n\n/**\n * 代码参考自 https://github.com/pixijs/pixijs\n * The MIT License\n\n Copyright (c) 2013-2023 Mathew Groves, Chad Engler\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in\n all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n THE SOFTWARE.\n */\n\nexport interface IEventTarget extends INode {\n /** Whether this event target should fire UI events. */\n pickable: boolean;\n /** The parent of this event target. */\n parent: IEventTarget | null;\n /** Whether this event target should be visible. */\n visible: boolean;\n\n /** The children of this event target. */\n children?: IEventTarget[];\n\n /** Whether this event target has any children that need UI events. This can be used optimize event propagation. */\n childrenPickable?: boolean;\n\n attribute?: Partial<IGraphicAttribute>;\n\n emit: (eventName: any, data: Dict<any>) => boolean;\n\n getCursor: () => string;\n setCursor: (c?: string) => void;\n}\n\nexport interface IRender {\n visualCanvas: {\n getCanvas: () => HTMLElement;\n };\n pickEvent: (position: [number, number], children: IEventTarget[], geoPick?: boolean) => IEventTarget | null;\n [key: string]: any;\n}\n\n// 事件系统扩展接口\nexport interface IEventExtension {\n /**\n * bind events\n */\n initEvents: () => void;\n /**\n * unbind events\n */\n removeEvents: () => void;\n /**\n * release\n */\n release: () => void;\n}\n\nexport type GestureDirection = 'none' | 'left' | 'right' | 'down' | 'up';\n\nexport interface GestureEvent extends IFederatedPointerEvent {\n points: IPointLike[];\n direction: GestureDirection;\n deltaX: number;\n deltaY: number;\n scale: number;\n center: IPointLike;\n velocity: number;\n}\n\nexport interface GestureConfig {\n press?: {\n /**\n * @default 251\n * Minimal press time in ms.\n * @see http://hammerjs.github.io/recognizer-press/\n */\n time?: number;\n /**\n * @default 10\n * Minimal movement that is allowed while pressing.\n * @see http://hammerjs.github.io/recognizer-press/\n */\n threshold?: number;\n };\n swipe?: {\n /**\n * Minimal distance required before recognizing.\n * @default 10\n * @see https://hammerjs.github.io/recognizer-swipe/\n */\n threshold?: number;\n /**\n * Minimal velocity required before recognizing, unit is in px per ms.\n * @default 0.3\n * @see http://hammerjs.github.io/recognizer-swipe/\n */\n velocity?: number;\n };\n}\n\nexport interface DefaultGestureConfig {\n press: {\n time: number;\n threshold: number;\n };\n swipe: {\n threshold: number;\n velocity: number;\n };\n}\n\nexport interface EmitEventObject {\n type: string;\n ev: GestureEvent;\n}\n\nexport type LooseFunction = (...args: any[]) => any;\n\nexport type IElementLike = Omit<IEventElement, 'on' | 'off' | 'once' | 'emit' | 'removeAllListeners'> & {\n style: CSSStyleDeclaration | Record<string, any>;\n getNativeHandler?: () => ICanvas;\n getBoundingClientRect: () => IDomRectLike;\n};\n\nexport type RenderConfig = {\n /**\n * 事件绑定的 canvas 元素\n */\n targetElement: IElementLike;\n /**\n * 环境分辨率\n */\n resolution: number;\n /**\n * 场景树根节点\n */\n rootNode: IEventTarget;\n global: IGlobal;\n /** 是否自动阻止事件 */\n autoPreventDefault?: boolean;\n /** 绘图视口 */\n viewport: {\n x: number;\n y: number;\n width: number;\n height: number;\n viewBox?: IBounds;\n };\n};\n\nexport type NativeEvent = MouseEvent | PointerEvent | TouchEvent;\n\nexport type GraphicEventType =\n | 'pointerdown'\n | 'pointerup'\n // 指针抬起与按下的图形不同时触发\n | 'pointerupoutside'\n | 'pointertap'\n | 'pointerover'\n | 'pointerenter'\n | 'pointerleave'\n | 'pointerout'\n | 'mousedown'\n | 'mouseup'\n | 'mouseupoutside'\n // 右键操作\n | 'rightdown'\n | 'rightup'\n | 'rightupoutside'\n | 'click'\n // 双击\n | 'dblclick'\n | 'mousemove'\n | 'mouseover'\n | 'mouseout'\n // 不会冒泡\n | 'mouseenter'\n // 不会冒泡\n | 'mouseleave'\n | 'wheel'\n | 'tap'\n | 'touchstart'\n | 'touchend'\n | 'touchendoutside'\n | 'touchmove'\n | 'touchcancel'\n // dragNdrop\n | 'dragstart'\n | 'drag'\n | 'dragenter'\n | 'dragleave'\n | 'dragover'\n | 'dragend'\n | 'drop'\n // gesture\n | 'pan'\n | 'panstart'\n | 'panend'\n | 'press'\n | 'pressup'\n | 'pressend'\n | 'pinch'\n | 'pinchstart'\n | 'pinchend'\n | 'swipe';\n"]}
1
+ {"version":3,"sources":["../src/interface/event.ts"],"names":[],"mappings":"","file":"event.js","sourcesContent":["import type { INode } from './node-tree';\nimport type { Dict, IBounds, IPointLike } from '@visactor/vutils';\nimport type { Cursor, IGraphicAttribute } from './graphic';\nimport type { IDomRectLike, IEventElement } from './common';\nimport type { ICanvas } from './canvas';\nimport type { IGlobal } from './global';\n\nexport interface IEventManager {\n rootTarget: IEventTarget;\n dispatch: any;\n cursor: Cursor | string;\n addEventMapping: (type: string, fn: (e: IFederatedEvent, target: IEventTarget) => void) => void;\n dispatchEvent: (e: IFederatedEvent, type?: string) => void;\n mapEvent: (e: IFederatedEvent) => void;\n propagate: (e: IFederatedEvent, type?: string) => void;\n propagationPath: (target: IEventTarget) => IEventTarget[];\n copyWheelData: (from: IFederatedWheelEvent, to: IFederatedWheelEvent) => void;\n copyPointerData: (from: IFederatedEvent, to: IFederatedEvent) => void;\n copyMouseData: (from: IFederatedEvent, to: IFederatedEvent) => void;\n copyData: (from: IFederatedEvent, to: IFederatedEvent) => void;\n}\n\nexport interface IFederatedEvent<N = Event> {\n bubbles: boolean;\n cancelBubble: boolean;\n cancelable: boolean;\n composed: boolean;\n currentTarget: IEventTarget | null;\n defaultPrevented: boolean;\n eventPhase: number;\n isTrusted: boolean;\n returnValue: boolean;\n srcElement: IEventTarget;\n target: IEventTarget | null;\n timeStamp: number;\n type: string;\n nativeEvent: N;\n originalEvent: IFederatedEvent<N> | null;\n propagationStopped: boolean;\n propagationImmediatelyStopped: boolean;\n path: IEventTarget[];\n manager?: IEventManager;\n detail: any;\n view: any;\n layer: IPointLike;\n get layerX(): number;\n get layerY(): number;\n page: IPointLike;\n get pageX(): number;\n get pageY(): number;\n canvas: IPointLike;\n get x(): number;\n get y(): number;\n get canvasX(): number;\n get canvasY(): number;\n viewport: IPointLike;\n get viewX(): number;\n get viewY(): number;\n composedPath: () => IEventTarget[];\n preventDefault: () => void;\n stopImmediatePropagation: () => void;\n stopPropagation: () => void;\n initEvent: () => void;\n initUIEvent: () => void;\n clone: () => void;\n which: number;\n}\n\nexport interface IFederatedMouseEvent extends IFederatedEvent {\n altKey: boolean;\n button: number;\n buttons: number;\n ctrlKey: boolean;\n metaKey: boolean;\n relatedTarget: EventTarget | null;\n shiftKey: boolean;\n client: IPointLike;\n get clientX(): number;\n get clientY(): number;\n detail: number;\n movement: IPointLike;\n get movementX(): number;\n get movementY(): number;\n offset: IPointLike;\n get offsetX(): number;\n get offsetY(): number;\n global: IPointLike;\n get globalX(): number;\n get globalY(): number;\n screen: IPointLike;\n get screenX(): number;\n get screenY(): number;\n getModifierState: (key: string) => boolean;\n initMouseEvent: (\n _typeArg: string,\n _canBubbleArg: boolean,\n _cancelableArg: boolean,\n _viewArg: Window,\n _detailArg: number,\n _screenXArg: number,\n _screenYArg: number,\n _clientXArg: number,\n _clientYArg: number,\n _ctrlKeyArg: boolean,\n _altKeyArg: boolean,\n _shiftKeyArg: boolean,\n _metaKeyArg: boolean,\n _buttonArg: number,\n _relatedTargetArg: EventTarget\n ) => void;\n}\n\nexport interface IFederatedWheelEvent extends IFederatedMouseEvent {\n deltaMode: number;\n deltaX: number;\n deltaY: number;\n deltaZ: number;\n clone: () => IFederatedWheelEvent;\n}\n\nexport interface IFederatedPointerEvent extends IFederatedMouseEvent {\n pointerId: number;\n width: number;\n height: number;\n isPrimary: boolean;\n pointerType: string;\n pressure: number;\n tangentialPressure: number;\n tiltX: number;\n tiltY: number;\n twist: number;\n detail: number;\n getCoalescedEvents: () => PointerEvent[];\n getPredictedEvents: () => PointerEvent[];\n clone: () => IFederatedPointerEvent;\n}\n\n/**\n * 代码参考自 https://github.com/pixijs/pixijs\n * The MIT License\n\n Copyright (c) 2013-2023 Mathew Groves, Chad Engler\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in\n all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n THE SOFTWARE.\n */\n\nexport interface IEventTarget extends INode {\n /** Whether this event target should fire UI events. */\n pickable: boolean;\n /** The parent of this event target. */\n parent: IEventTarget | null;\n /** Whether this event target should be visible. */\n visible: boolean;\n\n /** The children of this event target. */\n children?: IEventTarget[];\n\n /** Whether this event target has any children that need UI events. This can be used optimize event propagation. */\n childrenPickable?: boolean;\n\n attribute?: Partial<IGraphicAttribute>;\n\n emit: (eventName: any, data: Dict<any>) => boolean;\n\n getCursor: () => string;\n setCursor: (c?: string) => void;\n}\n\nexport interface IRender {\n visualCanvas: {\n getCanvas: () => HTMLElement;\n };\n pickEvent: (position: [number, number], children: IEventTarget[], geoPick?: boolean) => IEventTarget | null;\n [key: string]: any;\n}\n\n// 事件系统扩展接口\nexport interface IEventExtension {\n /**\n * bind events\n */\n initEvents: () => void;\n /**\n * unbind events\n */\n removeEvents: () => void;\n /**\n * release\n */\n release: () => void;\n}\n\nexport type LooseFunction = (...args: any[]) => any;\n\nexport type IElementLike = Omit<IEventElement, 'on' | 'off' | 'once' | 'emit' | 'removeAllListeners'> & {\n style: CSSStyleDeclaration | Record<string, any>;\n getNativeHandler?: () => ICanvas;\n getBoundingClientRect: () => IDomRectLike;\n};\n\nexport type RenderConfig = {\n /**\n * 事件绑定的 canvas 元素\n */\n targetElement: IElementLike;\n /**\n * 环境分辨率\n */\n resolution: number;\n /**\n * 场景树根节点\n */\n rootNode: IEventTarget;\n global: IGlobal;\n /** 是否自动阻止事件 */\n autoPreventDefault?: boolean;\n /** 绘图视口 */\n viewport: {\n x: number;\n y: number;\n width: number;\n height: number;\n viewBox?: IBounds;\n };\n /**\n * 多次点击之间的最大时间,默认为 200 ms\n * @default 200\n */\n clickInterval?: number;\n};\n\nexport type NativeEvent = MouseEvent | PointerEvent | TouchEvent;\n\nexport type GraphicEventType =\n | 'pointerdown'\n | 'pointerup'\n // 指针抬起与按下的图形不同时触发\n | 'pointerupoutside'\n | 'pointertap'\n | 'pointerover'\n | 'pointerenter'\n | 'pointerleave'\n | 'pointerout'\n | 'mousedown'\n | 'mouseup'\n | 'mouseupoutside'\n // 右键操作\n | 'rightdown'\n | 'rightup'\n | 'rightupoutside'\n | 'click'\n // 双击\n | 'dblclick'\n | 'mousemove'\n | 'mouseover'\n | 'mouseout'\n // 不会冒泡\n | 'mouseenter'\n // 不会冒泡\n | 'mouseleave'\n | 'wheel'\n | 'tap'\n | 'touchstart'\n | 'touchend'\n | 'touchendoutside'\n | 'touchmove'\n | 'touchcancel'\n // dragNdrop\n | 'dragstart'\n | 'drag'\n | 'dragenter'\n | 'dragleave'\n | 'dragover'\n | 'dragend'\n | 'drop'\n // gesture\n | 'pan'\n | 'panstart'\n | 'panend'\n | 'press'\n | 'pressup'\n | 'pressend'\n | 'pinch'\n | 'pinchstart'\n | 'pinchend'\n | 'swipe';\n"]}
@@ -36,7 +36,13 @@ export interface IStageParams {
36
36
  ticker?: ITicker;
37
37
  pluginList?: string[];
38
38
  optimize?: IOptimizeType;
39
+ event?: EventConfig;
39
40
  }
41
+ export type EventConfig = {
42
+ autoPreventDefault?: boolean;
43
+ clickInterval?: number;
44
+ [key: string]: any;
45
+ };
40
46
  export type IOptimizeType = {
41
47
  skipRenderWithOutRange?: boolean;
42
48
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/interface/stage.ts"],"names":[],"mappings":"","file":"stage.js","sourcesContent":["import type { INode } from './node-tree';\nimport type { ILayer, LayerMode } from './layer';\nimport type { IGraphic } from './graphic';\nimport type { IGroup } from './graphic/group';\nimport type { IColor } from './color';\nimport type { IAABBBounds, IBounds, IBoundsLike, IMatrix, IPointLike } from '@visactor/vutils';\nimport type { ICamera } from './camera';\nimport type { vec3 } from './matrix';\nimport type { IDirectionLight } from './light';\nimport type { ISyncHook } from './sync-hook';\nimport type { IDrawContext, IRenderService } from './render';\nimport type { ITicker, ITimeline } from './animate';\nimport type { IPickerService, PickResult } from './picker';\nimport type { IPluginService } from './plugin';\nimport type { IWindow } from './window';\nimport type { ILayerService } from './core';\n\nexport type IExportType = 'canvas' | 'imageData';\n\nexport interface IStageParams {\n // x: number;\n // y: number;\n // // 视口的宽高\n // viewWidth: number;\n // viewHeight: number;\n\n // 视口的宽高\n viewBox: IBoundsLike;\n // 总的宽高\n width: number;\n height: number;\n dpr: number;\n // stage的背景\n background: string | IColor;\n // 外部的canvas\n canvas: string | HTMLCanvasElement;\n // canvas的container容器,如果不传入canvas,那就会在容器中创建canvas\n container: string | HTMLElement;\n // 是否是受控制的canvas,如果不是的话,不会进行resize等操作,也不会修改canvas的样式\n canvasControled: boolean;\n title: string;\n // 是否开启自动渲染\n autoRender: boolean;\n // 是否开启布局支持\n enableLayout: boolean;\n // 是否关闭脏矩形检测\n disableDirtyBounds: boolean;\n // 是否支持interactiveLayer,默认为true\n interactiveLayer: boolean;\n // 是否支持HTML属性\n enableHtmlAttribute: string | boolean | HTMLElement;\n // 是否支持滚动条\n enableScroll: boolean;\n poptip: boolean;\n // 绘制之前的钩子函数\n beforeRender: (stage: IStage) => void;\n // 绘制之后的钩子函数\n afterRender: (stage: IStage) => void;\n renderStyle?: string;\n ticker?: ITicker;\n pluginList?: string[];\n // 优化配置\n optimize?: IOptimizeType;\n}\n\nexport type IOptimizeType = {\n // 视口不在可视区,跳过渲染,默认为true\n skipRenderWithOutRange?: boolean;\n};\n\nexport interface IOption3D {\n enableView3dTransform?: boolean; // 是否开启view3d自动旋转\n alpha?: number; // x轴的转角\n beta?: number; // y轴的转角\n gama?: number; // z轴的转角\n center?: { x?: number; y?: number; z?: number; dx?: number; dy?: number; dz?: number }; // 中心位置\n fieldRatio?: number; // 透视的视域缩放比例\n fieldDepth?: number;\n light?: {\n dir?: vec3;\n color?: string;\n ambient?: number;\n };\n // 配置相机后,alpha、beta、gamma配置会失效\n camera?: any; // 相机配置\n}\n\n// TODO 命名方式\nexport interface IStage extends INode {\n stage?: IStage;\n parent: IStage | null;\n // rootNode: IStage;\n x: number;\n y: number;\n\n params: Partial<IStageParams>;\n\n window: IWindow;\n\n width: number;\n height: number;\n viewWidth: number;\n viewHeight: number;\n defaultLayer: ILayer;\n dirtyBounds: IBounds | null;\n\n autoRender: boolean;\n renderCount: number;\n\n hooks: {\n beforeRender: ISyncHook<[IStage]>;\n afterRender: ISyncHook<[IStage]>;\n };\n\n option3d?: IOption3D;\n\n set3dOptions: (options: IOption3D) => void;\n light?: IDirectionLight;\n camera?: ICamera;\n\n dpr: number;\n\n viewBox: IBoundsLike;\n background: string | IColor;\n ticker: ITicker;\n increaseAutoRender: boolean;\n readonly renderService: IRenderService;\n readonly pickerService: IPickerService;\n readonly pluginService: IPluginService;\n readonly layerService: ILayerService;\n // 如果传入CanvasId,如果存在相同Id,说明这两个图层使用相同的Canvas绘制\n // 但需要注意的是依然是两个图层(用于解决Table嵌入ChartSpace不影响Table的绘制)\n createLayer: (canvasId?: string, layerMode?: LayerMode) => ILayer;\n getLayer: (name: string) => ILayer;\n sortLayer: (cb: (layer1: ILayer, layer2: ILayer) => number) => void;\n removeLayer: (layerId: number) => ILayer | false;\n\n getTimeline: () => ITimeline;\n\n render: (layers?: ILayer[], params?: Partial<IDrawContext>) => void;\n /**\n * 下一帧渲染\n * @param layers 渲染的图层\n * @param force 是否强行下一帧渲染,不采取优化方案\n * @returns\n */\n renderNextFrame: (layers?: ILayer[], force?: boolean) => void;\n tryInitInteractiveLayer: () => void;\n\n // 画布操作\n resize: (w: number, h: number, rerender?: boolean) => void;\n resizeWindow: (w: number, h: number, rerender?: boolean) => void;\n resizeView: (w: number, h: number, rerender?: boolean) => void;\n setViewBox:\n | ((viewBox: IBoundsLike, rerender: boolean) => void)\n | ((x: number, y: number, w: number, h: number, rerender: boolean) => void)\n | ((x: number | IBoundsLike, y: number | boolean, w?: number, h?: number, rerender?: boolean) => void);\n setDpr: (dpr: number, rerender?: boolean) => void;\n setOrigin: (x: number, y: number) => void;\n export: (type: IExportType) => HTMLCanvasElement | ImageData;\n pick: (x: number, y: number) => PickResult | false;\n\n // 动画相关\n startAnimate: (t: number) => void;\n setToFrame: (t: number) => void;\n dirty: (b: IBounds, matrix?: IMatrix) => void;\n // 考虑操作回放\n\n renderTo: (window: IWindow, params: { x: number; y: number; width: number; height: number }) => void;\n\n renderToNewWindow: (fullImage?: boolean) => IWindow;\n\n toCanvas: (fullImage?: boolean, viewBox?: IAABBBounds) => HTMLCanvasElement | null;\n\n setBeforeRender: (cb: (stage: IStage) => void) => void;\n\n setAfterRender: (cb: (stage: IStage) => void) => void;\n\n afterNextRender: (cb: (stage: IStage) => void) => void;\n enableAutoRender: () => void;\n disableAutoRender: () => void;\n enableIncrementalAutoRender: () => void;\n disableIncrementalAutoRender: () => void;\n enableDirtyBounds: () => void;\n disableDirtyBounds: () => void;\n enableView3dTransform: () => void;\n disableView3dTranform: () => void;\n clearViewBox: (color?: string) => void;\n release: () => void;\n setStage: (stage?: IStage) => void;\n\n setCursor: (mode?: string) => void;\n}\n\nexport declare function combineStage(srages: IStage[], params: { canvas: string | HTMLCanvasElement }): IStage;\n"]}
1
+ {"version":3,"sources":["../src/interface/stage.ts"],"names":[],"mappings":"","file":"stage.js","sourcesContent":["import type { INode } from './node-tree';\nimport type { ILayer, LayerMode } from './layer';\nimport type { IGraphic } from './graphic';\nimport type { IGroup } from './graphic/group';\nimport type { IColor } from './color';\nimport type { IAABBBounds, IBounds, IBoundsLike, IMatrix, IPointLike } from '@visactor/vutils';\nimport type { ICamera } from './camera';\nimport type { vec3 } from './matrix';\nimport type { IDirectionLight } from './light';\nimport type { ISyncHook } from './sync-hook';\nimport type { IDrawContext, IRenderService } from './render';\nimport type { ITicker, ITimeline } from './animate';\nimport type { IPickerService, PickResult } from './picker';\nimport type { IPluginService } from './plugin';\nimport type { IWindow } from './window';\nimport type { ILayerService } from './core';\n\nexport type IExportType = 'canvas' | 'imageData';\n\nexport interface IStageParams {\n // x: number;\n // y: number;\n // // 视口的宽高\n // viewWidth: number;\n // viewHeight: number;\n\n // 视口的宽高\n viewBox: IBoundsLike;\n // 总的宽高\n width: number;\n height: number;\n dpr: number;\n // stage的背景\n background: string | IColor;\n // 外部的canvas\n canvas: string | HTMLCanvasElement;\n // canvas的container容器,如果不传入canvas,那就会在容器中创建canvas\n container: string | HTMLElement;\n // 是否是受控制的canvas,如果不是的话,不会进行resize等操作,也不会修改canvas的样式\n canvasControled: boolean;\n title: string;\n // 是否开启自动渲染\n autoRender: boolean;\n // 是否开启布局支持\n enableLayout: boolean;\n // 是否关闭脏矩形检测\n disableDirtyBounds: boolean;\n // 是否支持interactiveLayer,默认为true\n interactiveLayer: boolean;\n // 是否支持HTML属性\n enableHtmlAttribute: string | boolean | HTMLElement;\n // 是否支持滚动条\n enableScroll: boolean;\n poptip: boolean;\n // 绘制之前的钩子函数\n beforeRender: (stage: IStage) => void;\n // 绘制之后的钩子函数\n afterRender: (stage: IStage) => void;\n renderStyle?: string;\n ticker?: ITicker;\n pluginList?: string[];\n // 优化配置\n optimize?: IOptimizeType;\n /**\n * 事件系统相关配置\n */\n event?: EventConfig;\n}\n\nexport type EventConfig = {\n /** 是否自动阻止事件 */\n autoPreventDefault?: boolean;\n /**\n * 多次点击之间的最大时间,默认为 200 ms\n * @default 200\n */\n clickInterval?: number;\n [key: string]: any;\n};\n\nexport type IOptimizeType = {\n // 视口不在可视区,跳过渲染,默认为true\n skipRenderWithOutRange?: boolean;\n};\n\nexport interface IOption3D {\n enableView3dTransform?: boolean; // 是否开启view3d自动旋转\n alpha?: number; // x轴的转角\n beta?: number; // y轴的转角\n gama?: number; // z轴的转角\n center?: { x?: number; y?: number; z?: number; dx?: number; dy?: number; dz?: number }; // 中心位置\n fieldRatio?: number; // 透视的视域缩放比例\n fieldDepth?: number;\n light?: {\n dir?: vec3;\n color?: string;\n ambient?: number;\n };\n // 配置相机后,alpha、beta、gamma配置会失效\n camera?: any; // 相机配置\n}\n\n// TODO 命名方式\nexport interface IStage extends INode {\n stage?: IStage;\n parent: IStage | null;\n // rootNode: IStage;\n x: number;\n y: number;\n\n params: Partial<IStageParams>;\n\n window: IWindow;\n\n width: number;\n height: number;\n viewWidth: number;\n viewHeight: number;\n defaultLayer: ILayer;\n dirtyBounds: IBounds | null;\n\n autoRender: boolean;\n renderCount: number;\n\n hooks: {\n beforeRender: ISyncHook<[IStage]>;\n afterRender: ISyncHook<[IStage]>;\n };\n\n option3d?: IOption3D;\n\n set3dOptions: (options: IOption3D) => void;\n light?: IDirectionLight;\n camera?: ICamera;\n\n dpr: number;\n\n viewBox: IBoundsLike;\n background: string | IColor;\n ticker: ITicker;\n increaseAutoRender: boolean;\n readonly renderService: IRenderService;\n readonly pickerService: IPickerService;\n readonly pluginService: IPluginService;\n readonly layerService: ILayerService;\n // 如果传入CanvasId,如果存在相同Id,说明这两个图层使用相同的Canvas绘制\n // 但需要注意的是依然是两个图层(用于解决Table嵌入ChartSpace不影响Table的绘制)\n createLayer: (canvasId?: string, layerMode?: LayerMode) => ILayer;\n getLayer: (name: string) => ILayer;\n sortLayer: (cb: (layer1: ILayer, layer2: ILayer) => number) => void;\n removeLayer: (layerId: number) => ILayer | false;\n\n getTimeline: () => ITimeline;\n\n render: (layers?: ILayer[], params?: Partial<IDrawContext>) => void;\n /**\n * 下一帧渲染\n * @param layers 渲染的图层\n * @param force 是否强行下一帧渲染,不采取优化方案\n * @returns\n */\n renderNextFrame: (layers?: ILayer[], force?: boolean) => void;\n tryInitInteractiveLayer: () => void;\n\n // 画布操作\n resize: (w: number, h: number, rerender?: boolean) => void;\n resizeWindow: (w: number, h: number, rerender?: boolean) => void;\n resizeView: (w: number, h: number, rerender?: boolean) => void;\n setViewBox:\n | ((viewBox: IBoundsLike, rerender: boolean) => void)\n | ((x: number, y: number, w: number, h: number, rerender: boolean) => void)\n | ((x: number | IBoundsLike, y: number | boolean, w?: number, h?: number, rerender?: boolean) => void);\n setDpr: (dpr: number, rerender?: boolean) => void;\n setOrigin: (x: number, y: number) => void;\n export: (type: IExportType) => HTMLCanvasElement | ImageData;\n pick: (x: number, y: number) => PickResult | false;\n\n // 动画相关\n startAnimate: (t: number) => void;\n setToFrame: (t: number) => void;\n dirty: (b: IBounds, matrix?: IMatrix) => void;\n // 考虑操作回放\n\n renderTo: (window: IWindow, params: { x: number; y: number; width: number; height: number }) => void;\n\n renderToNewWindow: (fullImage?: boolean) => IWindow;\n\n toCanvas: (fullImage?: boolean, viewBox?: IAABBBounds) => HTMLCanvasElement | null;\n\n setBeforeRender: (cb: (stage: IStage) => void) => void;\n\n setAfterRender: (cb: (stage: IStage) => void) => void;\n\n afterNextRender: (cb: (stage: IStage) => void) => void;\n enableAutoRender: () => void;\n disableAutoRender: () => void;\n enableIncrementalAutoRender: () => void;\n disableIncrementalAutoRender: () => void;\n enableDirtyBounds: () => void;\n disableDirtyBounds: () => void;\n enableView3dTransform: () => void;\n disableView3dTranform: () => void;\n clearViewBox: (color?: string) => void;\n release: () => void;\n setStage: (stage?: IStage) => void;\n\n setCursor: (mode?: string) => void;\n}\n\nexport declare function combineStage(srages: IStage[], params: { canvas: string | HTMLCanvasElement }): IStage;\n"]}
package/dist/index.js CHANGED
@@ -6581,8 +6581,9 @@
6581
6581
  function isMouseLike(pointerType) {
6582
6582
  return pointerType === 'mouse' || pointerType === 'pen';
6583
6583
  }
6584
+ const DEFAULT_CLICK_INTERVAL = 200;
6584
6585
  class EventManager {
6585
- constructor(root) {
6586
+ constructor(root, config) {
6586
6587
  this.dispatch = new vutils.EventEmitter();
6587
6588
  this.mappingState = {
6588
6589
  trackingData: {}
@@ -6741,6 +6742,7 @@
6741
6742
  this.cursor = '';
6742
6743
  };
6743
6744
  this.onPointerUp = (from, target) => {
6745
+ var _a;
6744
6746
  if (!(from instanceof FederatedPointerEvent)) {
6745
6747
  console.warn('EventManager cannot map a non-pointer event as a pointer event');
6746
6748
  return;
@@ -6787,7 +6789,8 @@
6787
6789
  };
6788
6790
  }
6789
6791
  const clickHistory = trackingData.clicksByButton[from.button];
6790
- if (clickHistory.target === clickEvent.target && now - clickHistory.timeStamp < 200) {
6792
+ if (clickHistory.target === clickEvent.target &&
6793
+ now - clickHistory.timeStamp < ((_a = this._config.clickInterval) !== null && _a !== void 0 ? _a : DEFAULT_CLICK_INTERVAL)) {
6791
6794
  ++clickHistory.clickCount;
6792
6795
  }
6793
6796
  else {
@@ -6846,6 +6849,7 @@
6846
6849
  };
6847
6850
  this.rootTarget = root;
6848
6851
  this.mappingTable = {};
6852
+ this._config = Object.assign({ clickInterval: DEFAULT_CLICK_INTERVAL }, config);
6849
6853
  this.addEventMapping('pointerdown', this.onPointerDown);
6850
6854
  this.addEventMapping('pointermove', this.onPointerMove);
6851
6855
  this.addEventMapping('pointerout', this.onPointerOut);
@@ -7237,8 +7241,10 @@
7237
7241
  const wheelEvent = this.normalizeWheelEvent(nativeEvent);
7238
7242
  this.manager.mapEvent(wheelEvent);
7239
7243
  };
7240
- const { targetElement, resolution, rootNode, global, viewport, autoPreventDefault = false } = params;
7241
- this.manager = new EventManager(rootNode);
7244
+ const { targetElement, resolution, rootNode, global, viewport, autoPreventDefault = false, clickInterval } = params;
7245
+ this.manager = new EventManager(rootNode, {
7246
+ clickInterval
7247
+ });
7242
7248
  this.globalObj = global;
7243
7249
  this.supportsPointerEvents = global.supportsPointerEvents;
7244
7250
  this.supportsTouchEvents = global.supportsTouchEvents;
@@ -11366,13 +11372,11 @@
11366
11372
  ];
11367
11373
  const GRAPHIC_UPDATE_TAG_KEY = [
11368
11374
  'lineWidth',
11369
- 'lineCap',
11370
- 'lineJoin',
11371
- 'miterLimit',
11372
11375
  'scaleX',
11373
11376
  'scaleY',
11374
11377
  'angle',
11375
- 'anchor'
11378
+ 'anchor',
11379
+ 'visible'
11376
11380
  ];
11377
11381
  const tempConstantXYKey = ['x', 'y'];
11378
11382
  const tempConstantScaleXYKey = ['scaleX', 'scaleY'];
@@ -17256,7 +17260,7 @@
17256
17260
  }
17257
17261
  doUpdateFrameCache() {
17258
17262
  var _a;
17259
- const { textConfig, maxWidth, maxHeight, width, height, ellipsis, wordBreak, verticalDirection, textAlign, textBaseline, layoutDirection, singleLine } = this.attribute;
17263
+ const { textConfig = [], maxWidth, maxHeight, width, height, ellipsis, wordBreak, verticalDirection, textAlign, textBaseline, layoutDirection, singleLine } = this.attribute;
17260
17264
  const paragraphs = [];
17261
17265
  for (let i = 0; i < textConfig.length; i++) {
17262
17266
  if ('image' in textConfig[i]) {
@@ -18611,6 +18615,9 @@
18611
18615
  return true;
18612
18616
  }
18613
18617
  updateRectAABBBounds(attribute, rectTheme, aabbBounds, graphic) {
18618
+ if (!this._validCheck(attribute, rectTheme, aabbBounds, graphic)) {
18619
+ return aabbBounds;
18620
+ }
18614
18621
  if (!this.updatePathProxyAABBBounds(aabbBounds, graphic)) {
18615
18622
  const { width = rectTheme.width, height = rectTheme.height } = attribute;
18616
18623
  aabbBounds.set(0, 0, width, height);
@@ -18654,12 +18661,18 @@
18654
18661
  return aabbBounds;
18655
18662
  }
18656
18663
  updateGlyphAABBBounds(attribute, theme, aabbBounds, graphic) {
18664
+ if (!this._validCheck(attribute, theme, aabbBounds, graphic)) {
18665
+ return aabbBounds;
18666
+ }
18657
18667
  graphic.getSubGraphic().forEach((node) => {
18658
18668
  aabbBounds.union(node.AABBBounds);
18659
18669
  });
18660
18670
  return aabbBounds;
18661
18671
  }
18662
18672
  updateRichTextAABBBounds(attribute, richtextTheme, aabbBounds, graphic) {
18673
+ if (!this._validCheck(attribute, richtextTheme, aabbBounds, graphic)) {
18674
+ return aabbBounds;
18675
+ }
18663
18676
  if (!graphic) {
18664
18677
  return aabbBounds;
18665
18678
  }
@@ -18709,6 +18722,9 @@
18709
18722
  return aabbBounds;
18710
18723
  }
18711
18724
  updateTextAABBBounds(attribute, textTheme, aabbBounds, graphic) {
18725
+ if (!this._validCheck(attribute, textTheme, aabbBounds, graphic)) {
18726
+ return aabbBounds;
18727
+ }
18712
18728
  if (!graphic) {
18713
18729
  return aabbBounds;
18714
18730
  }
@@ -18734,6 +18750,9 @@
18734
18750
  return aabbBounds;
18735
18751
  }
18736
18752
  updatePathAABBBounds(attribute, pathTheme, aabbBounds, graphic) {
18753
+ if (!this._validCheck(attribute, pathTheme, aabbBounds, graphic)) {
18754
+ return aabbBounds;
18755
+ }
18737
18756
  if (!this.updatePathProxyAABBBounds(aabbBounds, graphic)) {
18738
18757
  this.updatePathAABBBoundsImprecise(attribute, pathTheme, aabbBounds, graphic);
18739
18758
  }
@@ -18802,6 +18821,9 @@
18802
18821
  return aabbBounds;
18803
18822
  }
18804
18823
  updatePolygonAABBBounds(attribute, polygonTheme, aabbBounds, graphic) {
18824
+ if (!this._validCheck(attribute, polygonTheme, aabbBounds, graphic)) {
18825
+ return aabbBounds;
18826
+ }
18805
18827
  if (!this.updatePathProxyAABBBounds(aabbBounds, graphic)) {
18806
18828
  this.updatePolygonAABBBoundsImprecise(attribute, polygonTheme, aabbBounds, graphic);
18807
18829
  }
@@ -18821,6 +18843,9 @@
18821
18843
  return aabbBounds;
18822
18844
  }
18823
18845
  updateLineAABBBounds(attribute, lineTheme, aabbBounds, graphic) {
18846
+ if (!this._validCheck(attribute, lineTheme, aabbBounds, graphic)) {
18847
+ return aabbBounds;
18848
+ }
18824
18849
  if (!this.updatePathProxyAABBBounds(aabbBounds, graphic)) {
18825
18850
  attribute.segments
18826
18851
  ? this.updateLineAABBBoundsBySegments(attribute, lineTheme, aabbBounds, graphic)
@@ -18853,6 +18878,9 @@
18853
18878
  return b;
18854
18879
  }
18855
18880
  updateAreaAABBBounds(attribute, areaTheme, aabbBounds, graphic) {
18881
+ if (!this._validCheck(attribute, areaTheme, aabbBounds, graphic)) {
18882
+ return aabbBounds;
18883
+ }
18856
18884
  if (!this.updatePathProxyAABBBounds(aabbBounds, graphic)) {
18857
18885
  attribute.segments
18858
18886
  ? this.updateAreaAABBBoundsBySegments(attribute, areaTheme, aabbBounds, graphic)
@@ -18889,6 +18917,9 @@
18889
18917
  return b;
18890
18918
  }
18891
18919
  updateCircleAABBBounds(attribute, circleTheme, aabbBounds, full, graphic) {
18920
+ if (!this._validCheck(attribute, circleTheme, aabbBounds, graphic)) {
18921
+ return aabbBounds;
18922
+ }
18892
18923
  if (!this.updatePathProxyAABBBounds(aabbBounds, graphic)) {
18893
18924
  full
18894
18925
  ? this.updateCircleAABBBoundsImprecise(attribute, circleTheme, aabbBounds, graphic)
@@ -18926,6 +18957,9 @@
18926
18957
  return aabbBounds;
18927
18958
  }
18928
18959
  updateArcAABBBounds(attribute, arcTheme, aabbBounds, full, graphic) {
18960
+ if (!this._validCheck(attribute, arcTheme, aabbBounds, graphic)) {
18961
+ return aabbBounds;
18962
+ }
18929
18963
  if (!this.updatePathProxyAABBBounds(aabbBounds, graphic)) {
18930
18964
  full
18931
18965
  ? this.updateArcAABBBoundsImprecise(attribute, arcTheme, aabbBounds, graphic)
@@ -18979,6 +19013,9 @@
18979
19013
  return aabbBounds;
18980
19014
  }
18981
19015
  updateSymbolAABBBounds(attribute, symbolTheme, aabbBounds, full, graphic) {
19016
+ if (!this._validCheck(attribute, symbolTheme, aabbBounds, graphic)) {
19017
+ return aabbBounds;
19018
+ }
18982
19019
  if (!this.updatePathProxyAABBBounds(aabbBounds, graphic)) {
18983
19020
  full
18984
19021
  ? this.updateSymbolAABBBoundsImprecise(attribute, symbolTheme, aabbBounds, graphic)
@@ -19022,6 +19059,9 @@
19022
19059
  return aabbBounds;
19023
19060
  }
19024
19061
  updateImageAABBBounds(attribute, imageTheme, aabbBounds, graphic) {
19062
+ if (!this._validCheck(attribute, imageTheme, aabbBounds, graphic)) {
19063
+ return aabbBounds;
19064
+ }
19025
19065
  if (!this.updatePathProxyAABBBounds(aabbBounds, graphic)) {
19026
19066
  const { width = imageTheme.width, height = imageTheme.height } = attribute;
19027
19067
  aabbBounds.set(0, 0, width, height);
@@ -19057,6 +19097,21 @@
19057
19097
  this.combindShadowAABBBounds(aabbBounds, graphic);
19058
19098
  vutils.transformBoundsWithMatrix(aabbBounds, aabbBounds, graphic.transMatrix);
19059
19099
  }
19100
+ _validCheck(attribute, theme, aabbBounds, graphic) {
19101
+ if (!graphic) {
19102
+ return true;
19103
+ }
19104
+ if (!graphic.valid) {
19105
+ aabbBounds.clear();
19106
+ return false;
19107
+ }
19108
+ const { visible = theme.visible } = attribute;
19109
+ if (!visible) {
19110
+ aabbBounds.clear();
19111
+ return false;
19112
+ }
19113
+ return true;
19114
+ }
19060
19115
  };
19061
19116
  exports.DefaultGraphicService = __decorate([
19062
19117
  injectable(),
@@ -26225,12 +26280,7 @@
26225
26280
  this.stage = this;
26226
26281
  this.renderStyle = params.renderStyle;
26227
26282
  if (this.global.supportEvent) {
26228
- this.eventSystem = new EventSystem({
26229
- targetElement: this.window,
26230
- resolution: this.window.dpr || this.global.devicePixelRatio,
26231
- rootNode: this,
26232
- global: this.global,
26233
- viewport: {
26283
+ this.eventSystem = new EventSystem(Object.assign({ targetElement: this.window, resolution: this.window.dpr || this.global.devicePixelRatio, rootNode: this, global: this.global, viewport: {
26234
26284
  viewBox: this._viewBox,
26235
26285
  get x() {
26236
26286
  return this.viewBox.x1;
@@ -26244,8 +26294,7 @@
26244
26294
  get height() {
26245
26295
  return this.viewBox.height();
26246
26296
  }
26247
- }
26248
- });
26297
+ } }, params.event));
26249
26298
  }
26250
26299
  if (params.autoRender) {
26251
26300
  this.enableAutoRender();
@@ -26267,7 +26316,7 @@
26267
26316
  this.ticker.addTimeline(this.timeline);
26268
26317
  this.timeline.pause();
26269
26318
  this.optmize(params.optimize);
26270
- if (this._background && vutils.isString(this._background)) {
26319
+ if (params.background && vutils.isString(this._background) && this._background.includes('/')) {
26271
26320
  this.setAttributes({ background: this._background });
26272
26321
  }
26273
26322
  }