diff --git a/__tests__/demos/bugfix/1760.ts b/__tests__/demos/bugfix/1760.ts new file mode 100644 index 000000000..ea0ba6512 --- /dev/null +++ b/__tests__/demos/bugfix/1760.ts @@ -0,0 +1,61 @@ +import { Canvas, Path, Line } from '@antv/g'; + +/** + * @see https://github.com/antvis/G/issues/1760 + * @see https://github.com/antvis/G/issues/1790 + * @see https://github.com/antvis/G/pull/1808 + */ +export async function issue_1760(context: { canvas: Canvas }) { + const { canvas } = context; + await canvas.ready; + + const arrowMarker = new Path({ + style: { + d: 'M 10,10 L -10,0 L 10,-10 Z', + stroke: '#1890FF', + transformOrigin: 'center', + }, + }); + const arrowMarker1 = new Path({ + style: { + d: 'M 10,10 L -10,0 L 10,-10 Z', + stroke: '#ff90FF', + transformOrigin: 'center', + }, + }); + + const path = new Path({ + style: { + lineWidth: 1, + stroke: '#54BECC', + // d: 'M 0,40 L 100,100', + // d: 'M 10,100 L 100,100', + d: 'M 10,100 Q 100,100 150,150', + // d: 'M 10,100 C 100,100 150,150 180,200', + // d: 'M 10,100 A 30 50 0 0 1 162.55 162.45', + // d: 'M 10,100 A 30 50 0 0 0 162.55 162.45', + markerStart: arrowMarker, + markerStartOffset: 30, + markerEnd: arrowMarker1, + markerEndOffset: 30, + }, + }); + + const line = new Line({ + style: { + x1: 10, + y1: 150, + x2: 100, + y2: 150, + lineWidth: 1, + stroke: '#54BECC', + markerStart: arrowMarker, + markerStartOffset: 30, + markerEnd: arrowMarker, + markerEndOffset: 30, + }, + }); + + canvas.appendChild(path); + canvas.appendChild(line); +} diff --git a/__tests__/demos/bugfix/index.ts b/__tests__/demos/bugfix/index.ts index f48122b8c..96e15b67c 100644 --- a/__tests__/demos/bugfix/index.ts +++ b/__tests__/demos/bugfix/index.ts @@ -7,3 +7,4 @@ export { shadowroot_offset } from './1677'; export { gradient_text } from './1572'; export { zoom } from './1667'; export { test_pick } from './1747'; +export { issue_1760 } from './1760'; diff --git a/__tests__/demos/perf/image.ts b/__tests__/demos/perf/image.ts index e6239a755..798af5a23 100644 --- a/__tests__/demos/perf/image.ts +++ b/__tests__/demos/perf/image.ts @@ -1,30 +1,47 @@ import { Canvas, Image as GImage } from '@antv/g'; +import * as lil from 'lil-gui'; -export async function image(context: { canvas: Canvas }) { - const { canvas } = context; +export async function image(context: { canvas: Canvas; gui: lil.GUI }) { + const { canvas, gui } = context; await canvas.ready; console.log(canvas); + let image = new GImage({ + style: { + x: 0, + y: 0, + // width: 100, + // height: 400, + // src: 'https://gw.alipayobjects.com/mdn/rms_6ae20b/afts/img/A*N4ZMS7gHsUIAAAAAAAAAAABkARQnAQ', + // src: 'http://mmtcdp.stable.alipay.net/cto_designhubcore/afts/img/g1a5QYkvbcMAAAAAAAAAAAAADgLVAQBr/original', + src: 'https://mdn.alipayobjects.com/huamei_fr7vu1/afts/img/A*SqloToP7R9QAAAAAAAAAAAAADkn0AQ/original', + }, + }); + canvas.appendChild(image); + + // --- const $dom = canvas.getContextService().getDomElement() as HTMLCanvasElement; + let currentZoom = 1; + let isDragging = false; + let lastX, lastY; + $dom.style.border = '1px solid gray'; - // --- $dom.addEventListener('wheel', (event) => { event.preventDefault(); const { deltaX, deltaY } = event; - const d = -(deltaX ?? deltaY); + const d = -(deltaX || deltaY); const ratio = 1 + (Math.min(Math.max(d, -50), 50) * 1) / 100; const zoom = canvas.getCamera().getZoom(); + currentZoom = zoom * ratio; canvas .getCamera() - .setZoomByViewportPoint(zoom * ratio, [event.offsetX, event.offsetY]); + .setZoomByViewportPoint(currentZoom, [event.offsetX, event.offsetY]); }); - let isDragging = false; - let lastX, lastY; $dom.addEventListener('mousedown', (e) => { isDragging = true; lastX = e.clientX; @@ -34,7 +51,7 @@ export async function image(context: { canvas: Canvas }) { if (isDragging) { const dx = e.clientX - lastX; const dy = e.clientY - lastY; - canvas.getCamera().pan(-dx, -dy); + canvas.getCamera().pan(-dx / currentZoom, -dy / currentZoom); lastX = e.clientX; lastY = e.clientY; } @@ -45,15 +62,13 @@ export async function image(context: { canvas: Canvas }) { // --- - let image = new GImage({ - style: { - x: 0, - y: 0, - // width: 100, - // height: 400, - // src: 'https://gw.alipayobjects.com/mdn/rms_6ae20b/afts/img/A*N4ZMS7gHsUIAAAAAAAAAAABkARQnAQ', - src: 'http://mmtcdp.stable.alipay.net/cto_designhubcore/afts/img/g1a5QYkvbcMAAAAAAAAAAAAADgLVAQBr/original', - }, - }); - canvas.appendChild(image); + // GUI + gui + .add( + { enableLargeImageOptimization: false }, + 'enableLargeImageOptimization', + ) + .onChange((result) => { + canvas.context.config.enableLargeImageOptimization = result; + }); } diff --git a/__tests__/index.html b/__tests__/index.html index 9049dd773..adcdec7a8 100644 --- a/__tests__/index.html +++ b/__tests__/index.html @@ -1,10 +1,19 @@ - + G: Preview - - - -
- - - - - diff --git a/package.json b/package.json index d9ab57fe1..e10727a96 100644 --- a/package.json +++ b/package.json @@ -111,6 +111,7 @@ "rollup-plugin-visualizer": "^5.9.2", "simplex-noise": "^3.0.0", "sinon": "^11.1.2", + "stats.js": "^0.17.0", "ts-jest": "^29.1.1", "typescript": "^5.6.2", "vite": "^3.2.7", diff --git a/packages/g-camera-api/CHANGELOG.md b/packages/g-camera-api/CHANGELOG.md index 820275cef..c5111d2c8 100644 --- a/packages/g-camera-api/CHANGELOG.md +++ b/packages/g-camera-api/CHANGELOG.md @@ -1,5 +1,12 @@ # @antv/g-camera-api +## 2.0.18 + +### Patch Changes + +- Updated dependencies [4aa12e8c] + - @antv/g-lite@2.1.4 + ## 2.0.17 ### Patch Changes diff --git a/packages/g-camera-api/package.json b/packages/g-camera-api/package.json index c1c7f2083..1175f9701 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.17", + "version": "2.0.18", "description": "A simple implementation of Camera API.", "keywords": [ "antv", diff --git a/packages/g-canvas/CHANGELOG.md b/packages/g-canvas/CHANGELOG.md index 3796277ab..7a05224b0 100644 --- a/packages/g-canvas/CHANGELOG.md +++ b/packages/g-canvas/CHANGELOG.md @@ -1,5 +1,18 @@ # @antv/g-canvas +## 2.0.20 + +### Patch Changes + +- Updated dependencies [4aa12e8c] + - @antv/g-lite@2.1.4 + - @antv/g-plugin-canvas-path-generator@2.0.15 + - @antv/g-plugin-canvas-picker@2.0.17 + - @antv/g-plugin-canvas-renderer@2.1.4 + - @antv/g-plugin-dom-interaction@2.1.4 + - @antv/g-plugin-html-renderer@2.1.4 + - @antv/g-plugin-image-loader@2.0.15 + ## 2.0.19 ### Patch Changes diff --git a/packages/g-canvas/package.json b/packages/g-canvas/package.json index a53bb3639..3b644edcb 100644 --- a/packages/g-canvas/package.json +++ b/packages/g-canvas/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-canvas", - "version": "2.0.19", + "version": "2.0.20", "description": "A renderer implemented by Canvas 2D API", "keywords": [ "antv", diff --git a/packages/g-canvaskit/CHANGELOG.md b/packages/g-canvaskit/CHANGELOG.md index 2ee92f932..66eca1107 100644 --- a/packages/g-canvaskit/CHANGELOG.md +++ b/packages/g-canvaskit/CHANGELOG.md @@ -1,5 +1,18 @@ # @antv/g-canvaskit +## 1.0.19 + +### Patch Changes + +- Updated dependencies [4aa12e8c] + - @antv/g-lite@2.1.4 + - @antv/g-plugin-canvas-path-generator@2.0.15 + - @antv/g-plugin-canvas-picker@2.0.17 + - @antv/g-plugin-canvaskit-renderer@2.0.16 + - @antv/g-plugin-dom-interaction@2.1.4 + - @antv/g-plugin-html-renderer@2.1.4 + - @antv/g-plugin-image-loader@2.0.15 + ## 1.0.18 ### Patch Changes diff --git a/packages/g-canvaskit/package.json b/packages/g-canvaskit/package.json index b17055a50..190916552 100644 --- a/packages/g-canvaskit/package.json +++ b/packages/g-canvaskit/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-canvaskit", - "version": "1.0.18", + "version": "1.0.19", "description": "A renderer implemented by CanvasKit", "keywords": [ "antv", diff --git a/packages/g-components/CHANGELOG.md b/packages/g-components/CHANGELOG.md index a2efa3dfa..97c0f9179 100644 --- a/packages/g-components/CHANGELOG.md +++ b/packages/g-components/CHANGELOG.md @@ -1,5 +1,12 @@ # @antv/g-components +## 2.0.15 + +### Patch Changes + +- Updated dependencies [4aa12e8c] + - @antv/g-lite@2.1.4 + ## 2.0.14 ### Patch Changes diff --git a/packages/g-components/package.json b/packages/g-components/package.json index 13bb1e281..1b9f57d84 100644 --- a/packages/g-components/package.json +++ b/packages/g-components/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-components", - "version": "2.0.14", + "version": "2.0.15", "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 ddd1c7242..511ad7a7e 100644 --- a/packages/g-dom-mutation-observer-api/CHANGELOG.md +++ b/packages/g-dom-mutation-observer-api/CHANGELOG.md @@ -1,5 +1,12 @@ # @antv/g-dom-mutation-observer-api +## 2.0.15 + +### Patch Changes + +- Updated dependencies [4aa12e8c] + - @antv/g-lite@2.1.4 + ## 2.0.14 ### Patch Changes diff --git a/packages/g-dom-mutation-observer-api/package.json b/packages/g-dom-mutation-observer-api/package.json index d590d9f40..0d9064916 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.14", + "version": "2.0.15", "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 76a72944e..65b699970 100644 --- a/packages/g-gesture/CHANGELOG.md +++ b/packages/g-gesture/CHANGELOG.md @@ -1,5 +1,12 @@ # @antv/g-gesture +## 3.0.15 + +### Patch Changes + +- Updated dependencies [4aa12e8c] + - @antv/g-lite@2.1.4 + ## 3.0.14 ### Patch Changes diff --git a/packages/g-gesture/package.json b/packages/g-gesture/package.json index 637f76b85..727f5a1d9 100644 --- a/packages/g-gesture/package.json +++ b/packages/g-gesture/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-gesture", - "version": "3.0.14", + "version": "3.0.15", "description": "G Gesture", "keywords": [ "antv", diff --git a/packages/g-image-exporter/CHANGELOG.md b/packages/g-image-exporter/CHANGELOG.md index c9e13405e..2c1ee4313 100644 --- a/packages/g-image-exporter/CHANGELOG.md +++ b/packages/g-image-exporter/CHANGELOG.md @@ -1,5 +1,12 @@ # @antv/g-image-exporter +## 1.0.15 + +### Patch Changes + +- Updated dependencies [4aa12e8c] + - @antv/g-lite@2.1.4 + ## 1.0.14 ### Patch Changes diff --git a/packages/g-image-exporter/package.json b/packages/g-image-exporter/package.json index 72bad9c18..96f4b8612 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.14", + "version": "1.0.15", "description": "A image exporter for G using DOM API", "keywords": [ "antv", diff --git a/packages/g-lite/CHANGELOG.md b/packages/g-lite/CHANGELOG.md index 7d809b8c0..cfcca2a62 100644 --- a/packages/g-lite/CHANGELOG.md +++ b/packages/g-lite/CHANGELOG.md @@ -1,5 +1,11 @@ # @antv/g-lite +## 2.1.4 + +### Patch Changes + +- 4aa12e8c: fix: `markerStartOffset`/`markerEndOffset` of the path in the svg/canvas renderer is drawn abnormally + ## 2.1.3 ### Patch Changes diff --git a/packages/g-lite/package.json b/packages/g-lite/package.json index af8862528..8a7b657c4 100644 --- a/packages/g-lite/package.json +++ b/packages/g-lite/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-lite", - "version": "2.1.3", + "version": "2.1.4", "description": "A core module for rendering engine implements DOM API.", "keywords": [ "antv", diff --git a/packages/g-lite/src/utils/path.ts b/packages/g-lite/src/utils/path.ts index ec204cb80..e5df1195d 100644 --- a/packages/g-lite/src/utils/path.ts +++ b/packages/g-lite/src/utils/path.ts @@ -959,41 +959,34 @@ export function translatePathToString( (nextSegment[0] === 'M' || nextSegment[0] === 'Z'))) && endOffsetX !== 0 && endOffsetY !== 0; + const [startOffsetXTemp, startOffsetYTemp] = useStartOffset + ? [startOffsetX, startOffsetY] + : [0, 0]; + const [endOffsetXTemp, endOffsetYTemp] = useEndOffset + ? [endOffsetX, endOffsetY] + : [0, 0]; switch (command) { case 'M': - // Use start marker offset - if (useStartOffset) { - return `M ${params[1] + startOffsetX},${ - params[2] + startOffsetY - } L ${params[1]},${params[2]}`; - } - return `M ${params[1]},${params[2]}`; + return `M ${params[1] + startOffsetXTemp},${params[2] + startOffsetYTemp}`; case 'L': - return `L ${params[1] + (useEndOffset ? endOffsetX : 0)},${ - params[2] + (useEndOffset ? endOffsetY : 0) + return `L ${params[1] + endOffsetXTemp},${ + params[2] + endOffsetYTemp }`; + case 'Q': - return `Q ${params[1]} ${params[2]},${params[3]} ${params[4]}${ - useEndOffset - ? ` L ${params[3] + endOffsetX},${params[4] + endOffsetY}` - : '' - }`; + return `Q ${params[1]} ${params[2]},${params[3] + endOffsetXTemp} ${params[4] + endOffsetYTemp}`; + case 'C': - return `C ${params[1]} ${params[2]},${params[3]} ${params[4]},${params[5]} ${params[6]}${ - useEndOffset - ? ` L ${params[5] + endOffsetX},${params[6] + endOffsetY}` - : '' - }`; + 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]} ${params[7]}${ - useEndOffset - ? ` L ${params[6] + endOffsetX},${params[7] + endOffsetY}` - : '' - }`; + return `A ${params[1]} ${params[2]} ${params[3]} ${params[4]} ${params[5]} ${params[6] + endOffsetXTemp} ${params[7] + endOffsetYTemp}`; + case 'Z': return 'Z'; + default: return null; } diff --git a/packages/g-lottie-player/CHANGELOG.md b/packages/g-lottie-player/CHANGELOG.md index 9a82b3b8d..b2eaa0f87 100644 --- a/packages/g-lottie-player/CHANGELOG.md +++ b/packages/g-lottie-player/CHANGELOG.md @@ -1,5 +1,12 @@ # @antv/g-lottie-player +## 1.0.15 + +### Patch Changes + +- Updated dependencies [4aa12e8c] + - @antv/g-lite@2.1.4 + ## 1.0.14 ### Patch Changes diff --git a/packages/g-lottie-player/package.json b/packages/g-lottie-player/package.json index 9812e811a..ffcead199 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.14", + "version": "1.0.15", "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 b418ec59c..05dc05ad1 100644 --- a/packages/g-mobile-canvas-element/CHANGELOG.md +++ b/packages/g-mobile-canvas-element/CHANGELOG.md @@ -1,5 +1,12 @@ # @antv/g-mobile-canvas-element +## 1.0.15 + +### Patch Changes + +- Updated dependencies [4aa12e8c] + - @antv/g-lite@2.1.4 + ## 1.0.14 ### Patch Changes diff --git a/packages/g-mobile-canvas-element/package.json b/packages/g-mobile-canvas-element/package.json index d4b8df663..766b988f1 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.14", + "version": "1.0.15", "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 a339c7e66..5cf273f80 100644 --- a/packages/g-mobile-canvas/CHANGELOG.md +++ b/packages/g-mobile-canvas/CHANGELOG.md @@ -1,5 +1,19 @@ # @antv/g-mobile-canvas +## 1.0.17 + +### Patch Changes + +- Updated dependencies [4aa12e8c] + - @antv/g-lite@2.1.4 + - @antv/g-plugin-canvas-path-generator@2.0.15 + - @antv/g-plugin-canvas-picker@2.0.17 + - @antv/g-plugin-canvas-renderer@2.1.4 + - @antv/g-plugin-dragndrop@2.0.15 + - @antv/g-plugin-gesture@2.0.15 + - @antv/g-plugin-image-loader@2.0.15 + - @antv/g-plugin-mobile-interaction@1.0.15 + ## 1.0.16 ### Patch Changes diff --git a/packages/g-mobile-canvas/package.json b/packages/g-mobile-canvas/package.json index 359c67a7c..7afbb02cb 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.16", + "version": "1.0.17", "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 3ce68c74e..71c92fcd6 100644 --- a/packages/g-mobile-svg/CHANGELOG.md +++ b/packages/g-mobile-svg/CHANGELOG.md @@ -1,5 +1,17 @@ # @antv/g-mobile-svg +## 1.0.17 + +### Patch Changes + +- Updated dependencies [4aa12e8c] + - @antv/g-lite@2.1.4 + - @antv/g-plugin-dragndrop@2.0.15 + - @antv/g-plugin-gesture@2.0.15 + - @antv/g-plugin-mobile-interaction@1.0.15 + - @antv/g-plugin-svg-picker@2.0.17 + - @antv/g-plugin-svg-renderer@2.1.4 + ## 1.0.16 ### Patch Changes diff --git a/packages/g-mobile-svg/package.json b/packages/g-mobile-svg/package.json index 03eb8ed63..530a7bcff 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.16", + "version": "1.0.17", "description": "A renderer implemented by SVG in mobile environment", "keywords": [ "antv", diff --git a/packages/g-mobile-webgl/CHANGELOG.md b/packages/g-mobile-webgl/CHANGELOG.md index de7931a39..2f067f86f 100644 --- a/packages/g-mobile-webgl/CHANGELOG.md +++ b/packages/g-mobile-webgl/CHANGELOG.md @@ -1,5 +1,18 @@ # @antv/g-mobile-webgl +## 1.0.24 + +### Patch Changes + +- Updated dependencies [4aa12e8c] + - @antv/g-lite@2.1.4 + - @antv/g-plugin-device-renderer@2.1.4 + - @antv/g-plugin-dragndrop@2.0.15 + - @antv/g-plugin-gesture@2.0.15 + - @antv/g-plugin-html-renderer@2.1.4 + - @antv/g-plugin-image-loader@2.0.15 + - @antv/g-plugin-mobile-interaction@1.0.15 + ## 1.0.23 ### Patch Changes diff --git a/packages/g-mobile-webgl/package.json b/packages/g-mobile-webgl/package.json index ec46acb5e..a349c81f3 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.23", + "version": "1.0.24", "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 1c80ef2d8..1fd135f0c 100644 --- a/packages/g-pattern/CHANGELOG.md +++ b/packages/g-pattern/CHANGELOG.md @@ -1,5 +1,12 @@ # @antv/g-pattern +## 2.0.15 + +### Patch Changes + +- Updated dependencies [4aa12e8c] + - @antv/g-lite@2.1.4 + ## 2.0.14 ### Patch Changes diff --git a/packages/g-pattern/package.json b/packages/g-pattern/package.json index bb73a9fef..89653789d 100644 --- a/packages/g-pattern/package.json +++ b/packages/g-pattern/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-pattern", - "version": "2.0.14", + "version": "2.0.15", "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 dee496c53..891415daa 100644 --- a/packages/g-plugin-3d/CHANGELOG.md +++ b/packages/g-plugin-3d/CHANGELOG.md @@ -1,5 +1,13 @@ # @antv/g-plugin-3d +## 2.0.22 + +### Patch Changes + +- Updated dependencies [4aa12e8c] + - @antv/g-lite@2.1.4 + - @antv/g-plugin-device-renderer@2.1.4 + ## 2.0.21 ### Patch Changes diff --git a/packages/g-plugin-3d/package.json b/packages/g-plugin-3d/package.json index b72cea823..837eb8c7a 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.21", + "version": "2.0.22", "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 e0a878ee3..842ea0990 100644 --- a/packages/g-plugin-a11y/CHANGELOG.md +++ b/packages/g-plugin-a11y/CHANGELOG.md @@ -1,5 +1,12 @@ # @antv/g-plugin-a11y +## 1.1.4 + +### Patch Changes + +- Updated dependencies [4aa12e8c] + - @antv/g-lite@2.1.4 + ## 1.1.3 ### Patch Changes diff --git a/packages/g-plugin-a11y/package.json b/packages/g-plugin-a11y/package.json index a2872e9eb..d80529dfd 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.3", + "version": "1.1.4", "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 7339f3bc8..904dc5b83 100644 --- a/packages/g-plugin-annotation/CHANGELOG.md +++ b/packages/g-plugin-annotation/CHANGELOG.md @@ -1,5 +1,12 @@ # @antv/g-plugin-annotation +## 1.0.15 + +### Patch Changes + +- Updated dependencies [4aa12e8c] + - @antv/g-lite@2.1.4 + ## 1.0.14 ### Patch Changes diff --git a/packages/g-plugin-annotation/package.json b/packages/g-plugin-annotation/package.json index f117cd39c..1b335cacf 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.14", + "version": "1.0.15", "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 2e374a95c..b72b04860 100644 --- a/packages/g-plugin-box2d/CHANGELOG.md +++ b/packages/g-plugin-box2d/CHANGELOG.md @@ -1,5 +1,12 @@ # @antv/g-plugin-box2d +## 2.0.15 + +### Patch Changes + +- Updated dependencies [4aa12e8c] + - @antv/g-lite@2.1.4 + ## 2.0.14 ### Patch Changes diff --git a/packages/g-plugin-box2d/package.json b/packages/g-plugin-box2d/package.json index 5b366fe2e..332f7ad3f 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.14", + "version": "2.0.15", "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 8eda9d873..6ca5d303d 100644 --- a/packages/g-plugin-canvas-path-generator/CHANGELOG.md +++ b/packages/g-plugin-canvas-path-generator/CHANGELOG.md @@ -1,5 +1,13 @@ # @antv/g-plugin-canvas-path-generator +## 2.0.15 + +### Patch Changes + +- 4aa12e8c: fix: `markerStartOffset`/`markerEndOffset` of the path in the svg/canvas renderer is drawn abnormally +- Updated dependencies [4aa12e8c] + - @antv/g-lite@2.1.4 + ## 2.0.14 ### Patch Changes diff --git a/packages/g-plugin-canvas-path-generator/package.json b/packages/g-plugin-canvas-path-generator/package.json index 13d5a8523..72d6266af 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.0.14", + "version": "2.0.15", "description": "A G plugin of path generator with Canvas2D API", "keywords": [ "antv", diff --git a/packages/g-plugin-canvas-path-generator/src/paths/Path.ts b/packages/g-plugin-canvas-path-generator/src/paths/Path.ts index a5800a62c..2c9898d2f 100644 --- a/packages/g-plugin-canvas-path-generator/src/paths/Path.ts +++ b/packages/g-plugin-canvas-path-generator/src/paths/Path.ts @@ -48,28 +48,31 @@ export function generatePath( (nextSegment && (nextSegment[0] === 'M' || nextSegment[0] === 'Z'))) && endOffsetX !== 0 && endOffsetY !== 0; + const [startOffsetXTemp, startOffsetYTemp] = useStartOffset + ? [startOffsetX, startOffsetY] + : [0, 0]; + const [endOffsetXTemp, endOffsetYTemp] = useEndOffset + ? [endOffsetX, endOffsetY] + : [0, 0]; switch (command) { case 'M': // Use start marker offset - if (useStartOffset) { - context.moveTo(params[1] + startOffsetX, params[2] + startOffsetY); - } else { - context.moveTo(params[1], params[2]); - } + context.moveTo( + params[1] + startOffsetXTemp, + params[2] + startOffsetYTemp, + ); break; case 'L': - if (useEndOffset) { - context.lineTo(params[1] + endOffsetX, params[2] + endOffsetY); - } else { - context.lineTo(params[1], params[2]); - } + context.lineTo(params[1] + endOffsetXTemp, params[2] + endOffsetYTemp); break; case 'Q': - context.quadraticCurveTo(params[1], params[2], params[3], params[4]); - if (useEndOffset) { - context.lineTo(params[3] + endOffsetX, params[4] + endOffsetY); - } + context.quadraticCurveTo( + params[1], + params[2], + params[3] + endOffsetXTemp, + params[4] + endOffsetYTemp, + ); break; case 'C': context.bezierCurveTo( @@ -77,14 +80,12 @@ export function generatePath( params[2], params[3], params[4], - params[5], - params[6], + params[5] + endOffsetXTemp, + params[6] + endOffsetYTemp, ); - if (useEndOffset) { - context.lineTo(params[5] + endOffsetX, params[6] + endOffsetY); - } break; case 'A': { + // FIXME startOffset / endOffset const { arcParams } = segments[i]; const { cx, cy, rx, ry, startAngle, endAngle, xRotation, sweepFlag } = arcParams; diff --git a/packages/g-plugin-canvas-picker/CHANGELOG.md b/packages/g-plugin-canvas-picker/CHANGELOG.md index d9b554a17..db01a0fe4 100644 --- a/packages/g-plugin-canvas-picker/CHANGELOG.md +++ b/packages/g-plugin-canvas-picker/CHANGELOG.md @@ -1,5 +1,14 @@ # @antv/g-plugin-canvas-picker +## 2.0.17 + +### Patch Changes + +- Updated dependencies [4aa12e8c] + - @antv/g-lite@2.1.4 + - @antv/g-plugin-canvas-path-generator@2.0.15 + - @antv/g-plugin-canvas-renderer@2.1.4 + ## 2.0.16 ### Patch Changes diff --git a/packages/g-plugin-canvas-picker/package.json b/packages/g-plugin-canvas-picker/package.json index f9a6a9f76..f1bc40208 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.0.16", + "version": "2.0.17", "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 c59cbdfef..7f59a4ec8 100644 --- a/packages/g-plugin-canvas-renderer/CHANGELOG.md +++ b/packages/g-plugin-canvas-renderer/CHANGELOG.md @@ -1,5 +1,14 @@ # @antv/g-plugin-canvas-renderer +## 2.1.4 + +### Patch Changes + +- Updated dependencies [4aa12e8c] + - @antv/g-lite@2.1.4 + - @antv/g-plugin-canvas-path-generator@2.0.15 + - @antv/g-plugin-image-loader@2.0.15 + ## 2.1.3 ### Patch Changes diff --git a/packages/g-plugin-canvas-renderer/package.json b/packages/g-plugin-canvas-renderer/package.json index 809647f29..3d97c1b61 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.1.3", + "version": "2.1.4", "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 74e1c7fb9..222a4e154 100644 --- a/packages/g-plugin-canvaskit-renderer/CHANGELOG.md +++ b/packages/g-plugin-canvaskit-renderer/CHANGELOG.md @@ -1,5 +1,13 @@ # @antv/g-plugin-canvaskit-renderer +## 2.0.16 + +### Patch Changes + +- Updated dependencies [4aa12e8c] + - @antv/g-lite@2.1.4 + - @antv/g-plugin-image-loader@2.0.15 + ## 2.0.15 ### Patch Changes diff --git a/packages/g-plugin-canvaskit-renderer/package.json b/packages/g-plugin-canvaskit-renderer/package.json index 666e6cbf9..1a196dbe7 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.0.15", + "version": "2.0.16", "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 9443f6872..1e6202d25 100644 --- a/packages/g-plugin-control/CHANGELOG.md +++ b/packages/g-plugin-control/CHANGELOG.md @@ -1,5 +1,12 @@ # @antv/g-plugin-control +## 2.0.15 + +### Patch Changes + +- Updated dependencies [4aa12e8c] + - @antv/g-lite@2.1.4 + ## 2.0.14 ### Patch Changes diff --git a/packages/g-plugin-control/package.json b/packages/g-plugin-control/package.json index e9e1bf0e5..452a059ef 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.14", + "version": "2.0.15", "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 35c3f9d55..838ca20e7 100644 --- a/packages/g-plugin-css-select/CHANGELOG.md +++ b/packages/g-plugin-css-select/CHANGELOG.md @@ -1,5 +1,12 @@ # @antv/g-plugin-css-select +## 2.0.15 + +### Patch Changes + +- Updated dependencies [4aa12e8c] + - @antv/g-lite@2.1.4 + ## 2.0.14 ### Patch Changes diff --git a/packages/g-plugin-css-select/package.json b/packages/g-plugin-css-select/package.json index b45880334..b485061d5 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.14", + "version": "2.0.15", "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 7280fbb07..8d9ea8d7c 100644 --- a/packages/g-plugin-device-renderer/CHANGELOG.md +++ b/packages/g-plugin-device-renderer/CHANGELOG.md @@ -1,5 +1,13 @@ # @antv/g-plugin-device-renderer +## 2.1.4 + +### Patch Changes + +- Updated dependencies [4aa12e8c] + - @antv/g-lite@2.1.4 + - @antv/g-plugin-image-loader@2.0.15 + ## 2.1.3 ### Patch Changes diff --git a/packages/g-plugin-device-renderer/package.json b/packages/g-plugin-device-renderer/package.json index 9661fa491..1eea50f79 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.1.3", + "version": "2.1.4", "description": "A G plugin of renderer implementation with GPUDevice", "keywords": [ "antv", diff --git a/packages/g-plugin-dom-interaction/CHANGELOG.md b/packages/g-plugin-dom-interaction/CHANGELOG.md index 9eaef0e5a..e7b0a3eb3 100644 --- a/packages/g-plugin-dom-interaction/CHANGELOG.md +++ b/packages/g-plugin-dom-interaction/CHANGELOG.md @@ -1,5 +1,12 @@ # @antv/g-plugin-dom-interaction +## 2.1.4 + +### Patch Changes + +- Updated dependencies [4aa12e8c] + - @antv/g-lite@2.1.4 + ## 2.1.3 ### Patch Changes diff --git a/packages/g-plugin-dom-interaction/package.json b/packages/g-plugin-dom-interaction/package.json index 2b211a53c..87e99bc09 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.3", + "version": "2.1.4", "description": "A G plugin", "keywords": [ "antv", diff --git a/packages/g-plugin-dragndrop/CHANGELOG.md b/packages/g-plugin-dragndrop/CHANGELOG.md index 205cafe83..0f8d19f35 100644 --- a/packages/g-plugin-dragndrop/CHANGELOG.md +++ b/packages/g-plugin-dragndrop/CHANGELOG.md @@ -1,5 +1,12 @@ # @antv/g-plugin-dragndrop +## 2.0.15 + +### Patch Changes + +- Updated dependencies [4aa12e8c] + - @antv/g-lite@2.1.4 + ## 2.0.14 ### Patch Changes diff --git a/packages/g-plugin-dragndrop/package.json b/packages/g-plugin-dragndrop/package.json index 6b18a0501..548302aa4 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.14", + "version": "2.0.15", "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 cd4ae26aa..808796eff 100644 --- a/packages/g-plugin-gesture/CHANGELOG.md +++ b/packages/g-plugin-gesture/CHANGELOG.md @@ -1,5 +1,12 @@ # @antv/g-plugin-gesture +## 2.0.15 + +### Patch Changes + +- Updated dependencies [4aa12e8c] + - @antv/g-lite@2.1.4 + ## 2.0.14 ### Patch Changes diff --git a/packages/g-plugin-gesture/package.json b/packages/g-plugin-gesture/package.json index 7614c645c..5e39d01ef 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.14", + "version": "2.0.15", "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 5c2614c25..9acf755cb 100644 --- a/packages/g-plugin-html-renderer/CHANGELOG.md +++ b/packages/g-plugin-html-renderer/CHANGELOG.md @@ -1,5 +1,12 @@ # @antv/g-plugin-html-renderer +## 2.1.4 + +### Patch Changes + +- Updated dependencies [4aa12e8c] + - @antv/g-lite@2.1.4 + ## 2.1.3 ### Patch Changes diff --git a/packages/g-plugin-html-renderer/package.json b/packages/g-plugin-html-renderer/package.json index 3029bcd4f..7e5088058 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.3", + "version": "2.1.4", "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 b2ae529f4..17fa78692 100644 --- a/packages/g-plugin-image-loader/CHANGELOG.md +++ b/packages/g-plugin-image-loader/CHANGELOG.md @@ -1,5 +1,12 @@ # @antv/g-plugin-image-loader +## 2.0.15 + +### Patch Changes + +- Updated dependencies [4aa12e8c] + - @antv/g-lite@2.1.4 + ## 2.0.14 ### Patch Changes diff --git a/packages/g-plugin-image-loader/package.json b/packages/g-plugin-image-loader/package.json index 16df5666b..165fc718d 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.0.14", + "version": "2.0.15", "description": "A G plugin for loading image", "keywords": [ "antv", diff --git a/packages/g-plugin-matterjs/CHANGELOG.md b/packages/g-plugin-matterjs/CHANGELOG.md index 11ec5f408..70dff758f 100644 --- a/packages/g-plugin-matterjs/CHANGELOG.md +++ b/packages/g-plugin-matterjs/CHANGELOG.md @@ -1,5 +1,12 @@ # @antv/g-plugin-matterjs +## 2.0.15 + +### Patch Changes + +- Updated dependencies [4aa12e8c] + - @antv/g-lite@2.1.4 + ## 2.0.14 ### Patch Changes diff --git a/packages/g-plugin-matterjs/package.json b/packages/g-plugin-matterjs/package.json index 00d15f29b..885298189 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.14", + "version": "2.0.15", "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 827df7e0d..260a564fe 100644 --- a/packages/g-plugin-mobile-interaction/CHANGELOG.md +++ b/packages/g-plugin-mobile-interaction/CHANGELOG.md @@ -1,5 +1,12 @@ # @antv/g-plugin-mobile-interaction +## 1.0.15 + +### Patch Changes + +- Updated dependencies [4aa12e8c] + - @antv/g-lite@2.1.4 + ## 1.0.14 ### Patch Changes diff --git a/packages/g-plugin-mobile-interaction/package.json b/packages/g-plugin-mobile-interaction/package.json index b4b7ac2a4..83b864135 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.14", + "version": "1.0.15", "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 e966d9924..4f1a46650 100644 --- a/packages/g-plugin-physx/CHANGELOG.md +++ b/packages/g-plugin-physx/CHANGELOG.md @@ -1,5 +1,12 @@ # @antv/g-plugin-physx +## 2.0.15 + +### Patch Changes + +- Updated dependencies [4aa12e8c] + - @antv/g-lite@2.1.4 + ## 2.0.14 ### Patch Changes diff --git a/packages/g-plugin-physx/package.json b/packages/g-plugin-physx/package.json index 568b73d7a..f359f53ab 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.14", + "version": "2.0.15", "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 d5418dce3..efc816bc8 100644 --- a/packages/g-plugin-rough-canvas-renderer/CHANGELOG.md +++ b/packages/g-plugin-rough-canvas-renderer/CHANGELOG.md @@ -1,5 +1,13 @@ # @antv/g-plugin-rough-canvas-renderer +## 2.0.20 + +### Patch Changes + +- Updated dependencies [4aa12e8c] + - @antv/g-lite@2.1.4 + - @antv/g-canvas@2.0.20 + ## 2.0.19 ### Patch Changes diff --git a/packages/g-plugin-rough-canvas-renderer/package.json b/packages/g-plugin-rough-canvas-renderer/package.json index 63bcd7ad6..e9fb8a270 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.19", + "version": "2.0.20", "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 847901838..8513d5664 100644 --- a/packages/g-plugin-rough-svg-renderer/CHANGELOG.md +++ b/packages/g-plugin-rough-svg-renderer/CHANGELOG.md @@ -1,5 +1,13 @@ # @antv/g-plugin-rough-svg-renderer +## 2.0.18 + +### Patch Changes + +- Updated dependencies [4aa12e8c] + - @antv/g-lite@2.1.4 + - @antv/g-svg@2.0.17 + ## 2.0.17 ### Patch Changes diff --git a/packages/g-plugin-rough-svg-renderer/package.json b/packages/g-plugin-rough-svg-renderer/package.json index 9307aa5c4..00b4a8378 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.17", + "version": "2.0.18", "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 51382e8bb..2063c5ff3 100644 --- a/packages/g-plugin-svg-picker/CHANGELOG.md +++ b/packages/g-plugin-svg-picker/CHANGELOG.md @@ -1,5 +1,13 @@ # @antv/g-plugin-svg-picker +## 2.0.17 + +### Patch Changes + +- Updated dependencies [4aa12e8c] + - @antv/g-lite@2.1.4 + - @antv/g-plugin-svg-renderer@2.1.4 + ## 2.0.16 ### Patch Changes diff --git a/packages/g-plugin-svg-picker/package.json b/packages/g-plugin-svg-picker/package.json index 2ce9b0df4..8d3a1cdba 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.16", + "version": "2.0.17", "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 cfd3b96d7..ccd623ca8 100644 --- a/packages/g-plugin-svg-renderer/CHANGELOG.md +++ b/packages/g-plugin-svg-renderer/CHANGELOG.md @@ -1,5 +1,12 @@ # @antv/g-plugin-svg-renderer +## 2.1.4 + +### Patch Changes + +- Updated dependencies [4aa12e8c] + - @antv/g-lite@2.1.4 + ## 2.1.3 ### Patch Changes diff --git a/packages/g-plugin-svg-renderer/package.json b/packages/g-plugin-svg-renderer/package.json index 50aedb28c..df3d52bcf 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.1.3", + "version": "2.1.4", "description": "A G plugin of renderer implementation with SVG", "keywords": [ "antv", diff --git a/packages/g-plugin-yoga/CHANGELOG.md b/packages/g-plugin-yoga/CHANGELOG.md index ecc742928..0bb2c01f1 100644 --- a/packages/g-plugin-yoga/CHANGELOG.md +++ b/packages/g-plugin-yoga/CHANGELOG.md @@ -1,5 +1,12 @@ # @antv/g-plugin-yoga +## 2.0.15 + +### Patch Changes + +- Updated dependencies [4aa12e8c] + - @antv/g-lite@2.1.4 + ## 2.0.14 ### Patch Changes diff --git a/packages/g-plugin-yoga/package.json b/packages/g-plugin-yoga/package.json index 409af6a6e..3fe42f3ea 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.14", + "version": "2.0.15", "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 b4740ed3e..3f49a9c75 100644 --- a/packages/g-plugin-zdog-canvas-renderer/CHANGELOG.md +++ b/packages/g-plugin-zdog-canvas-renderer/CHANGELOG.md @@ -1,5 +1,13 @@ # @antv/g-plugin-zdog-canvas-renderer +## 2.0.19 + +### Patch Changes + +- Updated dependencies [4aa12e8c] + - @antv/g-lite@2.1.4 + - @antv/g-canvas@2.0.20 + ## 2.0.18 ### Patch Changes diff --git a/packages/g-plugin-zdog-canvas-renderer/package.json b/packages/g-plugin-zdog-canvas-renderer/package.json index 278bacaa9..8aa7dd50e 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.18", + "version": "2.0.19", "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 6312ab9e8..de12e6d71 100644 --- a/packages/g-plugin-zdog-svg-renderer/CHANGELOG.md +++ b/packages/g-plugin-zdog-svg-renderer/CHANGELOG.md @@ -1,5 +1,14 @@ # @antv/g-plugin-zdog-svg-renderer +## 2.0.17 + +### Patch Changes + +- Updated dependencies [4aa12e8c] + - @antv/g-lite@2.1.4 + - @antv/g-plugin-svg-renderer@2.1.4 + - @antv/g-svg@2.0.17 + ## 2.0.16 ### Patch Changes diff --git a/packages/g-plugin-zdog-svg-renderer/package.json b/packages/g-plugin-zdog-svg-renderer/package.json index 24ea3522b..a4596e899 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.16", + "version": "2.0.17", "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 d61f8f37e..d0c7ed39e 100644 --- a/packages/g-svg/CHANGELOG.md +++ b/packages/g-svg/CHANGELOG.md @@ -1,5 +1,15 @@ # @antv/g-svg +## 2.0.17 + +### Patch Changes + +- Updated dependencies [4aa12e8c] + - @antv/g-lite@2.1.4 + - @antv/g-plugin-dom-interaction@2.1.4 + - @antv/g-plugin-svg-picker@2.0.17 + - @antv/g-plugin-svg-renderer@2.1.4 + ## 2.0.16 ### Patch Changes diff --git a/packages/g-svg/package.json b/packages/g-svg/package.json index ad9f0a0e9..3cdd3b1b5 100644 --- a/packages/g-svg/package.json +++ b/packages/g-svg/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-svg", - "version": "2.0.16", + "version": "2.0.17", "description": "A renderer implemented by SVG", "keywords": [ "antv", diff --git a/packages/g-web-animations-api/CHANGELOG.md b/packages/g-web-animations-api/CHANGELOG.md index dd8bb88e2..e9ca11642 100644 --- a/packages/g-web-animations-api/CHANGELOG.md +++ b/packages/g-web-animations-api/CHANGELOG.md @@ -1,5 +1,12 @@ # @antv/g-web-animations-api +## 2.1.4 + +### Patch Changes + +- Updated dependencies [4aa12e8c] + - @antv/g-lite@2.1.4 + ## 2.1.3 ### Patch Changes diff --git a/packages/g-web-animations-api/package.json b/packages/g-web-animations-api/package.json index 9a995f8e1..c4aff5ea7 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.3", + "version": "2.1.4", "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 4e3889c81..361bec4e7 100644 --- a/packages/g-web-components/CHANGELOG.md +++ b/packages/g-web-components/CHANGELOG.md @@ -1,5 +1,14 @@ # @antv/g-web-components +## 2.0.25 + +### Patch Changes + +- Updated dependencies [4aa12e8c] + - @antv/g-lite@2.1.4 + - @antv/g-canvas@2.0.20 + - @antv/g-webgl@2.0.24 + ## 2.0.24 ### Patch Changes diff --git a/packages/g-web-components/package.json b/packages/g-web-components/package.json index 03ea48a78..5e2da87ab 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.24", + "version": "2.0.25", "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 534e5eb0a..9d23cca57 100644 --- a/packages/g-webgl/CHANGELOG.md +++ b/packages/g-webgl/CHANGELOG.md @@ -1,5 +1,16 @@ # @antv/g-webgl +## 2.0.24 + +### Patch Changes + +- Updated dependencies [4aa12e8c] + - @antv/g-lite@2.1.4 + - @antv/g-plugin-device-renderer@2.1.4 + - @antv/g-plugin-dom-interaction@2.1.4 + - @antv/g-plugin-html-renderer@2.1.4 + - @antv/g-plugin-image-loader@2.0.15 + ## 2.0.23 ### Patch Changes diff --git a/packages/g-webgl/package.json b/packages/g-webgl/package.json index 0540c280c..48e1da24b 100644 --- a/packages/g-webgl/package.json +++ b/packages/g-webgl/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-webgl", - "version": "2.0.23", + "version": "2.0.24", "description": "A renderer implemented by WebGL1/2", "keywords": [ "antv", diff --git a/packages/g-webgpu/CHANGELOG.md b/packages/g-webgpu/CHANGELOG.md index 4162f1235..e5fe27f76 100644 --- a/packages/g-webgpu/CHANGELOG.md +++ b/packages/g-webgpu/CHANGELOG.md @@ -1,5 +1,16 @@ # @antv/g-webgpu +## 2.0.24 + +### Patch Changes + +- Updated dependencies [4aa12e8c] + - @antv/g-lite@2.1.4 + - @antv/g-plugin-device-renderer@2.1.4 + - @antv/g-plugin-dom-interaction@2.1.4 + - @antv/g-plugin-html-renderer@2.1.4 + - @antv/g-plugin-image-loader@2.0.15 + ## 2.0.23 ### Patch Changes diff --git a/packages/g-webgpu/package.json b/packages/g-webgpu/package.json index 1e9f135fd..789e16dc3 100644 --- a/packages/g-webgpu/package.json +++ b/packages/g-webgpu/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-webgpu", - "version": "2.0.23", + "version": "2.0.24", "description": "A renderer implemented by WebGPU", "keywords": [ "antv", diff --git a/packages/g/CHANGELOG.md b/packages/g/CHANGELOG.md index fcbe0fb49..637de3a57 100644 --- a/packages/g/CHANGELOG.md +++ b/packages/g/CHANGELOG.md @@ -1,5 +1,15 @@ # @antv/g +## 6.1.4 + +### Patch Changes + +- Updated dependencies [4aa12e8c] + - @antv/g-lite@2.1.4 + - @antv/g-camera-api@2.0.18 + - @antv/g-dom-mutation-observer-api@2.0.15 + - @antv/g-web-animations-api@2.1.4 + ## 6.1.3 ### Patch Changes diff --git a/packages/g/package.json b/packages/g/package.json index 6ef3379b0..42b512d7e 100644 --- a/packages/g/package.json +++ b/packages/g/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g", - "version": "6.1.3", + "version": "6.1.4", "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 3d499e04c..da737cbd0 100644 --- a/packages/react-g/CHANGELOG.md +++ b/packages/react-g/CHANGELOG.md @@ -1,5 +1,11 @@ # @antv/react-g +## 2.0.20 + +### Patch Changes + +- @antv/g@6.1.4 + ## 2.0.19 ### Patch Changes diff --git a/packages/react-g/package.json b/packages/react-g/package.json index 66863b30e..06e4f92cb 100644 --- a/packages/react-g/package.json +++ b/packages/react-g/package.json @@ -1,6 +1,6 @@ { "name": "@antv/react-g", - "version": "2.0.19", + "version": "2.0.20", "description": "react render for @antv/g", "keywords": [ "react", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9d6834900..f9c0d67a0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -169,7 +169,7 @@ importers: version: 5.3.0 playwright: specifier: latest - version: 1.48.0 + version: 1.48.2 pngjs: specifier: ^6.0.0 version: 6.0.0 @@ -200,6 +200,9 @@ importers: sinon: specifier: ^11.1.2 version: 11.1.2 + stats.js: + specifier: ^0.17.0 + version: 0.17.0 ts-jest: specifier: ^29.1.1 version: 29.1.1(@babel/core@7.25.2)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.25.2))(jest@29.7.0(@types/node@16.18.64)(ts-node@10.9.2(@types/node@16.18.64)(typescript@5.6.2)))(typescript@5.6.2) @@ -4131,6 +4134,7 @@ packages: eslint@8.57.1: resolution: {integrity: sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + deprecated: This version is no longer supported. Please see https://eslint.org/version-support for other options. hasBin: true espree@9.6.1: @@ -5983,13 +5987,13 @@ packages: resolution: {integrity: sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==} engines: {node: '>=8'} - playwright-core@1.48.0: - resolution: {integrity: sha512-RBvzjM9rdpP7UUFrQzRwR8L/xR4HyC1QXMzGYTbf1vjw25/ya9NRAVnXi/0fvFopjebvyPzsmoK58xxeEOaVvA==} + playwright-core@1.48.2: + resolution: {integrity: sha512-sjjw+qrLFlriJo64du+EK0kJgZzoQPsabGF4lBvsid+3CNIZIYLgnMj9V6JY5VhM2Peh20DJWIVpVljLLnlawA==} engines: {node: '>=18'} hasBin: true - playwright@1.48.0: - resolution: {integrity: sha512-qPqFaMEHuY/ug8o0uteYJSRfMGFikhUysk8ZvAtfKmUK3kc/6oNl/y3EczF8OFGYIi/Ex2HspMfzYArk6+XQSA==} + playwright@1.48.2: + resolution: {integrity: sha512-NjYvYgp4BPmiwfe31j4gHLa3J7bD2WiBz8Lk2RoSsmX38SVIARZ18VYjxLjAcDsAhA+F4iSEXTSGgjua0rrlgQ==} engines: {node: '>=18'} hasBin: true @@ -6633,6 +6637,9 @@ packages: static-eval@2.1.0: resolution: {integrity: sha512-agtxZ/kWSsCkI5E4QifRwsaPs0P0JmZV6dkLz6ILYfFYQGn+5plctanRN+IC8dJRiFkyXHrwEE3W9Wmx67uDbw==} + stats.js@0.17.0: + resolution: {integrity: sha512-hNKz8phvYLPEcRkeG1rsGmV5ChMjKDAWU7/OJJdDErPBNChQXxCo3WZurGpnWc6gZhAzEPFad1aVgyOANH1sMw==} + stealthy-require@1.1.1: resolution: {integrity: sha512-ZnWpYnYugiOVEY5GkcuJK1io5V8QmNYChG62gSit9pQVGErXtrKuPC55ITaVSukmMta5qpMU7vqLt2Lnni4f/g==} engines: {node: '>=0.10.0'} @@ -13096,11 +13103,11 @@ snapshots: dependencies: find-up: 4.1.0 - playwright-core@1.48.0: {} + playwright-core@1.48.2: {} - playwright@1.48.0: + playwright@1.48.2: dependencies: - playwright-core: 1.48.0 + playwright-core: 1.48.2 optionalDependencies: fsevents: 2.3.2 @@ -13818,6 +13825,8 @@ snapshots: dependencies: escodegen: 1.14.3 + stats.js@0.17.0: {} + stealthy-require@1.1.1: {} stop-iteration-iterator@1.0.0: diff --git a/site/docs/api/basic/image.en.md b/site/docs/api/basic/image.en.md index 6421859a2..aa9b60348 100644 --- a/site/docs/api/basic/image.en.md +++ b/site/docs/api/basic/image.en.md @@ -14,7 +14,7 @@ const image = new Image({ y: 100, width: 200, height: 200, - img: 'https://gw.alipayobjects.com/mdn/rms_6ae20b/afts/img/A*N4ZMS7gHsUIAAAAAAAAAAABkARQnAQ', + src: 'https://gw.alipayobjects.com/mdn/rms_6ae20b/afts/img/A*N4ZMS7gHsUIAAAAAAAAAAABkARQnAQ', }, }); ``` @@ -30,6 +30,12 @@ const image = new Image({ }); ``` +:::warning{title=Large-size-image} + +If you encounter performance issues with large images, try turning on the [`enableLargeImageOptimization`](../canvas/options.en.md#enablelargeimageoptimization) configuration. + +::: + ## Inherited from Inherits [style property](/en/api/basic/display-object#drawing-properties) from [DisplayObject](/en/api/basic/display-object). @@ -50,9 +56,9 @@ The x-axis coordinates of the top-left vertex of the image in the local coordina -| [Initial value](/en/api/css/css-properties-values-api#initial-value) | Applicable elements | [Inheritable](/en/api/css/inheritance) | Animatable | [Computed value](/en/api/css/css-properties-values-api#computed-value) | -| -------------------------------------------------------------------- | ------------------- | -------------------------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------- | -| '0' | - | no | yes | [\](/en/api/css/css-properties-values-api#percentage) [\](/en/api/css/css-properties-values-api#length) | +| [Initial value](/en/api/css/css-properties-values-api#initial-value) | Applicable elements | [Inheritable](/en/api/css/inheritance) | Animatable | [Computed value](/en/api/css/css-properties-values-api#computed-value) | +| --- | --- | --- | --- | --- | +| '0' | - | no | yes | [\](/en/api/css/css-properties-values-api#percentage) [\](/en/api/css/css-properties-values-api#length) | ### y @@ -60,22 +66,25 @@ The y-axis coordinates of the top-left vertex of the image in the local coordina -| [Initial value](/en/api/css/css-properties-values-api#initial-value) | Applicable elements | [Inheritable](/en/api/css/inheritance) | Animatable | [Computed value](/en/api/css/css-properties-values-api#computed-value) | -| -------------------------------------------------------------------- | ------------------- | -------------------------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------- | -| '0' | - | no | yes | [\](/en/api/css/css-properties-values-api#percentage) [\](/en/api/css/css-properties-values-api#length) | +| [Initial value](/en/api/css/css-properties-values-api#initial-value) | Applicable elements | [Inheritable](/en/api/css/inheritance) | Animatable | [Computed value](/en/api/css/css-properties-values-api#computed-value) | +| --- | --- | --- | --- | --- | +| '0' | - | no | yes | [\](/en/api/css/css-properties-values-api#percentage) [\](/en/api/css/css-properties-values-api#length) | -### img +### src Image sources, supports the following types: -- Image address string, displayed after successful loading -- Create your own [Image](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/Image) object to create a G Image in the `onload` callback, as shown in the following example. +- `string` Image address string, displayed after successful loading +- `HTMLImageElement` Create your own [Image](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/Image) object to create a G Image in the `onload` callback, as shown in the following example. + +
```js import { Image as GImage, Canvas } from '@antv/g'; let image; const img = new Image(); + img.src = 'https://gw.alipayobjects.com/mdn/rms_6ae20b/afts/img/A*N4ZMS7gHsUIAAAAAAAAAAABkARQnAQ'; img.crossOrigin = 'Anonymous'; @@ -86,26 +95,22 @@ img.onload = () => { y: 100, width: 200, height: 200, - img, + src: img, }, }); canvas.appendChild(image); }; ``` -### src - -This attribute is an alias for [img](/en/api/basic/image). - ### width Image width. -| [Initial value](/en/api/css/css-properties-values-api#initial-value) | Applicable elements | [Inheritable](/en/api/css/inheritance) | Animatable | [Computed value](/en/api/css/css-properties-values-api#computed-value) | -| -------------------------------------------------------------------- | ------------------- | -------------------------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------- | -| '0' | - | no | yes | [\](/en/api/css/css-properties-values-api#percentage) [\](/en/api/css/css-properties-values-api#length) | +| [Initial value](/en/api/css/css-properties-values-api#initial-value) | Applicable elements | [Inheritable](/en/api/css/inheritance) | Animatable | [Computed value](/en/api/css/css-properties-values-api#computed-value) | +| --- | --- | --- | --- | --- | +| '0' | - | no | yes | [\](/en/api/css/css-properties-values-api#percentage) [\](/en/api/css/css-properties-values-api#length) | ### height @@ -113,9 +118,9 @@ Image height. -| [Initial value](/en/api/css/css-properties-values-api#initial-value) | Applicable elements | [Inheritable](/en/api/css/inheritance) | Animatable | [Computed value](/en/api/css/css-properties-values-api#computed-value) | -| -------------------------------------------------------------------- | ------------------- | -------------------------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------- | -| '0' | - | no | yes | [\](/en/api/css/css-properties-values-api#percentage) [\](/en/api/css/css-properties-values-api#length) | +| [Initial value](/en/api/css/css-properties-values-api#initial-value) | Applicable elements | [Inheritable](/en/api/css/inheritance) | Animatable | [Computed value](/en/api/css/css-properties-values-api#computed-value) | +| --- | --- | --- | --- | --- | +| '0' | - | no | yes | [\](/en/api/css/css-properties-values-api#percentage) [\](/en/api/css/css-properties-values-api#length) | ### keepAspectRatio diff --git a/site/docs/api/basic/image.zh.md b/site/docs/api/basic/image.zh.md index eb01c495f..c87300ca7 100644 --- a/site/docs/api/basic/image.zh.md +++ b/site/docs/api/basic/image.zh.md @@ -14,7 +14,7 @@ const image = new Image({ y: 100, width: 200, height: 200, - img: 'https://gw.alipayobjects.com/mdn/rms_6ae20b/afts/img/A*N4ZMS7gHsUIAAAAAAAAAAABkARQnAQ', + src: 'https://gw.alipayobjects.com/mdn/rms_6ae20b/afts/img/A*N4ZMS7gHsUIAAAAAAAAAAABkARQnAQ', }, }); ``` @@ -30,6 +30,12 @@ const image = new Image({ }); ``` +:::warning{title=大尺寸图片} + +对于大尺寸图片,如果遇到性能问题,可以尝试打开 [`enableLargeImageOptimization`](../canvas/options.zh.md#enablelargeimageoptimization) 配置。 + +::: + ## 继承自 继承了 [DisplayObject](/zh/api/basic/display-object) 的 [样式属性](/zh/api/basic/display-object#绘图属性)。 @@ -50,9 +56,9 @@ const image = new Image({ -| [初始值](/zh/api/css/css-properties-values-api#initial-value) | 适用元素 | [是否可继承](/zh/api/css/inheritance) | 是否支持动画 | [计算值](/zh/api/css/css-properties-values-api#computed-value) | -| ------------------------------------------------------------- | -------- | ------------------------------------- | ------------ | ----------------------------------------------------------------------------------------------------------------------------- | -| '0' | - | 否 | 是 | [\](/zh/api/css/css-properties-values-api#percentage) [\](/zh/api/css/css-properties-values-api#length) | +| [初始值](/zh/api/css/css-properties-values-api#initial-value) | 适用元素 | [是否可继承](/zh/api/css/inheritance) | 是否支持动画 | [计算值](/zh/api/css/css-properties-values-api#computed-value) | +| --- | --- | --- | --- | --- | +| '0' | - | 否 | 是 | [\](/zh/api/css/css-properties-values-api#percentage) [\](/zh/api/css/css-properties-values-api#length) | ### y @@ -60,22 +66,25 @@ const image = new Image({ -| [初始值](/zh/api/css/css-properties-values-api#initial-value) | 适用元素 | [是否可继承](/zh/api/css/inheritance) | 是否支持动画 | [计算值](/zh/api/css/css-properties-values-api#computed-value) | -| ------------------------------------------------------------- | -------- | ------------------------------------- | ------------ | ----------------------------------------------------------------------------------------------------------------------------- | -| '0' | - | 否 | 是 | [\](/zh/api/css/css-properties-values-api#percentage) [\](/zh/api/css/css-properties-values-api#length) | +| [初始值](/zh/api/css/css-properties-values-api#initial-value) | 适用元素 | [是否可继承](/zh/api/css/inheritance) | 是否支持动画 | [计算值](/zh/api/css/css-properties-values-api#computed-value) | +| --- | --- | --- | --- | --- | +| '0' | - | 否 | 是 | [\](/zh/api/css/css-properties-values-api#percentage) [\](/zh/api/css/css-properties-values-api#length) | + +### src -### img +图片来源,支持以下类型: -图片来源,支持以下两种: +- `string` 图片链接地址 +- `HTMLImageElement` 创建 [Image](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/Image) 对象实例,在 `onload` 回调中创建 G Image 对象,示例如下: -- 图片地址字符串,加载成功后展示 -- 自行创建 [Image](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/Image) 对象,在 `onload` 回调中创建 G Image,示例如下: +
```js import { Image as GImage, Canvas } from '@antv/g'; let image; const img = new Image(); + img.src = 'https://gw.alipayobjects.com/mdn/rms_6ae20b/afts/img/A*N4ZMS7gHsUIAAAAAAAAAAABkARQnAQ'; img.crossOrigin = 'Anonymous'; @@ -87,26 +96,22 @@ img.onload = () => { y: 100, width: 200, height: 200, - img, // 传入 Image 对象 + src: img, // 传入 Image 对象 }, }); canvas.appendChild(image); }; ``` -### src - -该属性为 [img](/zh/api/basic/image) 的别名。 - ### width 图片宽度。 -| [初始值](/zh/api/css/css-properties-values-api#initial-value) | 适用元素 | [是否可继承](/zh/api/css/inheritance) | 是否支持动画 | [计算值](/zh/api/css/css-properties-values-api#computed-value) | -| ------------------------------------------------------------- | -------- | ------------------------------------- | ------------ | ----------------------------------------------------------------------------------------------------------------------------- | -| '0' | - | 否 | 是 | [\](/zh/api/css/css-properties-values-api#percentage) [\](/zh/api/css/css-properties-values-api#length) | +| [初始值](/zh/api/css/css-properties-values-api#initial-value) | 适用元素 | [是否可继承](/zh/api/css/inheritance) | 是否支持动画 | [计算值](/zh/api/css/css-properties-values-api#computed-value) | +| --- | --- | --- | --- | --- | +| '0' | - | 否 | 是 | [\](/zh/api/css/css-properties-values-api#percentage) [\](/zh/api/css/css-properties-values-api#length) | ### height @@ -114,9 +119,9 @@ img.onload = () => { -| [初始值](/zh/api/css/css-properties-values-api#initial-value) | 适用元素 | [是否可继承](/zh/api/css/inheritance) | 是否支持动画 | [计算值](/zh/api/css/css-properties-values-api#computed-value) | -| ------------------------------------------------------------- | -------- | ------------------------------------- | ------------ | ----------------------------------------------------------------------------------------------------------------------------- | -| '0' | - | 否 | 是 | [\](/zh/api/css/css-properties-values-api#percentage) [\](/zh/api/css/css-properties-values-api#length) | +| [初始值](/zh/api/css/css-properties-values-api#initial-value) | 适用元素 | [是否可继承](/zh/api/css/inheritance) | 是否支持动画 | [计算值](/zh/api/css/css-properties-values-api#computed-value) | +| --- | --- | --- | --- | --- | +| '0' | - | 否 | 是 | [\](/zh/api/css/css-properties-values-api#percentage) [\](/zh/api/css/css-properties-values-api#length) | ### keepAspectRatio diff --git a/site/docs/api/canvas/options.en.md b/site/docs/api/canvas/options.en.md index 38f4edf39..1daa7f65f 100644 --- a/site/docs/api/canvas/options.en.md +++ b/site/docs/api/canvas/options.en.md @@ -159,6 +159,18 @@ 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 的情况下确保交互事件坐标转换正确。 @@ -188,9 +200,11 @@ Optional. Determines if a native event is a TouchEvent, accepts the native event Optional. Determines if a native event is a MouseEvent, accepts the native event as parameter, and returns the result. -### dblClickSpeed +### dblClickSpeed 6.0.12 + +`number` -Optional. Numeric type, determines whether two consecutive clicks trigger a double-click event [dblclick](https://developer.mozilla.org/en-US/docs/Web/API/Element/dblclick_event) , the default is 200 ms. +Optional, default is 200ms. Numeric type, determines whether two consecutive clicks trigger a double-click event [dblclick](https://developer.mozilla.org/en-US/docs/Web/API/Element/dblclick_event) . ### offscreenCanvas diff --git a/site/docs/api/canvas/options.zh.md b/site/docs/api/canvas/options.zh.md index ce604d521..e9eaba0d1 100644 --- a/site/docs/api/canvas/options.zh.md +++ b/site/docs/api/canvas/options.zh.md @@ -166,6 +166,18 @@ const canvas = new Canvas({ }); ``` +### enableLargeImageOptimization 6.1.1 + +`boolean` + +可选,默认为 `false`。开启高分辨率大图渲染与交互优化,通过降采样与切片渲染策略使得上亿像素的大图也能流畅渲染和交互。 + +:::warning{title=限制} + +目前仅在原生 Canvas 渲染器中实现。 + +::: + ### supportsCSSTransform 可选。是否支持在容器上应用 CSS Transform 的情况下确保交互事件坐标转换正确。 @@ -193,9 +205,11 @@ $wrapper.style.transform = 'scale(1.1)'; 可选。判断一个原生事件是否是 MouseEvent,接受原生事件作为参数,返回判定结果。 -### dblClickSpeed +### dblClickSpeed 6.0.12 + +`number` -可选。数值类型,判断两次连续点击是否触发双击事件 [dblclick](https://developer.mozilla.org/zh-CN/docs/Web/API/Element/dblclick_event) 的速度,默认为 200 ms。 +可选,默认为 200ms。判断两次连续点击是否触发双击事件 [dblclick](https://developer.mozilla.org/zh-CN/docs/Web/API/Element/dblclick_event) 的速度。 ### offscreenCanvas diff --git a/site/examples/perf/canvas/demo/large-image-rendering.js b/site/examples/perf/canvas/demo/large-image-rendering.js new file mode 100644 index 000000000..378ce228f --- /dev/null +++ b/site/examples/perf/canvas/demo/large-image-rendering.js @@ -0,0 +1,96 @@ +import { Canvas, CanvasEvent, Image } from '@antv/g'; +import { Renderer as CanvasRenderer } from '@antv/g-canvas'; +import Stats from 'stats.js'; +import * as lil from 'lil-gui'; + +const canvasRenderer = new CanvasRenderer(); + +// create a canvas +const canvas = new Canvas({ + container: 'container', + width: 600, + height: 500, + renderer: canvasRenderer, +}); + +canvas.addEventListener(CanvasEvent.READY, () => { + const image = new Image({ + style: { + x: 0, + y: 0, + // 16151/6971, 11.4MB + src: 'https://mdn.alipayobjects.com/huamei_fr7vu1/afts/img/A*SqloToP7R9QAAAAAAAAAAAAADkn0AQ/original', + }, + }); + + canvas.appendChild(image); + + // --- + const $dom = canvas.getContextService().getDomElement(); + let currentZoom = 1; + let isDragging = false; + let lastX; + let lastY; + + $dom.style.border = '1px solid gray'; + + $dom.addEventListener('wheel', (event) => { + event.preventDefault(); + + const { deltaX, deltaY } = event; + const d = -(deltaX || deltaY); + + const ratio = 1 + (Math.min(Math.max(d, -50), 50) * 1) / 100; + const zoom = canvas.getCamera().getZoom(); + currentZoom = zoom * ratio; + + canvas + .getCamera() + .setZoomByViewportPoint(currentZoom, [event.offsetX, event.offsetY]); + }); + + $dom.addEventListener('mousedown', (e) => { + isDragging = true; + lastX = e.clientX; + lastY = e.clientY; + }); + $dom.addEventListener('mousemove', (e) => { + if (isDragging) { + const dx = e.clientX - lastX; + const dy = e.clientY - lastY; + canvas.getCamera().pan(-dx / currentZoom, -dy / currentZoom); + lastX = e.clientX; + lastY = e.clientY; + } + }); + $dom.addEventListener('mouseup', () => { + isDragging = false; + }); + + // --- +}); + +// stats +const stats = new Stats(); +stats.showPanel(0); +const $stats = stats.dom; +$stats.style.position = 'absolute'; +$stats.style.left = '0px'; +$stats.style.top = '0px'; +const $wrapper = document.getElementById('container'); +$wrapper.appendChild($stats); +canvas.addEventListener(CanvasEvent.AFTER_RENDER, () => { + if (stats) { + stats.update(); + } +}); + +// GUI +const gui = new lil.GUI({ autoPlace: false }); +$wrapper.appendChild(gui.domElement); +const canvasConfig = { + enableLargeImageOptimization: false, +}; +gui.add(canvasConfig, 'enableLargeImageOptimization').onChange((result) => { + canvas.context.config.enableLargeImageOptimization = result; +}); diff --git a/site/examples/perf/canvas/demo/meta.json b/site/examples/perf/canvas/demo/meta.json index 941c8c132..83d06cb1f 100644 --- a/site/examples/perf/canvas/demo/meta.json +++ b/site/examples/perf/canvas/demo/meta.json @@ -1,5 +1,12 @@ { "demos": [ + { + "filename": "large-image-rendering.js", + "title": { + "zh": "g-canvas 渲染高分辨率大图优化", + "en": "Rendering large images optimization with g-canvas" + } + }, { "filename": "canvas-circle-path.js", "title": { diff --git a/tsconfig.json b/tsconfig.json index b5713a019..a288b2c70 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -90,6 +90,6 @@ "@antv/g-plugin-image-loader": ["./packages/g-plugin-image-loader/src"] } }, - "include": ["packages/*/src/**/*", "__tests__/**/*"], + "include": ["packages/*/src/**/*", "__tests__/**/*", "site/**/*"], "exclude": [] }