diff --git a/__tests__/demos/bugfix/1677.ts b/__tests__/demos/bugfix/1677.ts index fceeea2bd..c60ab2bea 100644 --- a/__tests__/demos/bugfix/1677.ts +++ b/__tests__/demos/bugfix/1677.ts @@ -23,7 +23,6 @@ export async function shadowroot_offset(context) { width: 500, height: 500, renderer: new Renderer(), - supportsCSSTransform: true, }); const circle = new Circle({ diff --git a/__tests__/demos/event/dblClick.ts b/__tests__/demos/event/dblClick.ts index afdbd314e..04dbdbbcf 100644 --- a/__tests__/demos/event/dblClick.ts +++ b/__tests__/demos/event/dblClick.ts @@ -1,11 +1,11 @@ -import { Circle, Text } from '@antv/g'; +import { Circle, Text, Canvas } from '@antv/g'; -export async function dblClick(context) { +export async function dblClick(context: { canvas: Canvas }) { const { canvas } = context; await canvas.ready; let DELAY = 200; - canvas.dblClickSpeed = DELAY; + canvas.getConfig().dblClickSpeed = DELAY; const circle0 = new Circle({ style: { @@ -43,7 +43,7 @@ export async function dblClick(context) { circle0.addEventListener('mouseenter', () => { DELAY = 200; - canvas.dblClickSpeed = DELAY; + canvas.getConfig().dblClickSpeed = DELAY; text0.attr({ text: `current dblclick delay: ${DELAY}ms` }); text1.attr({ @@ -52,7 +52,7 @@ export async function dblClick(context) { }); circle1.addEventListener('mouseenter', () => { DELAY = 500; - canvas.dblClickSpeed = DELAY; + canvas.getConfig().dblClickSpeed = DELAY; text0.attr({ text: `current dblclick delay: ${DELAY}ms` }); text1.attr({ @@ -61,7 +61,7 @@ export async function dblClick(context) { }); circle2.addEventListener('mouseenter', () => { DELAY = 1000; - canvas.dblClickSpeed = DELAY; + canvas.getConfig().dblClickSpeed = DELAY; text0.attr({ text: `current dblclick delay: ${DELAY}ms` }); text1.attr({ diff --git a/__tests__/demos/perf/event.ts b/__tests__/demos/perf/event.ts new file mode 100644 index 000000000..d89682f56 --- /dev/null +++ b/__tests__/demos/perf/event.ts @@ -0,0 +1,93 @@ +import { + Canvas, + ElementEvent, + Rect, + Group, + CustomEvent, + EventTarget, +} from '@antv/g'; +import * as tinybench from 'tinybench'; + +export async function event(context: { canvas: Canvas }) { + const { canvas } = context; + console.log(canvas); + + await canvas.ready; + + const { width, height } = canvas.getConfig(); + const root = new Group(); + let count = 2e4; + let rects = []; + let eventTargets = []; + + function render() { + root.destroyChildren(); + rects = []; + + for (let i = 0; i < count; i++) { + const x = Math.random() * width; + const y = Math.random() * height; + const size = 10 + Math.random() * 40; + const speed = 1 + Math.random(); + + const rect = new Rect({ + style: { + x, + y, + width: size, + height: size, + fill: 'white', + stroke: '#000', + lineWidth: 1, + }, + }); + root.appendChild(rect); + rects[i] = { x, y, size, speed, el: rect }; + + // --- + const eventTarge = new EventTarget(); + eventTargets.push(eventTarge); + eventTarge.addEventListener(ElementEvent.BOUNDS_CHANGED, () => { + // + }); + } + } + + render(); + canvas.appendChild(root); + + // benchmark + // ---------- + const boundsChangedEvent = new CustomEvent(ElementEvent.BOUNDS_CHANGED); + boundsChangedEvent.detail = { affectChildren: true }; + + const bench = new tinybench.Bench({ name: 'event benchmark', time: 1e2 }); + + bench.add('Iterating trigger events', async () => { + root.forEach((el) => { + el.dispatchEvent(boundsChangedEvent); + }); + }); + bench.add('Iterating trigger events without propagate', async () => { + root.forEach((el) => { + el.dispatchEvent(boundsChangedEvent, true); + }); + }); + bench.add('Iterating over trigger events on empty objects', async () => { + eventTargets.forEach((el) => { + el.dispatchEvent(boundsChangedEvent); + }); + }); + bench.add('Batch triggering events', async () => { + canvas.dispatchEvent(boundsChangedEvent, true); + }); + + await bench.run(); + + console.log(bench.name); + console.table(bench.table()); + console.log(bench.results); + console.log(bench.tasks); + + // ---------- +} diff --git a/packages/g-camera-api/CHANGELOG.md b/packages/g-camera-api/CHANGELOG.md index 1bdef3d68..88b6f74c1 100644 --- a/packages/g-camera-api/CHANGELOG.md +++ b/packages/g-camera-api/CHANGELOG.md @@ -1,5 +1,15 @@ # @antv/g-camera-api +## 2.0.29 + +### Patch Changes + +- Updated dependencies [244d6dd] +- Updated dependencies [9ebc16b] +- Updated dependencies [2d71558] +- Updated dependencies [fad9325] + - @antv/g-lite@2.2.10 + ## 2.0.28 ### Patch Changes diff --git a/packages/g-camera-api/package.json b/packages/g-camera-api/package.json index b7ff07ba0..337566418 100644 --- a/packages/g-camera-api/package.json +++ b/packages/g-camera-api/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-camera-api", - "version": "2.0.28", + "version": "2.0.29", "description": "A simple implementation of Camera API.", "keywords": [ "antv", diff --git a/packages/g-canvas/CHANGELOG.md b/packages/g-canvas/CHANGELOG.md index 76f90acfa..1aa0a3472 100644 --- a/packages/g-canvas/CHANGELOG.md +++ b/packages/g-canvas/CHANGELOG.md @@ -1,5 +1,22 @@ # @antv/g-canvas +## 2.0.33 + +### Patch Changes + +- 244d6dd: refactor: reduce global redundant code +- Updated dependencies [244d6dd] +- Updated dependencies [9ebc16b] +- Updated dependencies [2d71558] +- Updated dependencies [fad9325] + - @antv/g-plugin-image-loader@2.1.12 + - @antv/g-lite@2.2.10 + - @antv/g-plugin-canvas-renderer@2.2.12 + - @antv/g-plugin-canvas-path-generator@2.1.10 + - @antv/g-plugin-canvas-picker@2.1.12 + - @antv/g-plugin-dom-interaction@2.1.15 + - @antv/g-plugin-html-renderer@2.1.15 + ## 2.0.32 ### Patch Changes diff --git a/packages/g-canvas/package.json b/packages/g-canvas/package.json index f8468b1e7..9dcfeb311 100644 --- a/packages/g-canvas/package.json +++ b/packages/g-canvas/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-canvas", - "version": "2.0.32", + "version": "2.0.33", "description": "A renderer implemented by Canvas 2D API", "keywords": [ "antv", diff --git a/packages/g-canvas/src/Canvas2DContextService.ts b/packages/g-canvas/src/Canvas2DContextService.ts index 860f504a1..cd7049ddc 100644 --- a/packages/g-canvas/src/Canvas2DContextService.ts +++ b/packages/g-canvas/src/Canvas2DContextService.ts @@ -7,7 +7,7 @@ import type { CanvasConfig, ContextService, } from '@antv/g-lite'; -import { RenderReason, isBrowser, setDOMSize } from '@antv/g-lite'; +import { RenderReason, setDOMSize } from '@antv/g-lite'; import { isString } from '@antv/util'; export class Canvas2DContextService @@ -92,11 +92,7 @@ export class Canvas2DContextService } resize(width: number, height: number) { - const { devicePixelRatio } = this.canvasConfig; - - // use user-defined dpr first - let dpr = devicePixelRatio || (isBrowser && window.devicePixelRatio) || 1; - dpr = dpr >= 1 ? Math.ceil(dpr) : 1; + const { devicePixelRatio: dpr } = this.canvasConfig; this.dpr = dpr; if (this.$canvas) { diff --git a/packages/g-canvaskit/CHANGELOG.md b/packages/g-canvaskit/CHANGELOG.md index aa1bc041a..194e03a23 100644 --- a/packages/g-canvaskit/CHANGELOG.md +++ b/packages/g-canvaskit/CHANGELOG.md @@ -1,5 +1,22 @@ # @antv/g-canvaskit +## 1.0.32 + +### Patch Changes + +- 244d6dd: refactor: reduce global redundant code +- Updated dependencies [244d6dd] +- Updated dependencies [9ebc16b] +- Updated dependencies [2d71558] +- Updated dependencies [fad9325] + - @antv/g-plugin-image-loader@2.1.12 + - @antv/g-lite@2.2.10 + - @antv/g-plugin-canvaskit-renderer@2.1.12 + - @antv/g-plugin-canvas-path-generator@2.1.10 + - @antv/g-plugin-canvas-picker@2.1.12 + - @antv/g-plugin-dom-interaction@2.1.15 + - @antv/g-plugin-html-renderer@2.1.15 + ## 1.0.31 ### Patch Changes diff --git a/packages/g-canvaskit/package.json b/packages/g-canvaskit/package.json index 430144c13..26cd850bc 100644 --- a/packages/g-canvaskit/package.json +++ b/packages/g-canvaskit/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-canvaskit", - "version": "1.0.31", + "version": "1.0.32", "description": "A renderer implemented by CanvasKit", "keywords": [ "antv", diff --git a/packages/g-canvaskit/src/CanvasKitContextService.ts b/packages/g-canvaskit/src/CanvasKitContextService.ts index 12d082ae1..00521bbe7 100644 --- a/packages/g-canvaskit/src/CanvasKitContextService.ts +++ b/packages/g-canvaskit/src/CanvasKitContextService.ts @@ -6,7 +6,7 @@ import type { CanvasConfig, ContextService, } from '@antv/g-lite'; -import { isBrowser, setDOMSize } from '@antv/g-lite'; +import { setDOMSize } from '@antv/g-lite'; import type * as CanvaskitRenderer from '@antv/g-plugin-canvaskit-renderer'; import type { CanvasKitContext } from '@antv/g-plugin-canvaskit-renderer'; import { isString } from '@antv/util'; @@ -40,7 +40,7 @@ export class CanvasKitContextService } async initAsync() { - const { container, canvas, devicePixelRatio } = this.canvasConfig; + const { container, canvas, devicePixelRatio: dpr } = this.canvasConfig; if (canvas) { this.$canvas = canvas; @@ -71,9 +71,6 @@ export class CanvasKitContextService } } - // use user-defined dpr first - let dpr = devicePixelRatio || (isBrowser && window.devicePixelRatio) || 1; - dpr = dpr >= 1 ? Math.ceil(dpr) : 1; this.dpr = dpr; this.resize(this.canvasConfig.width, this.canvasConfig.height); diff --git a/packages/g-components/CHANGELOG.md b/packages/g-components/CHANGELOG.md index 71287a2d0..13a36966d 100644 --- a/packages/g-components/CHANGELOG.md +++ b/packages/g-components/CHANGELOG.md @@ -1,5 +1,15 @@ # @antv/g-components +## 2.0.26 + +### Patch Changes + +- Updated dependencies [244d6dd] +- Updated dependencies [9ebc16b] +- Updated dependencies [2d71558] +- Updated dependencies [fad9325] + - @antv/g-lite@2.2.10 + ## 2.0.25 ### Patch Changes diff --git a/packages/g-components/package.json b/packages/g-components/package.json index 864b32451..087d9d559 100644 --- a/packages/g-components/package.json +++ b/packages/g-components/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-components", - "version": "2.0.25", + "version": "2.0.26", "description": "Components for g", "keywords": [ "antv", diff --git a/packages/g-dom-mutation-observer-api/CHANGELOG.md b/packages/g-dom-mutation-observer-api/CHANGELOG.md index 8b5f8b381..c5fce20b7 100644 --- a/packages/g-dom-mutation-observer-api/CHANGELOG.md +++ b/packages/g-dom-mutation-observer-api/CHANGELOG.md @@ -1,5 +1,15 @@ # @antv/g-dom-mutation-observer-api +## 2.0.26 + +### Patch Changes + +- Updated dependencies [244d6dd] +- Updated dependencies [9ebc16b] +- Updated dependencies [2d71558] +- Updated dependencies [fad9325] + - @antv/g-lite@2.2.10 + ## 2.0.25 ### Patch Changes diff --git a/packages/g-dom-mutation-observer-api/package.json b/packages/g-dom-mutation-observer-api/package.json index 1212d0eb4..ddcd3a455 100644 --- a/packages/g-dom-mutation-observer-api/package.json +++ b/packages/g-dom-mutation-observer-api/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-dom-mutation-observer-api", - "version": "2.0.25", + "version": "2.0.26", "description": "A simple implementation of DOM MutationObserver API.", "keywords": [ "antv", diff --git a/packages/g-gesture/CHANGELOG.md b/packages/g-gesture/CHANGELOG.md index f46b32706..addf4b3ea 100644 --- a/packages/g-gesture/CHANGELOG.md +++ b/packages/g-gesture/CHANGELOG.md @@ -1,5 +1,15 @@ # @antv/g-gesture +## 3.0.26 + +### Patch Changes + +- Updated dependencies [244d6dd] +- Updated dependencies [9ebc16b] +- Updated dependencies [2d71558] +- Updated dependencies [fad9325] + - @antv/g-lite@2.2.10 + ## 3.0.25 ### Patch Changes diff --git a/packages/g-gesture/package.json b/packages/g-gesture/package.json index 8f0baea59..3df1dc3e6 100644 --- a/packages/g-gesture/package.json +++ b/packages/g-gesture/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-gesture", - "version": "3.0.25", + "version": "3.0.26", "description": "G Gesture", "keywords": [ "antv", diff --git a/packages/g-image-exporter/CHANGELOG.md b/packages/g-image-exporter/CHANGELOG.md index ec539727c..7885de8fc 100644 --- a/packages/g-image-exporter/CHANGELOG.md +++ b/packages/g-image-exporter/CHANGELOG.md @@ -1,5 +1,16 @@ # @antv/g-image-exporter +## 1.0.26 + +### Patch Changes + +- 244d6dd: refactor: reduce global redundant code +- Updated dependencies [244d6dd] +- Updated dependencies [9ebc16b] +- Updated dependencies [2d71558] +- Updated dependencies [fad9325] + - @antv/g-lite@2.2.10 + ## 1.0.25 ### Patch Changes diff --git a/packages/g-image-exporter/package.json b/packages/g-image-exporter/package.json index 637c2c88c..2f025b2f8 100644 --- a/packages/g-image-exporter/package.json +++ b/packages/g-image-exporter/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-image-exporter", - "version": "1.0.25", + "version": "1.0.26", "description": "A image exporter for G using DOM API", "keywords": [ "antv", diff --git a/packages/g-image-exporter/src/ImageExporter.ts b/packages/g-image-exporter/src/ImageExporter.ts index c2291d042..45b0e78ce 100644 --- a/packages/g-image-exporter/src/ImageExporter.ts +++ b/packages/g-image-exporter/src/ImageExporter.ts @@ -188,16 +188,9 @@ export class ImageExporter { } private getOrCreateImage(src: string): Promise { - // @see https://github.com/antvis/g/issues/938 - const { createImage } = this.options.canvas.getConfig(); - return new Promise((resolve, reject) => { - let image: HTMLImageElement; - if (createImage) { - image = createImage(src); - } else if (isBrowser) { - image = new window.Image(); - } + // @see https://github.com/antvis/g/issues/938 + const image = this.options.canvas.getConfig().createImage(); if (image) { image.onload = () => { diff --git a/packages/g-lite/CHANGELOG.md b/packages/g-lite/CHANGELOG.md index e52bba039..8dc79c726 100644 --- a/packages/g-lite/CHANGELOG.md +++ b/packages/g-lite/CHANGELOG.md @@ -1,5 +1,14 @@ # @antv/g-lite +## 2.2.10 + +### Patch Changes + +- 244d6dd: refactor: reduce global redundant code +- 9ebc16b: fix: svg path element A command drawing abnormality +- 2d71558: fix: rendering error when line break appears at the beginning of text +- fad9325: feat: `lineDash` supports more than two parameters + ## 2.2.9 ### Patch Changes diff --git a/packages/g-lite/package.json b/packages/g-lite/package.json index 164168f31..485a420fc 100644 --- a/packages/g-lite/package.json +++ b/packages/g-lite/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-lite", - "version": "2.2.9", + "version": "2.2.10", "description": "A core module for rendering engine implements DOM API.", "keywords": [ "antv", diff --git a/packages/g-lite/src/Canvas.ts b/packages/g-lite/src/Canvas.ts index a9129568f..29db657cf 100644 --- a/packages/g-lite/src/Canvas.ts +++ b/packages/g-lite/src/Canvas.ts @@ -82,61 +82,30 @@ const afterRenderEvent = new CustomEvent(CanvasEvent.AFTER_RENDER); * * `window.devicePixelRatio` * * prototype chains: Canvas(Window) -> EventTarget + * + * @docs https://g.antv.antgroup.com/api/canvas/intro */ export class Canvas extends EventTarget implements ICanvas { + // #region environment + customElements: ICanvas['customElements']; + devicePixelRatio: ICanvas['devicePixelRatio']; + requestAnimationFrame: ICanvas['requestAnimationFrame']; + cancelAnimationFrame: ICanvas['cancelAnimationFrame']; + supportsTouchEvents: ICanvas['supportsTouchEvents']; + supportsPointerEvents: ICanvas['supportsPointerEvents']; + isTouchEvent: ICanvas['isTouchEvent']; + isMouseEvent: ICanvas['isMouseEvent']; + /** * window.document */ document: Document; - /** - * @see https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry - */ - customElements: CustomElementRegistry; - - /** - * @see https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame - */ - requestAnimationFrame: (callback: FrameRequestCallback) => number; - - /** - * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/cancelAnimationFrame - */ - cancelAnimationFrame: (handle: number) => void; - - /** - * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio - */ - devicePixelRatio: number; - - /** - * whether the runtime supports PointerEvent? - * if not, the event system won't trigger pointer events like `pointerdown` - */ - supportsPointerEvents: boolean; - - /** - * whether the runtime supports TouchEvent? - * if not, the event system won't trigger touch events like `touchstart` - */ - supportsTouchEvents: boolean; - - /** - * is this native event a TouchEvent? - */ - isTouchEvent: (event: InteractivePointerEvent) => event is TouchEvent; - - /** - * is this native event a MouseEvent? - */ - isMouseEvent: (event: InteractivePointerEvent) => event is MouseEvent; - - dblClickSpeed?: CanvasConfig['dblClickSpeed']; - /** * @see https://developer.mozilla.org/en-US/docs/Web/API/Element */ Element = DisplayObject; + // #endregion environment /** * rAF in auto rendering @@ -152,73 +121,48 @@ export class Canvas extends EventTarget implements ICanvas { constructor(config: CanvasConfig) { super(); - // create document - this.document = new Document(); - this.document.defaultView = this; - - // create registry of custom elements - this.customElements = new CustomElementRegistry(); - const { container, canvas, - offscreenCanvas, + renderer, width, height, - devicePixelRatio, - renderer, background, cursor, - document, + supportsMutipleCanvasesInOneContainer, + cleanUpOnDestroy = true, + offscreenCanvas, + devicePixelRatio, requestAnimationFrame, cancelAnimationFrame, createImage, - enableLargeImageOptimization, - supportsPointerEvents, supportsTouchEvents, - supportsCSSTransform, - cleanUpOnDestroy = true, - supportsMutipleCanvasesInOneContainer, - useNativeClickEvent, - alwaysTriggerPointerEventOnCanvas, + supportsPointerEvents, isTouchEvent, isMouseEvent, dblClickSpeed, } = config; - - if (!supportsMutipleCanvasesInOneContainer) { - cleanExistedCanvas(container, this, cleanUpOnDestroy); - } - let canvasWidth = width; let canvasHeight = height; - let dpr = devicePixelRatio; + let dpr = devicePixelRatio || (isBrowser && window.devicePixelRatio) || 1; + dpr = dpr >= 1 ? Math.ceil(dpr) : 1; + // use user-defined or OffscreenCanvas if (canvas) { // infer width & height with dpr - dpr = devicePixelRatio || (isBrowser && window.devicePixelRatio) || 1; - dpr = dpr >= 1 ? Math.ceil(dpr) : 1; canvasWidth = width || getWidth(canvas) || canvas.width / dpr; canvasHeight = height || getHeight(canvas) || canvas.height / dpr; } - // override it in runtime - if (offscreenCanvas) { - runtime.offscreenCanvas = offscreenCanvas; - } - /** * implements `Window` interface */ + this.customElements = new CustomElementRegistry(); this.devicePixelRatio = dpr; this.requestAnimationFrame = - requestAnimationFrame ?? raf.bind(runtime.globalThis); + requestAnimationFrame ?? (raf.bind(runtime.globalThis) as typeof raf); this.cancelAnimationFrame = - cancelAnimationFrame ?? caf.bind(runtime.globalThis); - - /** - * limits query - */ + cancelAnimationFrame ?? (caf.bind(runtime.globalThis) as typeof caf); // the following feature-detect from hammer.js // @see https://github.com/hammerjs/hammer.js/blob/master/src/inputjs/input-consts.js#L5 this.supportsTouchEvents = @@ -238,25 +182,35 @@ export class Canvas extends EventTarget implements ICanvas { (!this.supportsPointerEvents || !(event instanceof runtime.globalThis.PointerEvent)))); - this.dblClickSpeed = dblClickSpeed ?? 200; + // override it in runtime + if (offscreenCanvas) { + runtime.offscreenCanvas = offscreenCanvas; + } + + // create document + this.document = new Document(); + this.document.defaultView = this; + + if (!supportsMutipleCanvasesInOneContainer) { + cleanExistedCanvas(container, this, cleanUpOnDestroy); + } this.initRenderingContext({ - container, - canvas, + ...config, width: canvasWidth, height: canvasHeight, - renderer, - offscreenCanvas, - devicePixelRatio: dpr, - cursor: cursor || ('default' as Cursor), - background: background || 'transparent', - createImage, - enableLargeImageOptimization, - document, - supportsCSSTransform, - useNativeClickEvent, + background: background ?? 'transparent', + cursor: cursor ?? ('default' as Cursor), cleanUpOnDestroy, - alwaysTriggerPointerEventOnCanvas, + devicePixelRatio: dpr, + requestAnimationFrame: this.requestAnimationFrame, + cancelAnimationFrame: this.cancelAnimationFrame, + supportsTouchEvents: this.supportsTouchEvents, + supportsPointerEvents: this.supportsPointerEvents, + isTouchEvent: this.isTouchEvent, + isMouseEvent: this.isMouseEvent, + dblClickSpeed: dblClickSpeed ?? 200, + createImage: createImage ?? (() => new window.Image()), }); this.initDefaultCamera(canvasWidth, canvasHeight, renderer.clipSpaceNearZ); @@ -516,6 +470,7 @@ export class Canvas extends EventTarget implements ICanvas { } render(frame?: XRFrame) { + // console.log('render ----------------------'); if (frame) { beforeRenderEvent.detail = frame; afterRenderEvent.detail = frame; @@ -582,9 +537,14 @@ export class Canvas extends EventTarget implements ICanvas { this.context.contextService.init(); this.initRenderingService(renderer, firstContentfullPaint, true); } else { - this.context.contextService.initAsync().then(() => { - this.initRenderingService(renderer, firstContentfullPaint); - }); + this.context.contextService + .initAsync() + .then(() => { + this.initRenderingService(renderer, firstContentfullPaint); + }) + .catch((err) => { + console.error(err); + }); } } diff --git a/packages/g-lite/src/css/StyleValueRegistry.ts b/packages/g-lite/src/css/StyleValueRegistry.ts index 37a722aa2..19ab25c99 100644 --- a/packages/g-lite/src/css/StyleValueRegistry.ts +++ b/packages/g-lite/src/css/StyleValueRegistry.ts @@ -698,9 +698,10 @@ export class DefaultStyleValueRegistry implements StyleValueRegistry { } // Polyline if (list.has('lineDash') && !isNil(attributes.lineDash)) { + // dom标准自动转化奇数长度数组,webgl需要手动处理 object.parsedStyle.lineDash = parseDimensionArrayFormat( attributes.lineDash, - 2, + 'even', ); } // @ts-ignore diff --git a/packages/g-lite/src/css/parser/dimension.ts b/packages/g-lite/src/css/parser/dimension.ts index 57105474c..69ee69e70 100644 --- a/packages/g-lite/src/css/parser/dimension.ts +++ b/packages/g-lite/src/css/parser/dimension.ts @@ -166,7 +166,7 @@ export function convertAngleUnit(value: CSSUnitValue) { export function parseDimensionArrayFormat( string: string | number | (string | number)[], - size: number, + size?: 2 | 4 | 'even', ): number[] { let parsed: number[]; @@ -185,16 +185,22 @@ export function parseDimensionArrayFormat( } return [parsed[0], parsed[1]]; } - if (parsed.length === 1) { - return [parsed[0], parsed[0], parsed[0], parsed[0]]; - } - if (parsed.length === 2) { - return [parsed[0], parsed[1], parsed[0], parsed[1]]; + if (size === 4) { + if (parsed.length === 1) { + return [parsed[0], parsed[0], parsed[0], parsed[0]]; + } + if (parsed.length === 2) { + return [parsed[0], parsed[1], parsed[0], parsed[1]]; + } + if (parsed.length === 3) { + return [parsed[0], parsed[1], parsed[2], parsed[1]]; + } + return [parsed[0], parsed[1], parsed[2], parsed[3]]; } - if (parsed.length === 3) { - return [parsed[0], parsed[1], parsed[2], parsed[1]]; + if (size === 'even' && parsed.length % 2 === 1) { + return [...parsed, ...parsed]; } - return [parsed[0], parsed[1], parsed[2], parsed[3]]; + return parsed; } export function parseDimensionArray( diff --git a/packages/g-lite/src/dom/Node.ts b/packages/g-lite/src/dom/Node.ts index fa552b1d6..737285b52 100644 --- a/packages/g-lite/src/dom/Node.ts +++ b/packages/g-lite/src/dom/Node.ts @@ -358,10 +358,6 @@ export abstract class Node extends EventTarget implements INode { return temp; } - /** - * iterate current node and its descendants - * @param callback - callback to execute for each node, return false to break - */ forEach(callback: (o: INode) => void | boolean) { const stack: INode[] = [this]; diff --git a/packages/g-lite/src/dom/interfaces.ts b/packages/g-lite/src/dom/interfaces.ts index fa6a2af38..0cdebd5e2 100644 --- a/packages/g-lite/src/dom/interfaces.ts +++ b/packages/g-lite/src/dom/interfaces.ts @@ -30,10 +30,7 @@ import type { FederatedEvent } from './FederatedEvent'; * @see https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver */ export enum ElementEvent { - REPARENT = 'reparent', - - DESTROY = 'destroy', - + // --- @see https://developer.mozilla.org/en-US/docs/Web/API/MutationEvent /** * @see https://www.w3.org/TR/DOM-Level-3-Events/#event-type-DOMAttrModified */ @@ -46,26 +43,32 @@ export enum ElementEvent { INSERTED = 'DOMNodeInserted', /** - * it is being removed - * @see https://www.w3.org/TR/DOM-Level-3-Events/#event-type-DOMNodeRemoved + * @see https://www.w3.org/TR/DOM-Level-3-Events/#domnodeinsertedintodocument */ - REMOVED = 'removed', + MOUNTED = 'DOMNodeInsertedIntoDocument', /** - * @see https://www.w3.org/TR/DOM-Level-3-Events/#domnodeinsertedintodocument + * it is being removed + * @see https://www.w3.org/TR/DOM-Level-3-Events/#event-type-DOMNodeRemoved */ - MOUNTED = 'DOMNodeInsertedIntoDocument', + REMOVED = 'removed', /** * @see https://www.w3.org/TR/DOM-Level-3-Events/#domnoderemovedfromdocument */ UNMOUNTED = 'DOMNodeRemovedFromDocument', + // --- + + REPARENT = 'reparent', + + DESTROY = 'destroy', BOUNDS_CHANGED = 'bounds-changed', CULLED = 'culled', } +// #region EventTarget export interface IEventTarget { emitter: EventEmitter; @@ -92,14 +95,33 @@ export interface IEventTarget { ) => void; // removeAllEventListeners: () => void; + /** + * @param skipPropagate - The default value is `false`. If true, the event is only triggered globally (note that the global is not the object itself), skipping the event propagation process. In addition, if the object has been removed from the global, the event is only triggered on the object itself. + * @param dispatchToSelf - The default value is `false`. If true, the event will be triggered on the object itself. + * + * @see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/dispatchEvent + */ dispatchEvent: ( e: T, skipPropagate?: boolean, + dispatchToSelf?: boolean, ) => boolean; // emit: (eventName: string, object: object) => void; } +interface EventListener { + (evt: FederatedEvent): void; +} +interface EventListenerObject { + handleEvent(object: FederatedEvent): void; +} + +export type EventListenerOrEventListenerObject = + | EventListener + | EventListenerObject; + +// #region Node export interface INode extends IEventTarget { shadow: boolean; /** @@ -175,7 +197,8 @@ export interface INode extends IEventTarget { */ getAncestor: (n: number) => INode | null; /** - * Traverse in sub tree. + * iterate current node and its descendants + * @param callback - callback to execute for each node, return false to break */ forEach: (callback: (o: INode) => void | boolean) => void; /** @@ -327,6 +350,7 @@ export interface DisplayObjectConfig { interactive?: boolean; } +// #region Element export interface IElement extends INode, IChildNode, @@ -405,6 +429,7 @@ export interface IElement hasAttribute: (qualifiedName: string) => boolean; } +// #region AnimationTimeline export interface IAnimationTimeline { currentTime: number | null; destroy: () => void; @@ -474,6 +499,7 @@ export interface IKeyframeEffect { updateTiming: (timing?: OptionalEffectTiming) => void; } +// #region Document export interface IDocument extends INode, IParentNode { /** * Returns the Window object of the active document. @@ -509,6 +535,7 @@ export interface IDocument extends INode, IParentNode { ) => DisplayObject[]; } +// #region CSSStyleDeclaration /** * @see https://developer.mozilla.org/zh-CN/docs/Web/API/CSSStyleDeclaration */ @@ -526,7 +553,7 @@ export interface ICSSStyleDeclaration { } export interface CanvasContext { - config: Partial; + config: CanvasConfig; camera: ICamera; /** @@ -544,49 +571,57 @@ export interface CanvasContext { renderingPlugins: RenderingPlugin[]; } -export interface ICanvas extends IEventTarget { - document: IDocument; +// #region Canvas +export interface IWindow { + /** https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry */ customElements: CustomElementRegistry; - + /** https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio */ devicePixelRatio: number; - requestAnimationFrame: (callback: FrameRequestCallback) => number; - cancelAnimationFrame: (handle: number) => void; - + /** https://developer.mozilla.org/en-US/docs/Web/API/DedicatedWorkerGlobalScope/requestAnimationFrame */ + requestAnimationFrame: typeof requestAnimationFrame; + /** https://developer.mozilla.org/en-US/docs/Web/API/DedicatedWorkerGlobalScope/cancelAnimationFrame */ + cancelAnimationFrame: typeof cancelAnimationFrame; + /** + * whether the runtime supports TouchEvent? + * if not, the event system won't trigger touch events like `touchstart` + */ supportsTouchEvents: boolean; + /** + * whether the runtime supports PointerEvent? + * if not, the event system won't trigger pointer events like `pointerdown` + */ supportsPointerEvents: boolean; + /** + * is this native event a TouchEvent? + */ + isTouchEvent: (event: InteractivePointerEvent) => event is TouchEvent; + /** + * is this native event a MouseEvent? + */ isMouseEvent: (event: InteractivePointerEvent) => event is MouseEvent; - dblClickSpeed?: number; - - render: () => void; - destroy: (destroyScenegraph?: boolean) => void; - resize: (width: number, height: number) => void; +} +export interface ICanvas extends IWindow, IEventTarget { + document: IDocument; context: CanvasContext; - mountChildren: (parent: INode) => void; - unmountChildren: (parent: INode) => void; - mountFragment: (fragment: INode) => void; - getConfig: () => Partial; getCamera: () => ICamera; getContextService: () => ContextService; getRenderingService: () => RenderingService; getEventService: () => EventService; + mountChildren: (parent: INode) => void; + unmountChildren: (parent: INode) => void; + mountFragment: (fragment: INode) => void; + client2Viewport: (client: PointLike) => PointLike; viewport2Client: (viewport: PointLike) => PointLike; canvas2Viewport: (canvas: PointLike) => PointLike; viewport2Canvas: (viewport: PointLike) => PointLike; -} -interface EventListener { - (evt: FederatedEvent): void; -} -interface EventListenerObject { - handleEvent(object: FederatedEvent): void; + render: () => void; + destroy: (destroyScenegraph?: boolean) => void; + resize: (width: number, height: number) => void; } - -export type EventListenerOrEventListenerObject = - | EventListener - | EventListenerObject; diff --git a/packages/g-lite/src/services/EventService.ts b/packages/g-lite/src/services/EventService.ts index 997f83ce6..4ea6b6597 100644 --- a/packages/g-lite/src/services/EventService.ts +++ b/packages/g-lite/src/services/EventService.ts @@ -1,4 +1,3 @@ -import EventEmitter from 'eventemitter3'; import { mat4, vec3 } from 'gl-matrix'; import type { CanvasContext, GlobalRuntime, InteractivePointerEvent } from '..'; import type { HTML } from '../display-objects'; @@ -47,8 +46,6 @@ export class EventService { private rootTarget: IEventTarget; - private emitter = new EventEmitter(); - /** * Store HTML elements in current canvas. */ @@ -88,7 +85,6 @@ export class EventService { } destroy() { - this.emitter.removeAllListeners(); this.mappingTable = {}; this.mappingState = {}; this.eventPool.clear(); @@ -317,7 +313,7 @@ export class EventService { if ( clickHistory.target === clickEvent.target && - now - clickHistory.timeStamp < canvas.dblClickSpeed + now - clickHistory.timeStamp < canvas.getConfig().dblClickSpeed ) { ++clickHistory.clickCount; } else { @@ -650,8 +646,6 @@ export class EventService { e.currentTarget = canvas; this.notifyListeners(e, type); } - - this.emitter.emit(type || e.type, e); } propagate(e: FederatedEvent, type?: string) { diff --git a/packages/g-lite/src/services/TextService.ts b/packages/g-lite/src/services/TextService.ts index 52320f7de..bbc5dcd27 100644 --- a/packages/g-lite/src/services/TextService.ts +++ b/packages/g-lite/src/services/TextService.ts @@ -380,7 +380,7 @@ export class TextService { } // Backspace from line's end. - const currentLineLength = lines[lineIndex].length; + const currentLineLength = lines[lineIndex] ? lines[lineIndex].length : 0; let lastLineWidth = 0; let lastLineIndex = currentLineLength; for (let i = 0; i < currentLineLength; i++) { diff --git a/packages/g-lite/src/types.ts b/packages/g-lite/src/types.ts index 272102795..b3d82726e 100644 --- a/packages/g-lite/src/types.ts +++ b/packages/g-lite/src/types.ts @@ -11,6 +11,7 @@ import type { Pattern, } from './css/parser'; import type { DisplayObject } from './display-objects'; +import type { IWindow } from './dom/interfaces'; export enum Shape { GROUP = 'g', @@ -488,47 +489,46 @@ export interface CanvasLike extends EventTarget { ) => void); } -export interface CanvasConfig { +export interface CanvasConfig extends Partial> { /** - * Renderer - */ - renderer: IRenderer; - - /** - * document.getElementById(container); + * When the renderer is initialized, a `/` element is automatically + * created inside the container DOM element. */ container?: string | HTMLElement; - /** - * support OffscreenCanvas + * When this parameter is passed, the `container` parameter will be ignored. + * + * - support OffscreenCanvas */ canvas?: CanvasLike; - /** - * used in JSDOM + * Renderer + * + * @see https://g.antv.antgroup.com/api/renderer/intro */ - document?: Document; + renderer: IRenderer; /** - * used in text measurement & texture generation + * 画布宽度 */ - offscreenCanvas?: CanvasLike; - + width?: number; /** - * window.devicePixelRatio + * 画布高度 */ - devicePixelRatio?: number; - + height?: number; /** - * rAF + * 画布背景色 */ - requestAnimationFrame?: (callback: FrameRequestCallback) => number; - cancelAnimationFrame?: (id: number) => void; + background?: ColorType; + /** + * cursor style + */ + cursor?: Cursor; /** - * replace `new window.Image()` + * One container can have multiple canvases inside. */ - createImage?: (src: string) => HTMLImageElement; + supportsMutipleCanvasesInOneContainer?: boolean; /** * Optimize rendering performance for high-resolution large images */ @@ -550,20 +550,6 @@ export interface CanvasConfig { maxDownSampledImageSize?: number; }; - /** - * limits query - */ - supportsPointerEvents?: boolean; - // supportMouseEvent?: () => boolean; - supportsTouchEvents?: boolean; - isTouchEvent?: (event: InteractivePointerEvent) => event is TouchEvent; - isMouseEvent?: (event: InteractivePointerEvent) => event is MouseEvent; - - /** - * double click speed (ms), default is 200ms - */ - dblClickSpeed?: number; - /** * Listen to native click event instead of mocking with pointerup & down events. */ @@ -584,42 +570,29 @@ export interface CanvasConfig { */ disableRenderHooks?: boolean; - /** - * Should we account for CSS Transform applied on container? Enabled by default. - * @deprecated - */ - supportsCSSTransform?: boolean; - - /** - * One container can have multiple canvases inside. - */ - supportsMutipleCanvasesInOneContainer?: boolean; - /** * 销毁画布时是否执行清理操作 */ cleanUpOnDestroy?: boolean; /** - * 画布宽度 + * used in JSDOM */ - width?: number; + document?: Document; /** - * 画布高度 + * used in text measurement & texture generation */ - height?: number; - + offscreenCanvas?: CanvasLike; /** - * 画布背景色 + * replace `new window.Image()` */ - background?: ColorType; - + createImage?: () => HTMLImageElement; /** - * 画布的 cursor 样式 + * double click speed (ms) + * + * - default is 200ms */ - cursor?: Cursor; - - [key: string]: any; + dblClickSpeed?: number; } /** diff --git a/packages/g-lite/src/utils/path.ts b/packages/g-lite/src/utils/path.ts index e5df1195d..8b09162ce 100644 --- a/packages/g-lite/src/utils/path.ts +++ b/packages/g-lite/src/utils/path.ts @@ -982,7 +982,11 @@ export function translatePathToString( return `C ${params[1]} ${params[2]},${params[3]} ${params[4]},${params[5] + endOffsetXTemp} ${params[6] + endOffsetYTemp}`; case 'A': - return `A ${params[1]} ${params[2]} ${params[3]} ${params[4]} ${params[5]} ${params[6] + endOffsetXTemp} ${params[7] + endOffsetYTemp}`; + return `A ${params[1]} ${params[2]} ${params[3]} ${params[4]} ${params[5]} ${params[6]} ${params[7]}${ + useEndOffset + ? ` L ${params[6] + endOffsetX},${params[7] + endOffsetY}` + : '' + }`; case 'Z': return 'Z'; diff --git a/packages/g-lite/src/utils/raf.ts b/packages/g-lite/src/utils/raf.ts index 01dc43e2b..d225b9c74 100644 --- a/packages/g-lite/src/utils/raf.ts +++ b/packages/g-lite/src/utils/raf.ts @@ -73,18 +73,17 @@ const polyfillCaf = (id: number) => { const vendorPrefixes = ['', 'webkit', 'moz', 'ms', 'o']; -type TRequestAnimationFrame = (callback: (...args: any[]) => any) => number; -type TCancelAnimationFrame = (id: number) => void; - const getRequestAnimationFrame = ( vp: string | void, -): TRequestAnimationFrame => { +): typeof requestAnimationFrame => { if (typeof vp !== 'string') return polyfillRaf; if (vp === '') return root.requestAnimationFrame; return root[`${vp}RequestAnimationFrame`]; }; -const getCancelAnimationFrame = (vp: string | void): TCancelAnimationFrame => { +const getCancelAnimationFrame = ( + vp: string | void, +): typeof cancelAnimationFrame => { if (typeof vp !== 'string') return polyfillCaf; if (vp === '') return root.cancelAnimationFrame; return ( @@ -104,8 +103,8 @@ const find = (arr: any[], predicate: (...args: any[]) => any) => { const vp = find(vendorPrefixes, (vp: string) => !!getRequestAnimationFrame(vp)); -export const raf: TRequestAnimationFrame = getRequestAnimationFrame(vp); -export const caf: TCancelAnimationFrame = getCancelAnimationFrame(vp); +export const raf = getRequestAnimationFrame(vp); +export const caf = getCancelAnimationFrame(vp); root.requestAnimationFrame = raf; root.cancelAnimationFrame = caf; diff --git a/packages/g-lottie-player/CHANGELOG.md b/packages/g-lottie-player/CHANGELOG.md index b43034133..070ebddaf 100644 --- a/packages/g-lottie-player/CHANGELOG.md +++ b/packages/g-lottie-player/CHANGELOG.md @@ -1,5 +1,15 @@ # @antv/g-lottie-player +## 1.0.26 + +### Patch Changes + +- Updated dependencies [244d6dd] +- Updated dependencies [9ebc16b] +- Updated dependencies [2d71558] +- Updated dependencies [fad9325] + - @antv/g-lite@2.2.10 + ## 1.0.25 ### Patch Changes diff --git a/packages/g-lottie-player/package.json b/packages/g-lottie-player/package.json index d406e59be..516410514 100644 --- a/packages/g-lottie-player/package.json +++ b/packages/g-lottie-player/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-lottie-player", - "version": "1.0.25", + "version": "1.0.26", "description": "A lottie player for G", "keywords": [ "antv", diff --git a/packages/g-mobile-canvas-element/CHANGELOG.md b/packages/g-mobile-canvas-element/CHANGELOG.md index 649bd3a41..7930c76ce 100644 --- a/packages/g-mobile-canvas-element/CHANGELOG.md +++ b/packages/g-mobile-canvas-element/CHANGELOG.md @@ -1,5 +1,15 @@ # @antv/g-mobile-canvas-element +## 1.0.26 + +### Patch Changes + +- Updated dependencies [244d6dd] +- Updated dependencies [9ebc16b] +- Updated dependencies [2d71558] +- Updated dependencies [fad9325] + - @antv/g-lite@2.2.10 + ## 1.0.25 ### Patch Changes diff --git a/packages/g-mobile-canvas-element/package.json b/packages/g-mobile-canvas-element/package.json index 89acafbff..c68a48fcc 100644 --- a/packages/g-mobile-canvas-element/package.json +++ b/packages/g-mobile-canvas-element/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-mobile-canvas-element", - "version": "1.0.25", + "version": "1.0.26", "description": "Create a CanvasLike element from existed context in mobile environment", "keywords": [ "antv", diff --git a/packages/g-mobile-canvas/CHANGELOG.md b/packages/g-mobile-canvas/CHANGELOG.md index 0c56782b2..fe91ee1c2 100644 --- a/packages/g-mobile-canvas/CHANGELOG.md +++ b/packages/g-mobile-canvas/CHANGELOG.md @@ -1,5 +1,22 @@ # @antv/g-mobile-canvas +## 1.0.30 + +### Patch Changes + +- Updated dependencies [244d6dd] +- Updated dependencies [9ebc16b] +- Updated dependencies [2d71558] +- Updated dependencies [fad9325] + - @antv/g-plugin-image-loader@2.1.12 + - @antv/g-lite@2.2.10 + - @antv/g-plugin-canvas-renderer@2.2.12 + - @antv/g-plugin-canvas-path-generator@2.1.10 + - @antv/g-plugin-canvas-picker@2.1.12 + - @antv/g-plugin-dragndrop@2.0.26 + - @antv/g-plugin-gesture@2.0.26 + - @antv/g-plugin-mobile-interaction@1.0.26 + ## 1.0.29 ### Patch Changes diff --git a/packages/g-mobile-canvas/package.json b/packages/g-mobile-canvas/package.json index dca4db0e5..35e3721a0 100644 --- a/packages/g-mobile-canvas/package.json +++ b/packages/g-mobile-canvas/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-mobile-canvas", - "version": "1.0.29", + "version": "1.0.30", "description": "A renderer implemented with Canvas2D API in mobile environment", "keywords": [ "antv", diff --git a/packages/g-mobile-svg/CHANGELOG.md b/packages/g-mobile-svg/CHANGELOG.md index f53656b43..ab2aceb77 100644 --- a/packages/g-mobile-svg/CHANGELOG.md +++ b/packages/g-mobile-svg/CHANGELOG.md @@ -1,5 +1,21 @@ # @antv/g-mobile-svg +## 1.0.28 + +### Patch Changes + +- 244d6dd: refactor: reduce global redundant code +- Updated dependencies [244d6dd] +- Updated dependencies [9ebc16b] +- Updated dependencies [2d71558] +- Updated dependencies [fad9325] + - @antv/g-plugin-svg-renderer@2.2.10 + - @antv/g-lite@2.2.10 + - @antv/g-plugin-svg-picker@2.0.28 + - @antv/g-plugin-dragndrop@2.0.26 + - @antv/g-plugin-gesture@2.0.26 + - @antv/g-plugin-mobile-interaction@1.0.26 + ## 1.0.27 ### Patch Changes diff --git a/packages/g-mobile-svg/package.json b/packages/g-mobile-svg/package.json index 66d76e9cd..7c3b7bcee 100644 --- a/packages/g-mobile-svg/package.json +++ b/packages/g-mobile-svg/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-mobile-svg", - "version": "1.0.27", + "version": "1.0.28", "description": "A renderer implemented by SVG in mobile environment", "keywords": [ "antv", diff --git a/packages/g-mobile-svg/src/SVGContextService.ts b/packages/g-mobile-svg/src/SVGContextService.ts index 6e2b0934d..d7bd97413 100644 --- a/packages/g-mobile-svg/src/SVGContextService.ts +++ b/packages/g-mobile-svg/src/SVGContextService.ts @@ -19,8 +19,12 @@ export class SVGContextService implements ContextService { this.canvasConfig = context.config; } - async init() { - const { container, document: doc } = this.canvasConfig; + init() { + const { + container, + document: doc, + devicePixelRatio: dpr, + } = this.canvasConfig; // create container this.$container = isString(container) @@ -39,8 +43,6 @@ export class SVGContextService implements ContextService { this.$namespace = $namespace; } - let dpr = window.devicePixelRatio || 1; - dpr = dpr >= 1 ? Math.ceil(dpr) : 1; this.dpr = dpr; } diff --git a/packages/g-mobile-webgl/CHANGELOG.md b/packages/g-mobile-webgl/CHANGELOG.md index 2cd1189f0..ee4bcb99c 100644 --- a/packages/g-mobile-webgl/CHANGELOG.md +++ b/packages/g-mobile-webgl/CHANGELOG.md @@ -1,5 +1,21 @@ # @antv/g-mobile-webgl +## 1.0.37 + +### Patch Changes + +- Updated dependencies [244d6dd] +- Updated dependencies [9ebc16b] +- Updated dependencies [2d71558] +- Updated dependencies [fad9325] + - @antv/g-plugin-device-renderer@2.2.12 + - @antv/g-plugin-image-loader@2.1.12 + - @antv/g-lite@2.2.10 + - @antv/g-plugin-dragndrop@2.0.26 + - @antv/g-plugin-gesture@2.0.26 + - @antv/g-plugin-html-renderer@2.1.15 + - @antv/g-plugin-mobile-interaction@1.0.26 + ## 1.0.36 ### Patch Changes diff --git a/packages/g-mobile-webgl/package.json b/packages/g-mobile-webgl/package.json index a6e108b1d..2d5b74ea7 100644 --- a/packages/g-mobile-webgl/package.json +++ b/packages/g-mobile-webgl/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-mobile-webgl", - "version": "1.0.36", + "version": "1.0.37", "description": "A renderer implemented by WebGL1/2 in mobile environment", "keywords": [ "antv", diff --git a/packages/g-pattern/CHANGELOG.md b/packages/g-pattern/CHANGELOG.md index d4799aa43..165f11d80 100644 --- a/packages/g-pattern/CHANGELOG.md +++ b/packages/g-pattern/CHANGELOG.md @@ -1,5 +1,15 @@ # @antv/g-pattern +## 2.0.26 + +### Patch Changes + +- Updated dependencies [244d6dd] +- Updated dependencies [9ebc16b] +- Updated dependencies [2d71558] +- Updated dependencies [fad9325] + - @antv/g-lite@2.2.10 + ## 2.0.25 ### Patch Changes diff --git a/packages/g-pattern/package.json b/packages/g-pattern/package.json index fbf72840e..14a728ee8 100644 --- a/packages/g-pattern/package.json +++ b/packages/g-pattern/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-pattern", - "version": "2.0.25", + "version": "2.0.26", "description": "A pattern libs for G", "keywords": [ "antv", diff --git a/packages/g-plugin-3d/CHANGELOG.md b/packages/g-plugin-3d/CHANGELOG.md index 7fdbc559b..e4a38cdc3 100644 --- a/packages/g-plugin-3d/CHANGELOG.md +++ b/packages/g-plugin-3d/CHANGELOG.md @@ -1,5 +1,16 @@ # @antv/g-plugin-3d +## 2.0.35 + +### Patch Changes + +- Updated dependencies [244d6dd] +- Updated dependencies [9ebc16b] +- Updated dependencies [2d71558] +- Updated dependencies [fad9325] + - @antv/g-plugin-device-renderer@2.2.12 + - @antv/g-lite@2.2.10 + ## 2.0.34 ### Patch Changes diff --git a/packages/g-plugin-3d/package.json b/packages/g-plugin-3d/package.json index eeb3230d2..8d03da37d 100644 --- a/packages/g-plugin-3d/package.json +++ b/packages/g-plugin-3d/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-plugin-3d", - "version": "2.0.34", + "version": "2.0.35", "description": "Provide 3D extension for G", "keywords": [ "antv", diff --git a/packages/g-plugin-a11y/CHANGELOG.md b/packages/g-plugin-a11y/CHANGELOG.md index 5ff9fdf94..061dd312c 100644 --- a/packages/g-plugin-a11y/CHANGELOG.md +++ b/packages/g-plugin-a11y/CHANGELOG.md @@ -1,5 +1,15 @@ # @antv/g-plugin-a11y +## 1.1.15 + +### Patch Changes + +- Updated dependencies [244d6dd] +- Updated dependencies [9ebc16b] +- Updated dependencies [2d71558] +- Updated dependencies [fad9325] + - @antv/g-lite@2.2.10 + ## 1.1.14 ### Patch Changes diff --git a/packages/g-plugin-a11y/package.json b/packages/g-plugin-a11y/package.json index 9e8aca2a0..c7d7e8079 100644 --- a/packages/g-plugin-a11y/package.json +++ b/packages/g-plugin-a11y/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-plugin-a11y", - "version": "1.1.14", + "version": "1.1.15", "description": "A G plugin for accessibility", "keywords": [ "antv", diff --git a/packages/g-plugin-annotation/CHANGELOG.md b/packages/g-plugin-annotation/CHANGELOG.md index 3440e204e..cb435acc1 100644 --- a/packages/g-plugin-annotation/CHANGELOG.md +++ b/packages/g-plugin-annotation/CHANGELOG.md @@ -1,5 +1,15 @@ # @antv/g-plugin-annotation +## 1.0.26 + +### Patch Changes + +- Updated dependencies [244d6dd] +- Updated dependencies [9ebc16b] +- Updated dependencies [2d71558] +- Updated dependencies [fad9325] + - @antv/g-lite@2.2.10 + ## 1.0.25 ### Patch Changes diff --git a/packages/g-plugin-annotation/package.json b/packages/g-plugin-annotation/package.json index 9025cc96a..e8a9ae6d7 100644 --- a/packages/g-plugin-annotation/package.json +++ b/packages/g-plugin-annotation/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-plugin-annotation", - "version": "1.0.25", + "version": "1.0.26", "description": "A G plugin for annotation", "keywords": [ "antv", diff --git a/packages/g-plugin-box2d/CHANGELOG.md b/packages/g-plugin-box2d/CHANGELOG.md index 87284f654..487b3dbf1 100644 --- a/packages/g-plugin-box2d/CHANGELOG.md +++ b/packages/g-plugin-box2d/CHANGELOG.md @@ -1,5 +1,15 @@ # @antv/g-plugin-box2d +## 2.0.26 + +### Patch Changes + +- Updated dependencies [244d6dd] +- Updated dependencies [9ebc16b] +- Updated dependencies [2d71558] +- Updated dependencies [fad9325] + - @antv/g-lite@2.2.10 + ## 2.0.25 ### Patch Changes diff --git a/packages/g-plugin-box2d/package.json b/packages/g-plugin-box2d/package.json index 077bb4056..c7bf01fcb 100644 --- a/packages/g-plugin-box2d/package.json +++ b/packages/g-plugin-box2d/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-plugin-box2d", - "version": "2.0.25", + "version": "2.0.26", "description": "A G plugin for Box2D", "keywords": [ "antv", diff --git a/packages/g-plugin-canvas-path-generator/CHANGELOG.md b/packages/g-plugin-canvas-path-generator/CHANGELOG.md index b75e3cc6f..9c94be589 100644 --- a/packages/g-plugin-canvas-path-generator/CHANGELOG.md +++ b/packages/g-plugin-canvas-path-generator/CHANGELOG.md @@ -1,5 +1,15 @@ # @antv/g-plugin-canvas-path-generator +## 2.1.10 + +### Patch Changes + +- Updated dependencies [244d6dd] +- Updated dependencies [9ebc16b] +- Updated dependencies [2d71558] +- Updated dependencies [fad9325] + - @antv/g-lite@2.2.10 + ## 2.1.9 ### Patch Changes diff --git a/packages/g-plugin-canvas-path-generator/package.json b/packages/g-plugin-canvas-path-generator/package.json index ce68704ec..842b24328 100644 --- a/packages/g-plugin-canvas-path-generator/package.json +++ b/packages/g-plugin-canvas-path-generator/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-plugin-canvas-path-generator", - "version": "2.1.9", + "version": "2.1.10", "description": "A G plugin of path generator with Canvas2D API", "keywords": [ "antv", diff --git a/packages/g-plugin-canvas-picker/CHANGELOG.md b/packages/g-plugin-canvas-picker/CHANGELOG.md index 153e56902..433c2a436 100644 --- a/packages/g-plugin-canvas-picker/CHANGELOG.md +++ b/packages/g-plugin-canvas-picker/CHANGELOG.md @@ -1,5 +1,17 @@ # @antv/g-plugin-canvas-picker +## 2.1.12 + +### Patch Changes + +- Updated dependencies [244d6dd] +- Updated dependencies [9ebc16b] +- Updated dependencies [2d71558] +- Updated dependencies [fad9325] + - @antv/g-lite@2.2.10 + - @antv/g-plugin-canvas-renderer@2.2.12 + - @antv/g-plugin-canvas-path-generator@2.1.10 + ## 2.1.11 ### Patch Changes diff --git a/packages/g-plugin-canvas-picker/package.json b/packages/g-plugin-canvas-picker/package.json index 504a7f764..95d268062 100644 --- a/packages/g-plugin-canvas-picker/package.json +++ b/packages/g-plugin-canvas-picker/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-plugin-canvas-picker", - "version": "2.1.11", + "version": "2.1.12", "description": "A G plugin for picking in canvas", "keywords": [ "antv", diff --git a/packages/g-plugin-canvas-renderer/CHANGELOG.md b/packages/g-plugin-canvas-renderer/CHANGELOG.md index 5d9b2aa00..b13b1d749 100644 --- a/packages/g-plugin-canvas-renderer/CHANGELOG.md +++ b/packages/g-plugin-canvas-renderer/CHANGELOG.md @@ -1,5 +1,17 @@ # @antv/g-plugin-canvas-renderer +## 2.2.12 + +### Patch Changes + +- Updated dependencies [244d6dd] +- Updated dependencies [9ebc16b] +- Updated dependencies [2d71558] +- Updated dependencies [fad9325] + - @antv/g-plugin-image-loader@2.1.12 + - @antv/g-lite@2.2.10 + - @antv/g-plugin-canvas-path-generator@2.1.10 + ## 2.2.11 ### Patch Changes diff --git a/packages/g-plugin-canvas-renderer/package.json b/packages/g-plugin-canvas-renderer/package.json index afebbad3d..700d6d311 100644 --- a/packages/g-plugin-canvas-renderer/package.json +++ b/packages/g-plugin-canvas-renderer/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-plugin-canvas-renderer", - "version": "2.2.11", + "version": "2.2.12", "description": "A G plugin of renderer implementation with Canvas2D API", "keywords": [ "antv", diff --git a/packages/g-plugin-canvaskit-renderer/CHANGELOG.md b/packages/g-plugin-canvaskit-renderer/CHANGELOG.md index 04b9a2b8d..6c35aeca5 100644 --- a/packages/g-plugin-canvaskit-renderer/CHANGELOG.md +++ b/packages/g-plugin-canvaskit-renderer/CHANGELOG.md @@ -1,5 +1,16 @@ # @antv/g-plugin-canvaskit-renderer +## 2.1.12 + +### Patch Changes + +- Updated dependencies [244d6dd] +- Updated dependencies [9ebc16b] +- Updated dependencies [2d71558] +- Updated dependencies [fad9325] + - @antv/g-plugin-image-loader@2.1.12 + - @antv/g-lite@2.2.10 + ## 2.1.11 ### Patch Changes diff --git a/packages/g-plugin-canvaskit-renderer/package.json b/packages/g-plugin-canvaskit-renderer/package.json index 317eb5b7e..9d031ddc3 100644 --- a/packages/g-plugin-canvaskit-renderer/package.json +++ b/packages/g-plugin-canvaskit-renderer/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-plugin-canvaskit-renderer", - "version": "2.1.11", + "version": "2.1.12", "description": "A G plugin of renderer implementation with CanvasKit", "keywords": [ "antv", diff --git a/packages/g-plugin-control/CHANGELOG.md b/packages/g-plugin-control/CHANGELOG.md index a6929abc8..22b6706ff 100644 --- a/packages/g-plugin-control/CHANGELOG.md +++ b/packages/g-plugin-control/CHANGELOG.md @@ -1,5 +1,15 @@ # @antv/g-plugin-control +## 2.0.26 + +### Patch Changes + +- Updated dependencies [244d6dd] +- Updated dependencies [9ebc16b] +- Updated dependencies [2d71558] +- Updated dependencies [fad9325] + - @antv/g-lite@2.2.10 + ## 2.0.25 ### Patch Changes diff --git a/packages/g-plugin-control/package.json b/packages/g-plugin-control/package.json index f70fb47e4..62af5cc66 100644 --- a/packages/g-plugin-control/package.json +++ b/packages/g-plugin-control/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-plugin-control", - "version": "2.0.25", + "version": "2.0.26", "description": "A G plugin for orbit control", "keywords": [ "antv", diff --git a/packages/g-plugin-css-select/CHANGELOG.md b/packages/g-plugin-css-select/CHANGELOG.md index d61bfc03e..83f5ab6cb 100644 --- a/packages/g-plugin-css-select/CHANGELOG.md +++ b/packages/g-plugin-css-select/CHANGELOG.md @@ -1,5 +1,15 @@ # @antv/g-plugin-css-select +## 2.0.26 + +### Patch Changes + +- Updated dependencies [244d6dd] +- Updated dependencies [9ebc16b] +- Updated dependencies [2d71558] +- Updated dependencies [fad9325] + - @antv/g-lite@2.2.10 + ## 2.0.25 ### Patch Changes diff --git a/packages/g-plugin-css-select/package.json b/packages/g-plugin-css-select/package.json index c5dc46353..792108c25 100644 --- a/packages/g-plugin-css-select/package.json +++ b/packages/g-plugin-css-select/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-plugin-css-select", - "version": "2.0.25", + "version": "2.0.26", "description": "A G plugin for using CSS select syntax in query selector", "keywords": [ "antv", diff --git a/packages/g-plugin-device-renderer/CHANGELOG.md b/packages/g-plugin-device-renderer/CHANGELOG.md index ac38591bc..432e59e7b 100644 --- a/packages/g-plugin-device-renderer/CHANGELOG.md +++ b/packages/g-plugin-device-renderer/CHANGELOG.md @@ -1,5 +1,17 @@ # @antv/g-plugin-device-renderer +## 2.2.12 + +### Patch Changes + +- 244d6dd: refactor: reduce global redundant code +- Updated dependencies [244d6dd] +- Updated dependencies [9ebc16b] +- Updated dependencies [2d71558] +- Updated dependencies [fad9325] + - @antv/g-plugin-image-loader@2.1.12 + - @antv/g-lite@2.2.10 + ## 2.2.11 ### Patch Changes diff --git a/packages/g-plugin-device-renderer/package.json b/packages/g-plugin-device-renderer/package.json index 60994d6d1..4913d92fe 100644 --- a/packages/g-plugin-device-renderer/package.json +++ b/packages/g-plugin-device-renderer/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-plugin-device-renderer", - "version": "2.2.11", + "version": "2.2.12", "description": "A G plugin of renderer implementation with GPUDevice", "keywords": [ "antv", diff --git a/packages/g-plugin-device-renderer/src/TexturePool.ts b/packages/g-plugin-device-renderer/src/TexturePool.ts index b09ff1b4a..a75cc2b13 100644 --- a/packages/g-plugin-device-renderer/src/TexturePool.ts +++ b/packages/g-plugin-device-renderer/src/TexturePool.ts @@ -3,7 +3,6 @@ import { CSSGradientValue, DisplayObject, GlobalRuntime, - isBrowser, LinearGradient, parsedTransformToMat4, parseTransform, @@ -74,14 +73,7 @@ export class TexturePool { this.context.renderingService.dirtify(); } else { // @see https://github.com/antvis/g/issues/938 - const { createImage } = this.context.config; - - let image: HTMLImageElement; - if (createImage) { - image = createImage(src); - } else if (isBrowser) { - image = new window.Image(); - } + const image = this.context.config.createImage(); if (image) { image.onload = () => { diff --git a/packages/g-plugin-dom-interaction/CHANGELOG.md b/packages/g-plugin-dom-interaction/CHANGELOG.md index 636bf36f6..0f8491390 100644 --- a/packages/g-plugin-dom-interaction/CHANGELOG.md +++ b/packages/g-plugin-dom-interaction/CHANGELOG.md @@ -1,5 +1,15 @@ # @antv/g-plugin-dom-interaction +## 2.1.15 + +### Patch Changes + +- Updated dependencies [244d6dd] +- Updated dependencies [9ebc16b] +- Updated dependencies [2d71558] +- Updated dependencies [fad9325] + - @antv/g-lite@2.2.10 + ## 2.1.14 ### Patch Changes diff --git a/packages/g-plugin-dom-interaction/package.json b/packages/g-plugin-dom-interaction/package.json index fd47628b1..883b2f84f 100644 --- a/packages/g-plugin-dom-interaction/package.json +++ b/packages/g-plugin-dom-interaction/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-plugin-dom-interaction", - "version": "2.1.14", + "version": "2.1.15", "description": "A G plugin", "keywords": [ "antv", diff --git a/packages/g-plugin-dragndrop/CHANGELOG.md b/packages/g-plugin-dragndrop/CHANGELOG.md index bdeb76489..45be28186 100644 --- a/packages/g-plugin-dragndrop/CHANGELOG.md +++ b/packages/g-plugin-dragndrop/CHANGELOG.md @@ -1,5 +1,15 @@ # @antv/g-plugin-dragndrop +## 2.0.26 + +### Patch Changes + +- Updated dependencies [244d6dd] +- Updated dependencies [9ebc16b] +- Updated dependencies [2d71558] +- Updated dependencies [fad9325] + - @antv/g-lite@2.2.10 + ## 2.0.25 ### Patch Changes diff --git a/packages/g-plugin-dragndrop/package.json b/packages/g-plugin-dragndrop/package.json index 443951ba7..6ac7519b6 100644 --- a/packages/g-plugin-dragndrop/package.json +++ b/packages/g-plugin-dragndrop/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-plugin-dragndrop", - "version": "2.0.25", + "version": "2.0.26", "description": "A G plugin for Drag n Drop implemented with PointerEvents", "keywords": [ "antv", diff --git a/packages/g-plugin-gesture/CHANGELOG.md b/packages/g-plugin-gesture/CHANGELOG.md index be417b369..412c0e3c5 100644 --- a/packages/g-plugin-gesture/CHANGELOG.md +++ b/packages/g-plugin-gesture/CHANGELOG.md @@ -1,5 +1,15 @@ # @antv/g-plugin-gesture +## 2.0.26 + +### Patch Changes + +- Updated dependencies [244d6dd] +- Updated dependencies [9ebc16b] +- Updated dependencies [2d71558] +- Updated dependencies [fad9325] + - @antv/g-lite@2.2.10 + ## 2.0.25 ### Patch Changes diff --git a/packages/g-plugin-gesture/package.json b/packages/g-plugin-gesture/package.json index 795b52366..280b8f6a7 100644 --- a/packages/g-plugin-gesture/package.json +++ b/packages/g-plugin-gesture/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-plugin-gesture", - "version": "2.0.25", + "version": "2.0.26", "description": "A G plugin for Gesture implemented with PointerEvents", "keywords": [ "antv", diff --git a/packages/g-plugin-html-renderer/CHANGELOG.md b/packages/g-plugin-html-renderer/CHANGELOG.md index b4e0fc5ec..3a98c63e6 100644 --- a/packages/g-plugin-html-renderer/CHANGELOG.md +++ b/packages/g-plugin-html-renderer/CHANGELOG.md @@ -1,5 +1,15 @@ # @antv/g-plugin-html-renderer +## 2.1.15 + +### Patch Changes + +- Updated dependencies [244d6dd] +- Updated dependencies [9ebc16b] +- Updated dependencies [2d71558] +- Updated dependencies [fad9325] + - @antv/g-lite@2.2.10 + ## 2.1.14 ### Patch Changes diff --git a/packages/g-plugin-html-renderer/package.json b/packages/g-plugin-html-renderer/package.json index 321137c50..55dab4ba0 100644 --- a/packages/g-plugin-html-renderer/package.json +++ b/packages/g-plugin-html-renderer/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-plugin-html-renderer", - "version": "2.1.14", + "version": "2.1.15", "description": "A G plugin for rendering HTML", "keywords": [ "antv", diff --git a/packages/g-plugin-image-loader/CHANGELOG.md b/packages/g-plugin-image-loader/CHANGELOG.md index 8e9c58559..9f02fef34 100644 --- a/packages/g-plugin-image-loader/CHANGELOG.md +++ b/packages/g-plugin-image-loader/CHANGELOG.md @@ -1,5 +1,16 @@ # @antv/g-plugin-image-loader +## 2.1.12 + +### Patch Changes + +- 244d6dd: refactor: reduce global redundant code +- Updated dependencies [244d6dd] +- Updated dependencies [9ebc16b] +- Updated dependencies [2d71558] +- Updated dependencies [fad9325] + - @antv/g-lite@2.2.10 + ## 2.1.11 ### Patch Changes diff --git a/packages/g-plugin-image-loader/package.json b/packages/g-plugin-image-loader/package.json index 83e36a72a..487f75cf7 100644 --- a/packages/g-plugin-image-loader/package.json +++ b/packages/g-plugin-image-loader/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-plugin-image-loader", - "version": "2.1.11", + "version": "2.1.12", "description": "A G plugin for loading image", "keywords": [ "antv", diff --git a/packages/g-plugin-image-loader/src/ImagePool.ts b/packages/g-plugin-image-loader/src/ImagePool.ts index 3ce3c7b20..dc4ea785d 100644 --- a/packages/g-plugin-image-loader/src/ImagePool.ts +++ b/packages/g-plugin-image-loader/src/ImagePool.ts @@ -9,7 +9,6 @@ import { UnitType, computeLinearGradient, computeRadialGradient, - isBrowser, parseTransform, parsedTransformToMat4, Image, @@ -132,16 +131,9 @@ export class ImagePool { }); } - // @see https://github.com/antvis/g/issues/938 - const { createImage } = this.context.config; - return new Promise((resolve, reject) => { - let image: HTMLImageElement; - if (createImage) { - image = createImage(imageSource); - } else if (isBrowser) { - image = new window.Image(); - } + // @see https://github.com/antvis/g/issues/938 + const image = this.context.config.createImage(); if (image) { const imageCache: ImageCache = { diff --git a/packages/g-plugin-matterjs/CHANGELOG.md b/packages/g-plugin-matterjs/CHANGELOG.md index cca1421ca..bbae873ca 100644 --- a/packages/g-plugin-matterjs/CHANGELOG.md +++ b/packages/g-plugin-matterjs/CHANGELOG.md @@ -1,5 +1,15 @@ # @antv/g-plugin-matterjs +## 2.0.26 + +### Patch Changes + +- Updated dependencies [244d6dd] +- Updated dependencies [9ebc16b] +- Updated dependencies [2d71558] +- Updated dependencies [fad9325] + - @antv/g-lite@2.2.10 + ## 2.0.25 ### Patch Changes diff --git a/packages/g-plugin-matterjs/package.json b/packages/g-plugin-matterjs/package.json index 8beda608f..4c76d4c10 100644 --- a/packages/g-plugin-matterjs/package.json +++ b/packages/g-plugin-matterjs/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-plugin-matterjs", - "version": "2.0.25", + "version": "2.0.26", "description": "A G plugin for matter.js physics engine", "keywords": [ "antv", diff --git a/packages/g-plugin-mobile-interaction/CHANGELOG.md b/packages/g-plugin-mobile-interaction/CHANGELOG.md index 2cd5ce44a..71cd0d020 100644 --- a/packages/g-plugin-mobile-interaction/CHANGELOG.md +++ b/packages/g-plugin-mobile-interaction/CHANGELOG.md @@ -1,5 +1,15 @@ # @antv/g-plugin-mobile-interaction +## 1.0.26 + +### Patch Changes + +- Updated dependencies [244d6dd] +- Updated dependencies [9ebc16b] +- Updated dependencies [2d71558] +- Updated dependencies [fad9325] + - @antv/g-lite@2.2.10 + ## 1.0.25 ### Patch Changes diff --git a/packages/g-plugin-mobile-interaction/package.json b/packages/g-plugin-mobile-interaction/package.json index 1e063ca56..2d8cc089d 100644 --- a/packages/g-plugin-mobile-interaction/package.json +++ b/packages/g-plugin-mobile-interaction/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-plugin-mobile-interaction", - "version": "1.0.25", + "version": "1.0.26", "description": "A G plugin listening events in mobile environment", "keywords": [ "antv", diff --git a/packages/g-plugin-physx/CHANGELOG.md b/packages/g-plugin-physx/CHANGELOG.md index b8e87fd74..1160cc64a 100644 --- a/packages/g-plugin-physx/CHANGELOG.md +++ b/packages/g-plugin-physx/CHANGELOG.md @@ -1,5 +1,15 @@ # @antv/g-plugin-physx +## 2.0.26 + +### Patch Changes + +- Updated dependencies [244d6dd] +- Updated dependencies [9ebc16b] +- Updated dependencies [2d71558] +- Updated dependencies [fad9325] + - @antv/g-lite@2.2.10 + ## 2.0.25 ### Patch Changes diff --git a/packages/g-plugin-physx/package.json b/packages/g-plugin-physx/package.json index 6da79233a..381c95351 100644 --- a/packages/g-plugin-physx/package.json +++ b/packages/g-plugin-physx/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-plugin-physx", - "version": "2.0.25", + "version": "2.0.26", "description": "A G plugin for PhysX", "keywords": [ "antv", diff --git a/packages/g-plugin-rough-canvas-renderer/CHANGELOG.md b/packages/g-plugin-rough-canvas-renderer/CHANGELOG.md index aaba65907..574f6e64e 100644 --- a/packages/g-plugin-rough-canvas-renderer/CHANGELOG.md +++ b/packages/g-plugin-rough-canvas-renderer/CHANGELOG.md @@ -1,5 +1,16 @@ # @antv/g-plugin-rough-canvas-renderer +## 2.0.33 + +### Patch Changes + +- Updated dependencies [244d6dd] +- Updated dependencies [9ebc16b] +- Updated dependencies [2d71558] +- Updated dependencies [fad9325] + - @antv/g-canvas@2.0.33 + - @antv/g-lite@2.2.10 + ## 2.0.32 ### Patch Changes diff --git a/packages/g-plugin-rough-canvas-renderer/package.json b/packages/g-plugin-rough-canvas-renderer/package.json index a3b8c91c5..842300c20 100644 --- a/packages/g-plugin-rough-canvas-renderer/package.json +++ b/packages/g-plugin-rough-canvas-renderer/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-plugin-rough-canvas-renderer", - "version": "2.0.32", + "version": "2.0.33", "description": "A G plugin of renderer implementation with rough.js", "keywords": [ "antv", diff --git a/packages/g-plugin-rough-svg-renderer/CHANGELOG.md b/packages/g-plugin-rough-svg-renderer/CHANGELOG.md index cc562f09c..daebbce14 100644 --- a/packages/g-plugin-rough-svg-renderer/CHANGELOG.md +++ b/packages/g-plugin-rough-svg-renderer/CHANGELOG.md @@ -1,5 +1,16 @@ # @antv/g-plugin-rough-svg-renderer +## 2.0.29 + +### Patch Changes + +- Updated dependencies [244d6dd] +- Updated dependencies [9ebc16b] +- Updated dependencies [2d71558] +- Updated dependencies [fad9325] + - @antv/g-lite@2.2.10 + - @antv/g-svg@2.0.28 + ## 2.0.28 ### Patch Changes diff --git a/packages/g-plugin-rough-svg-renderer/package.json b/packages/g-plugin-rough-svg-renderer/package.json index aed78c797..58ccae6e8 100644 --- a/packages/g-plugin-rough-svg-renderer/package.json +++ b/packages/g-plugin-rough-svg-renderer/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-plugin-rough-svg-renderer", - "version": "2.0.28", + "version": "2.0.29", "description": "A G plugin of renderer implementation with rough.js", "keywords": [ "antv", diff --git a/packages/g-plugin-svg-picker/CHANGELOG.md b/packages/g-plugin-svg-picker/CHANGELOG.md index 4feecdbf9..48fc843d8 100644 --- a/packages/g-plugin-svg-picker/CHANGELOG.md +++ b/packages/g-plugin-svg-picker/CHANGELOG.md @@ -1,5 +1,16 @@ # @antv/g-plugin-svg-picker +## 2.0.28 + +### Patch Changes + +- Updated dependencies [244d6dd] +- Updated dependencies [9ebc16b] +- Updated dependencies [2d71558] +- Updated dependencies [fad9325] + - @antv/g-plugin-svg-renderer@2.2.10 + - @antv/g-lite@2.2.10 + ## 2.0.27 ### Patch Changes diff --git a/packages/g-plugin-svg-picker/package.json b/packages/g-plugin-svg-picker/package.json index 3d0c47baa..fb735102b 100644 --- a/packages/g-plugin-svg-picker/package.json +++ b/packages/g-plugin-svg-picker/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-plugin-svg-picker", - "version": "2.0.27", + "version": "2.0.28", "description": "A G plugin for picking in SVG", "keywords": [ "antv", diff --git a/packages/g-plugin-svg-renderer/CHANGELOG.md b/packages/g-plugin-svg-renderer/CHANGELOG.md index 3db91cd98..84251100c 100644 --- a/packages/g-plugin-svg-renderer/CHANGELOG.md +++ b/packages/g-plugin-svg-renderer/CHANGELOG.md @@ -1,5 +1,16 @@ # @antv/g-plugin-svg-renderer +## 2.2.10 + +### Patch Changes + +- 244d6dd: refactor: reduce global redundant code +- Updated dependencies [244d6dd] +- Updated dependencies [9ebc16b] +- Updated dependencies [2d71558] +- Updated dependencies [fad9325] + - @antv/g-lite@2.2.10 + ## 2.2.9 ### Patch Changes diff --git a/packages/g-plugin-svg-renderer/package.json b/packages/g-plugin-svg-renderer/package.json index 9d1acbc2d..83e3451e4 100644 --- a/packages/g-plugin-svg-renderer/package.json +++ b/packages/g-plugin-svg-renderer/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-plugin-svg-renderer", - "version": "2.2.9", + "version": "2.2.10", "description": "A G plugin of renderer implementation with SVG", "keywords": [ "antv", diff --git a/packages/g-plugin-svg-renderer/src/shapes/defs/Pattern.ts b/packages/g-plugin-svg-renderer/src/shapes/defs/Pattern.ts index e3e6fab70..7d87a8a04 100644 --- a/packages/g-plugin-svg-renderer/src/shapes/defs/Pattern.ts +++ b/packages/g-plugin-svg-renderer/src/shapes/defs/Pattern.ts @@ -34,7 +34,7 @@ export function createOrUpdateGradientAndPattern( $el: SVGElement, parsedColor: CSSGradientValue[] | CSSRGB | Pattern, name: string, - createImage: (url: string) => HTMLImageElement, + createImage: () => HTMLImageElement, plugin: SVGRendererPlugin, ) { // eg. clipPath don't have fill/stroke @@ -240,7 +240,7 @@ function createOrUpdatePattern( $def: SVGDefsElement, object: DisplayObject, pattern: Pattern, - createImage: (url: string) => HTMLImageElement, + createImage: () => HTMLImageElement, plugin: SVGRendererPlugin, ) { const patternId = generateCacheKey(pattern); @@ -267,12 +267,8 @@ function createOrUpdatePattern( // @see https://stackoverflow.com/a/13379007 $image.setAttribute('href', imageURL); - let img: HTMLImageElement; - if (createImage) { - img = createImage(imageURL); - } else if (isBrowser) { - img = new window.Image(); - } + const img = createImage(); + if (!imageURL.match(/^data:/i)) { img.crossOrigin = 'Anonymous'; $image.setAttribute('crossorigin', 'anonymous'); diff --git a/packages/g-plugin-yoga/CHANGELOG.md b/packages/g-plugin-yoga/CHANGELOG.md index 27d9b4513..d31c5b6f2 100644 --- a/packages/g-plugin-yoga/CHANGELOG.md +++ b/packages/g-plugin-yoga/CHANGELOG.md @@ -1,5 +1,15 @@ # @antv/g-plugin-yoga +## 2.0.26 + +### Patch Changes + +- Updated dependencies [244d6dd] +- Updated dependencies [9ebc16b] +- Updated dependencies [2d71558] +- Updated dependencies [fad9325] + - @antv/g-lite@2.2.10 + ## 2.0.25 ### Patch Changes diff --git a/packages/g-plugin-yoga/package.json b/packages/g-plugin-yoga/package.json index d9c3e0379..c24513bf7 100644 --- a/packages/g-plugin-yoga/package.json +++ b/packages/g-plugin-yoga/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-plugin-yoga", - "version": "2.0.25", + "version": "2.0.26", "description": "A G plugin for Yoga layout engine", "keywords": [ "antv", diff --git a/packages/g-plugin-zdog-canvas-renderer/CHANGELOG.md b/packages/g-plugin-zdog-canvas-renderer/CHANGELOG.md index c65ae82d4..5992d0bb4 100644 --- a/packages/g-plugin-zdog-canvas-renderer/CHANGELOG.md +++ b/packages/g-plugin-zdog-canvas-renderer/CHANGELOG.md @@ -1,5 +1,16 @@ # @antv/g-plugin-zdog-canvas-renderer +## 2.0.32 + +### Patch Changes + +- Updated dependencies [244d6dd] +- Updated dependencies [9ebc16b] +- Updated dependencies [2d71558] +- Updated dependencies [fad9325] + - @antv/g-canvas@2.0.33 + - @antv/g-lite@2.2.10 + ## 2.0.31 ### Patch Changes diff --git a/packages/g-plugin-zdog-canvas-renderer/package.json b/packages/g-plugin-zdog-canvas-renderer/package.json index bd64ebce6..21fbf0f05 100644 --- a/packages/g-plugin-zdog-canvas-renderer/package.json +++ b/packages/g-plugin-zdog-canvas-renderer/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-plugin-zdog-canvas-renderer", - "version": "2.0.31", + "version": "2.0.32", "description": "A G plugin of renderer implementation with Zdog", "keywords": [ "antv", diff --git a/packages/g-plugin-zdog-svg-renderer/CHANGELOG.md b/packages/g-plugin-zdog-svg-renderer/CHANGELOG.md index c98d02450..afd64a82f 100644 --- a/packages/g-plugin-zdog-svg-renderer/CHANGELOG.md +++ b/packages/g-plugin-zdog-svg-renderer/CHANGELOG.md @@ -1,5 +1,17 @@ # @antv/g-plugin-zdog-svg-renderer +## 2.0.28 + +### Patch Changes + +- Updated dependencies [244d6dd] +- Updated dependencies [9ebc16b] +- Updated dependencies [2d71558] +- Updated dependencies [fad9325] + - @antv/g-plugin-svg-renderer@2.2.10 + - @antv/g-lite@2.2.10 + - @antv/g-svg@2.0.28 + ## 2.0.27 ### Patch Changes diff --git a/packages/g-plugin-zdog-svg-renderer/package.json b/packages/g-plugin-zdog-svg-renderer/package.json index 34523ed5c..e41f9b1c4 100644 --- a/packages/g-plugin-zdog-svg-renderer/package.json +++ b/packages/g-plugin-zdog-svg-renderer/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-plugin-zdog-svg-renderer", - "version": "2.0.27", + "version": "2.0.28", "description": "A G plugin of renderer implementation with Zdog", "keywords": [ "antv", diff --git a/packages/g-svg/CHANGELOG.md b/packages/g-svg/CHANGELOG.md index 214e2385b..4fff68691 100644 --- a/packages/g-svg/CHANGELOG.md +++ b/packages/g-svg/CHANGELOG.md @@ -1,5 +1,19 @@ # @antv/g-svg +## 2.0.28 + +### Patch Changes + +- 244d6dd: refactor: reduce global redundant code +- Updated dependencies [244d6dd] +- Updated dependencies [9ebc16b] +- Updated dependencies [2d71558] +- Updated dependencies [fad9325] + - @antv/g-plugin-svg-renderer@2.2.10 + - @antv/g-lite@2.2.10 + - @antv/g-plugin-svg-picker@2.0.28 + - @antv/g-plugin-dom-interaction@2.1.15 + ## 2.0.27 ### Patch Changes diff --git a/packages/g-svg/package.json b/packages/g-svg/package.json index 47eac42d0..02bf75df6 100644 --- a/packages/g-svg/package.json +++ b/packages/g-svg/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-svg", - "version": "2.0.27", + "version": "2.0.28", "description": "A renderer implemented by SVG", "keywords": [ "antv", diff --git a/packages/g-svg/src/SVGContextService.ts b/packages/g-svg/src/SVGContextService.ts index 44ac1025e..b1933a5a5 100644 --- a/packages/g-svg/src/SVGContextService.ts +++ b/packages/g-svg/src/SVGContextService.ts @@ -6,7 +6,7 @@ import type { ContextService, DisplayObject, } from '@antv/g-lite'; -import { isBrowser, propertyMetadataCache } from '@antv/g-lite'; +import { propertyMetadataCache } from '@antv/g-lite'; import { createSVGElement } from '@antv/g-plugin-svg-renderer'; import { isString } from '@antv/util'; @@ -22,7 +22,11 @@ export class SVGContextService implements ContextService { } init() { - const { container, document: doc, devicePixelRatio } = this.canvasConfig; + const { + container, + document: doc, + devicePixelRatio: dpr, + } = this.canvasConfig; // create container this.$container = isString(container) @@ -41,9 +45,6 @@ export class SVGContextService implements ContextService { this.$namespace = $namespace; } - // use user-defined dpr first - let dpr = devicePixelRatio || (isBrowser && window.devicePixelRatio) || 1; - dpr = dpr >= 1 ? Math.ceil(dpr) : 1; this.dpr = dpr; } diff --git a/packages/g-web-animations-api/CHANGELOG.md b/packages/g-web-animations-api/CHANGELOG.md index 4477d94b1..a0bf2e1b6 100644 --- a/packages/g-web-animations-api/CHANGELOG.md +++ b/packages/g-web-animations-api/CHANGELOG.md @@ -1,5 +1,15 @@ # @antv/g-web-animations-api +## 2.1.15 + +### Patch Changes + +- Updated dependencies [244d6dd] +- Updated dependencies [9ebc16b] +- Updated dependencies [2d71558] +- Updated dependencies [fad9325] + - @antv/g-lite@2.2.10 + ## 2.1.14 ### Patch Changes diff --git a/packages/g-web-animations-api/package.json b/packages/g-web-animations-api/package.json index 7698e1965..7bf938205 100644 --- a/packages/g-web-animations-api/package.json +++ b/packages/g-web-animations-api/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-web-animations-api", - "version": "2.1.14", + "version": "2.1.15", "description": "A simple implementation of Web Animations API.", "keywords": [ "antv", diff --git a/packages/g-web-components/CHANGELOG.md b/packages/g-web-components/CHANGELOG.md index 19675bf3e..62e4419dd 100644 --- a/packages/g-web-components/CHANGELOG.md +++ b/packages/g-web-components/CHANGELOG.md @@ -1,5 +1,17 @@ # @antv/g-web-components +## 2.0.38 + +### Patch Changes + +- Updated dependencies [244d6dd] +- Updated dependencies [9ebc16b] +- Updated dependencies [2d71558] +- Updated dependencies [fad9325] + - @antv/g-canvas@2.0.33 + - @antv/g-webgl@2.0.37 + - @antv/g-lite@2.2.10 + ## 2.0.37 ### Patch Changes diff --git a/packages/g-web-components/package.json b/packages/g-web-components/package.json index 974f04594..57c52dc76 100644 --- a/packages/g-web-components/package.json +++ b/packages/g-web-components/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-web-components", - "version": "2.0.37", + "version": "2.0.38", "description": "A declarative usage for G implemented with WebComponents", "keywords": [ "antv", diff --git a/packages/g-webgl/CHANGELOG.md b/packages/g-webgl/CHANGELOG.md index d774012b6..001ef28c9 100644 --- a/packages/g-webgl/CHANGELOG.md +++ b/packages/g-webgl/CHANGELOG.md @@ -1,5 +1,20 @@ # @antv/g-webgl +## 2.0.37 + +### Patch Changes + +- 244d6dd: refactor: reduce global redundant code +- Updated dependencies [244d6dd] +- Updated dependencies [9ebc16b] +- Updated dependencies [2d71558] +- Updated dependencies [fad9325] + - @antv/g-plugin-device-renderer@2.2.12 + - @antv/g-plugin-image-loader@2.1.12 + - @antv/g-lite@2.2.10 + - @antv/g-plugin-dom-interaction@2.1.15 + - @antv/g-plugin-html-renderer@2.1.15 + ## 2.0.36 ### Patch Changes diff --git a/packages/g-webgl/package.json b/packages/g-webgl/package.json index bb4025f09..7f40cc240 100644 --- a/packages/g-webgl/package.json +++ b/packages/g-webgl/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-webgl", - "version": "2.0.36", + "version": "2.0.37", "description": "A renderer implemented by WebGL1/2", "keywords": [ "antv", diff --git a/packages/g-webgl/src/WebGLContextService.ts b/packages/g-webgl/src/WebGLContextService.ts index 945e261f6..089bb2b3a 100644 --- a/packages/g-webgl/src/WebGLContextService.ts +++ b/packages/g-webgl/src/WebGLContextService.ts @@ -6,7 +6,7 @@ import type { CanvasConfig, ContextService, } from '@antv/g-lite'; -import { isBrowser, setDOMSize } from '@antv/g-lite'; +import { setDOMSize } from '@antv/g-lite'; import type * as DeviceRenderer from '@antv/g-plugin-device-renderer'; import { isString } from '@antv/util'; @@ -87,9 +87,7 @@ export class WebGLContextService resize(width: number, height: number) { // use user-defined dpr first - const { devicePixelRatio } = this.canvasConfig; - let dpr = devicePixelRatio || (isBrowser && window.devicePixelRatio) || 1; - dpr = dpr >= 1 ? Math.ceil(dpr) : 1; + const { devicePixelRatio: dpr } = this.canvasConfig; this.dpr = dpr; if (this.$canvas) { diff --git a/packages/g-webgpu/CHANGELOG.md b/packages/g-webgpu/CHANGELOG.md index 09b24f156..583bcbc5f 100644 --- a/packages/g-webgpu/CHANGELOG.md +++ b/packages/g-webgpu/CHANGELOG.md @@ -1,5 +1,20 @@ # @antv/g-webgpu +## 2.0.37 + +### Patch Changes + +- 244d6dd: refactor: reduce global redundant code +- Updated dependencies [244d6dd] +- Updated dependencies [9ebc16b] +- Updated dependencies [2d71558] +- Updated dependencies [fad9325] + - @antv/g-plugin-device-renderer@2.2.12 + - @antv/g-plugin-image-loader@2.1.12 + - @antv/g-lite@2.2.10 + - @antv/g-plugin-dom-interaction@2.1.15 + - @antv/g-plugin-html-renderer@2.1.15 + ## 2.0.36 ### Patch Changes diff --git a/packages/g-webgpu/package.json b/packages/g-webgpu/package.json index 148534c9b..1e71b81c4 100644 --- a/packages/g-webgpu/package.json +++ b/packages/g-webgpu/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-webgpu", - "version": "2.0.36", + "version": "2.0.37", "description": "A renderer implemented by WebGPU", "keywords": [ "antv", diff --git a/packages/g-webgpu/src/WebGPUContextService.ts b/packages/g-webgpu/src/WebGPUContextService.ts index a7ef96dd0..f859936c2 100644 --- a/packages/g-webgpu/src/WebGPUContextService.ts +++ b/packages/g-webgpu/src/WebGPUContextService.ts @@ -6,7 +6,7 @@ import type { CanvasConfig, ContextService, } from '@antv/g-lite'; -import { isBrowser, setDOMSize } from '@antv/g-lite'; +import { setDOMSize } from '@antv/g-lite'; import type * as DeviceRenderer from '@antv/g-plugin-device-renderer'; import { isString } from '@antv/util'; @@ -85,9 +85,7 @@ export class WebGPUContextService implements ContextService { resize(width: number, height: number) { // use user-defined dpr first - const { devicePixelRatio } = this.canvasConfig; - let dpr = devicePixelRatio || (isBrowser && window.devicePixelRatio) || 1; - dpr = dpr >= 1 ? Math.ceil(dpr) : 1; + const { devicePixelRatio: dpr } = this.canvasConfig; this.dpr = dpr; if (this.$canvas) { diff --git a/packages/g/CHANGELOG.md b/packages/g/CHANGELOG.md index 78c186eb8..ecdcd1bde 100644 --- a/packages/g/CHANGELOG.md +++ b/packages/g/CHANGELOG.md @@ -1,5 +1,18 @@ # @antv/g +## 6.1.15 + +### Patch Changes + +- Updated dependencies [244d6dd] +- Updated dependencies [9ebc16b] +- Updated dependencies [2d71558] +- Updated dependencies [fad9325] + - @antv/g-lite@2.2.10 + - @antv/g-camera-api@2.0.29 + - @antv/g-dom-mutation-observer-api@2.0.26 + - @antv/g-web-animations-api@2.1.15 + ## 6.1.14 ### Patch Changes diff --git a/packages/g/package.json b/packages/g/package.json index bc05b63ac..6670b398a 100644 --- a/packages/g/package.json +++ b/packages/g/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g", - "version": "6.1.14", + "version": "6.1.15", "description": "A core module for rendering engine implements DOM API.", "keywords": [ "antv", diff --git a/packages/react-g/CHANGELOG.md b/packages/react-g/CHANGELOG.md index 3ba26240d..89db7dbdc 100644 --- a/packages/react-g/CHANGELOG.md +++ b/packages/react-g/CHANGELOG.md @@ -1,5 +1,11 @@ # @antv/react-g +## 2.0.31 + +### Patch Changes + +- @antv/g@6.1.15 + ## 2.0.30 ### Patch Changes diff --git a/packages/react-g/package.json b/packages/react-g/package.json index 36033ae6b..c264cc495 100644 --- a/packages/react-g/package.json +++ b/packages/react-g/package.json @@ -1,6 +1,6 @@ { "name": "@antv/react-g", - "version": "2.0.30", + "version": "2.0.31", "description": "react render for @antv/g", "keywords": [ "react", diff --git a/site/docs/api/canvas/options.en.md b/site/docs/api/canvas/options.en.md index 1daa7f65f..6c76f7700 100644 --- a/site/docs/api/canvas/options.en.md +++ b/site/docs/api/canvas/options.en.md @@ -127,6 +127,24 @@ canvas = new Canvas({ canvas.setCursor('crosshair'); ``` +## supportsMutipleCanvasesInOneContainer + +Optional. If or not support multiple canvases under one container, default is false. + +[Example](/en/examples/canvas/container/#shared-container) + +## enableLargeImageOptimization 6.1.1 + +`boolean` + +Optional, default is `false`. Enable high-resolution large image rendering and interactive optimization, through downsampling and slice rendering strategy, large images with hundreds of millions of pixels can also be rendered and interacted smoothly. + +:::warning{title=Limit} + +Currently only implemented in the native Canvas renderer. + +::: + ## Special platform adaptations On some special runtime platforms (e.g. applets), it is not possible to use global variables like [globalThis]( globalThis), and internally we need to rely on it to create images (`new globalThis.Image()`), determine if a TouchEvent is supported (`'ontouchstart' in globalThis`), and so on. Therefore, users of these particular platforms need to manually pass in the specific creation and determination methods. @@ -159,18 +177,6 @@ const canvas = new Canvas({ }); ``` -### enableLargeImageOptimization 6.1.1 - -`boolean` - -Optional, default is `false`. Enable high-resolution large image rendering and interactive optimization, through downsampling and slice rendering strategy, large images with hundreds of millions of pixels can also be rendered and interacted smoothly. - -:::warning{title=Limit} - -Currently only implemented in the native Canvas renderer. - -::: - ### supportsCSSTransform Optional. 是否支持在容器上应用 CSS Transform 的情况下确保交互事件坐标转换正确。 @@ -225,12 +231,6 @@ const canvas = new Canvas({ }); ``` -### supportsMutipleCanvasesInOneContainer - -Optional. If or not support multiple canvases under one container, default is false. - -[Example](/en/examples/canvas/container/#shared-container) - ## Modify the initialization configuration When initializing the canvas we pass in the canvas size, renderer and other configurations, which may be modified subsequently, so we provide the following API. diff --git a/site/docs/api/canvas/options.zh.md b/site/docs/api/canvas/options.zh.md index e9eaba0d1..d484fbb93 100644 --- a/site/docs/api/canvas/options.zh.md +++ b/site/docs/api/canvas/options.zh.md @@ -133,6 +133,24 @@ canvas = new Canvas({ canvas.setCursor('crosshair'); ``` +## supportsMutipleCanvasesInOneContainer + +可选。是否支持一个 container 下容纳多个画布,默认为 false。 + +[示例](/zh/examples/canvas/container/#shared-container) + +## enableLargeImageOptimization 6.1.1 + +`boolean` + +可选,默认为 `false`。开启高分辨率大图渲染与交互优化,通过降采样与切片渲染策略使得上亿像素的大图也能流畅渲染和交互。 + +:::warning{title=限制} + +目前仅在原生 Canvas 渲染器中实现。 + +::: + ## 特殊运行平台适配 在一些特殊的运行平台(例如小程序)上,无法正常使用类似 [globalThis](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis) 这样的全局变量,而在内部我们又需要依靠它创建图片(`new globalThis.Image()`)、判断是否支持 TouchEvent(`'ontouchstart' in globalThis`)等。因此需要这些特殊平台的使用者手动传入特有的创建以及判断方式。 @@ -166,18 +184,6 @@ const canvas = new Canvas({ }); ``` -### enableLargeImageOptimization 6.1.1 - -`boolean` - -可选,默认为 `false`。开启高分辨率大图渲染与交互优化,通过降采样与切片渲染策略使得上亿像素的大图也能流畅渲染和交互。 - -:::warning{title=限制} - -目前仅在原生 Canvas 渲染器中实现。 - -::: - ### supportsCSSTransform 可选。是否支持在容器上应用 CSS Transform 的情况下确保交互事件坐标转换正确。 @@ -231,12 +237,6 @@ const canvas = new Canvas({ }); ``` -### supportsMutipleCanvasesInOneContainer - -可选。是否支持一个 container 下容纳多个画布,默认为 false。 - -[示例](/zh/examples/canvas/container/#shared-container) - ## 修改初始化配置 在初始化画布时我们传入了画布尺寸、渲染器等配置,后续可能对它们进行修改,因此我们提供了以下 API。 diff --git a/site/examples/scenegraph/basic/demo/boxmodel.js b/site/examples/scenegraph/basic/demo/boxmodel.js index 1eba040dc..18525f873 100644 --- a/site/examples/scenegraph/basic/demo/boxmodel.js +++ b/site/examples/scenegraph/basic/demo/boxmodel.js @@ -1,4 +1,4 @@ -import { Canvas, Rect } from '@antv/g'; +import { Canvas, Rect, CanvasEvent } from '@antv/g'; import { Renderer as CanvasRenderer } from '@antv/g-canvas'; import { Renderer as CanvaskitRenderer } from '@antv/g-canvaskit'; import { Renderer as SVGRenderer } from '@antv/g-svg';