Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: split a path containing multiple segments into subpaths #1430

Merged
merged 4 commits into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .changeset/silver-boats-promise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
'@antv/g-plugin-canvas-path-generator': patch
'@antv/g-plugin-rough-canvas-renderer': patch
'@antv/g-plugin-zdog-canvas-renderer': patch
'@antv/g-plugin-canvaskit-renderer': patch
'@antv/g-plugin-rough-svg-renderer': patch
'@antv/g-plugin-zdog-svg-renderer': patch
'@antv/g-plugin-canvas-renderer': patch
'@antv/g-plugin-device-renderer': patch
'@antv/g-plugin-canvas-picker': patch
'@antv/g-plugin-html-renderer': patch
'@antv/g-plugin-webgpu-device': patch
'@antv/g-plugin-image-loader': patch
'@antv/g-plugin-svg-renderer': patch
'@antv/g-plugin-webgl-device': patch
'@antv/g-web-animations-api': patch
'@antv/g-plugin-dragndrop': patch
'@antv/g-lottie-player': patch
'@antv/g-mobile-canvas': patch
'@antv/g-mobile-webgl': patch
'@antv/g-camera-api': patch
'@antv/g-components': patch
'@antv/g-mobile-svg': patch
'@antv/g-canvaskit': patch
'@antv/g-pattern': patch
'@antv/g-canvas': patch
'@antv/g-webgpu': patch
'@antv/g-webgl': patch
'@antv/react-g': patch
'@antv/g-lite': patch
'@antv/g-math': patch
'@antv/g-svg': patch
---

Split a path containing multiple segments into subpaths.
1 change: 1 addition & 0 deletions __tests__/integration/__node__tests__/webgl/circle.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const { createPNGFromRawdata, sleep, diff } = require('../../util');
// create a renderer, unregister plugin relative to DOM
const renderer = new Renderer({
targets: ['webgl1'],
enableFXAA: false,
});
const domInteractionPlugin = renderer.getPlugin('dom-interaction');
renderer.unregisterPlugin(domInteractionPlugin);
Expand Down
1 change: 1 addition & 0 deletions __tests__/integration/__node__tests__/webgl/cube.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const { createPNGFromRawdata, sleep, diff } = require('../../util');
// create a renderer, unregister plugin relative to DOM
const renderer = new Renderer({
targets: ['webgl1'],
enableFXAA: false,
});
const domInteractionPlugin = renderer.getPlugin('dom-interaction');
renderer.unregisterPlugin(domInteractionPlugin);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const weatherDataset = require('../../data/weather.json');
// create a renderer, unregister plugin relative to DOM
const renderer = new Renderer({
targets: ['webgl1'],
enableFXAA: false,
});
const domInteractionPlugin = renderer.getPlugin('dom-interaction');
renderer.unregisterPlugin(domInteractionPlugin);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const weatherDataset = require('../../data/weather.json');
// create a renderer, unregister plugin relative to DOM
const renderer = new Renderer({
targets: ['webgl1'],
enableFXAA: false,
});
const domInteractionPlugin = renderer.getPlugin('dom-interaction');
renderer.unregisterPlugin(domInteractionPlugin);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const weatherDataset = require('../../data/weather.json');
// create a renderer, unregister plugin relative to DOM
const renderer = new Renderer({
targets: ['webgl1'],
enableFXAA: false,
});
const domInteractionPlugin = renderer.getPlugin('dom-interaction');
renderer.unregisterPlugin(domInteractionPlugin);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const { createPNGFromRawdata, sleep, diff } = require('../../util');
// create a renderer, unregister plugin relative to DOM
const renderer = new Renderer({
targets: ['webgl1'],
enableFXAA: false,
});
const domInteractionPlugin = renderer.getPlugin('dom-interaction');
renderer.unregisterPlugin(domInteractionPlugin);
Expand Down
1 change: 1 addition & 0 deletions __tests__/integration/__node__tests__/webgl/image.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const { createPNGFromRawdata, sleep, diff } = require('../../util');
// create a renderer, unregister plugin relative to DOM
const renderer = new Renderer({
targets: ['webgl1'],
enableFXAA: false,
});
const domInteractionPlugin = renderer.getPlugin('dom-interaction');
renderer.unregisterPlugin(domInteractionPlugin);
Expand Down
1 change: 1 addition & 0 deletions __tests__/integration/__node__tests__/webgl/line.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const { createPNGFromRawdata, sleep, diff } = require('../../util');
// create a renderer, unregister plugin relative to DOM
const renderer = new Renderer({
targets: ['webgl1'],
enableFXAA: false,
});
const domInteractionPlugin = renderer.getPlugin('dom-interaction');
renderer.unregisterPlugin(domInteractionPlugin);
Expand Down
1 change: 1 addition & 0 deletions __tests__/integration/__node__tests__/webgl/marker.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const { createPNGFromRawdata, sleep, diff } = require('../../util');
// create a renderer, unregister plugin relative to DOM
const renderer = new Renderer({
targets: ['webgl1'],
enableFXAA: false,
});
const domInteractionPlugin = renderer.getPlugin('dom-interaction');
renderer.unregisterPlugin(domInteractionPlugin);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const { createPNGFromRawdata, sleep, diff } = require('../../util');
// create a renderer, unregister plugin relative to DOM
const renderer = new Renderer({
targets: ['webgl1'],
enableFXAA: false,
});
const domInteractionPlugin = renderer.getPlugin('dom-interaction');
renderer.unregisterPlugin(domInteractionPlugin);
Expand Down
1 change: 1 addition & 0 deletions __tests__/integration/__node__tests__/webgl/path.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const { createPNGFromRawdata, sleep, diff } = require('../../util');
// create a renderer, unregister plugin relative to DOM
const renderer = new Renderer({
targets: ['webgl1'],
enableFXAA: false,
});
const domInteractionPlugin = renderer.getPlugin('dom-interaction');
renderer.unregisterPlugin(domInteractionPlugin);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const { createPNGFromRawdata, sleep, diff } = require('../../util');
// create a renderer, unregister plugin relative to DOM
const renderer = new Renderer({
targets: ['webgl1'],
enableFXAA: false,
});
const domInteractionPlugin = renderer.getPlugin('dom-interaction');
renderer.unregisterPlugin(domInteractionPlugin);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const { createPNGFromRawdata, sleep, diff } = require('../../util');
// create a renderer, unregister plugin relative to DOM
const renderer = new Renderer({
targets: ['webgl1'],
enableFXAA: false,
});
const domInteractionPlugin = renderer.getPlugin('dom-interaction');
renderer.unregisterPlugin(domInteractionPlugin);
Expand Down
1 change: 1 addition & 0 deletions __tests__/integration/__node__tests__/webgl/rect.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const { createPNGFromRawdata, sleep, diff } = require('../../util');
// create a renderer, unregister plugin relative to DOM
const renderer = new Renderer({
targets: ['webgl1'],
enableFXAA: false,
});
const domInteractionPlugin = renderer.getPlugin('dom-interaction');
renderer.unregisterPlugin(domInteractionPlugin);
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified __tests__/integration/__node__tests__/webgl/snapshots/text.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions __tests__/integration/__node__tests__/webgl/sphere.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const { createPNGFromRawdata, sleep, diff } = require('../../util');
// create a renderer, unregister plugin relative to DOM
const renderer = new Renderer({
targets: ['webgl1'],
enableFXAA: false,
});
const domInteractionPlugin = renderer.getPlugin('dom-interaction');
renderer.unregisterPlugin(domInteractionPlugin);
Expand Down
1 change: 1 addition & 0 deletions __tests__/integration/__node__tests__/webgl/text.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const { createPNGFromRawdata, sleep, diff } = require('../../util');
// create a renderer, unregister plugin relative to DOM
const renderer = new Renderer({
targets: ['webgl1'],
enableFXAA: false,
});
const domInteractionPlugin = renderer.getPlugin('dom-interaction');
renderer.unregisterPlugin(domInteractionPlugin);
Expand Down
4 changes: 2 additions & 2 deletions __tests__/unit/css/parser/path.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ describe('Property Path', () => {

expect(left).toStrictEqual([
['M', 0, 0],
['C', 50, 0, 68.75, 0, 100, 0],
['C', 50, 0, 100, 0, 100, 0],
]);
expect(right).toStrictEqual([
['M', 0, 0],
['C', 100, 0, 137.5, 0, 200, 0],
['C', 100, 0, 200, 0, 200, 0],
]);

mergePaths(path1, path2);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"jest-environment-jsdom": "^26.6.2"
},
"devDependencies": {
"@antv/util": "^3.3.1",
"@antv/util": "^3.3.4",
"@commitlint/cli": "^8.3.6",
"@commitlint/config-angular": "^9.1.2",
"@changesets/cli": "^2.26.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/g-camera-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
},
"dependencies": {
"@antv/g-lite": "workspace:*",
"@antv/util": "^3.3.1",
"@antv/util": "^3.3.4",
"gl-matrix": "^3.4.3",
"tslib": "^2.5.3"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/g-canvas/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"@antv/g-plugin-dom-interaction": "workspace:*",
"@antv/g-plugin-html-renderer": "workspace:*",
"@antv/g-plugin-image-loader": "workspace:*",
"@antv/util": "^3.3.1",
"@antv/util": "^3.3.4",
"tslib": "^2.5.3"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/g-canvaskit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"@antv/g-plugin-dom-interaction": "workspace:*",
"@antv/g-plugin-html-renderer": "workspace:*",
"@antv/g-plugin-image-loader": "workspace:*",
"@antv/util": "^3.3.1",
"@antv/util": "^3.3.4",
"canvaskit-wasm": "^0.34.0",
"tslib": "^2.5.3"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/g-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
},
"dependencies": {
"@antv/g-lite": "workspace:*",
"@antv/util": "^3.3.1",
"@antv/util": "^3.3.4",
"gl-matrix": "^3.4.3",
"tslib": "^2.5.3"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/g-lite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
},
"dependencies": {
"@antv/g-math": "workspace:*",
"@antv/util": "^3.3.1",
"@antv/util": "^3.3.4",
"d3-color": "^1.4.0",
"eventemitter3": "^5.0.1",
"gl-matrix": "^3.4.3",
Expand Down
5 changes: 0 additions & 5 deletions packages/g-lite/src/components/Renderable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,4 @@ export interface Renderable {
* dirty rectangle flag
*/
dirty: boolean;

/**
* Rendering with other renderers, eg. simple Path/Polyline should be treated as instanced Line.
*/
proxyNodeName: string;
}
1 change: 0 additions & 1 deletion packages/g-lite/src/dom/Element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ export class Element<
renderBoundsDirty: true,
dirtyRenderBounds: undefined,
dirty: false,
proxyNodeName: undefined,
};

cullable: Cullable = {
Expand Down
2 changes: 1 addition & 1 deletion packages/g-lottie-player/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
},
"dependencies": {
"@antv/g-lite": "workspace:*",
"@antv/util": "^3.3.1",
"@antv/util": "^3.3.4",
"tslib": "^2.5.3"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/g-math/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"watch": "rollup -c -w"
},
"dependencies": {
"@antv/util": "^3.3.1",
"@antv/util": "^3.3.4",
"gl-matrix": "^3.4.3",
"tslib": "^2.5.3"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/g-mobile-canvas/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@antv/g-plugin-dragndrop": "workspace:*",
"@antv/g-plugin-image-loader": "workspace:*",
"@antv/g-plugin-mobile-interaction": "workspace:*",
"@antv/util": "^3.3.1",
"@antv/util": "^3.3.4",
"tslib": "^2.5.3"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/g-mobile-svg/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"@antv/g-plugin-mobile-interaction": "workspace:*",
"@antv/g-plugin-svg-picker": "workspace:*",
"@antv/g-plugin-svg-renderer": "workspace:*",
"@antv/util": "^3.3.1",
"@antv/util": "^3.3.4",
"tslib": "^2.5.3"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/g-mobile-webgl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@antv/g-plugin-image-loader": "workspace:*",
"@antv/g-plugin-mobile-interaction": "workspace:*",
"@antv/g-plugin-webgl-device": "workspace:*",
"@antv/util": "^3.3.1",
"@antv/util": "^3.3.4",
"tslib": "^2.5.3"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/g-pattern/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
},
"dependencies": {
"@antv/g-lite": "workspace:*",
"@antv/util": "^3.3.1",
"@antv/util": "^3.3.4",
"tslib": "^2.5.3"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/g-plugin-canvas-path-generator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"dependencies": {
"@antv/g-lite": "workspace:*",
"@antv/g-math": "workspace:*",
"@antv/util": "^3.3.1",
"@antv/util": "^3.3.4",
"tslib": "^2.5.3"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/g-plugin-canvas-picker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"@antv/g-math": "workspace:*",
"@antv/g-plugin-canvas-path-generator": "workspace:*",
"@antv/g-plugin-canvas-renderer": "workspace:*",
"@antv/util": "^3.3.1",
"@antv/util": "^3.3.4",
"gl-matrix": "^3.4.3",
"tslib": "^2.5.3"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/g-plugin-canvas-renderer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"@antv/g-math": "workspace:*",
"@antv/g-plugin-canvas-path-generator": "workspace:*",
"@antv/g-plugin-image-loader": "workspace:*",
"@antv/util": "^3.3.1",
"@antv/util": "^3.3.4",
"gl-matrix": "^3.4.3",
"tslib": "^2.5.3"
},
Expand Down
7 changes: 6 additions & 1 deletion packages/g-plugin-canvas-renderer/src/shapes/styles/Text.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
import type {
CSSRGB,
CanvasContext,
DisplayObject,
GlobalRuntime,
ParsedTextStyleProps,
Rectangle,
} from '@antv/g-lite';
import { runtime } from '@antv/g-lite';
import { isNil } from '@antv/util';
import { setShadowAndFilter } from './Default';
import type { StyleRenderer } from './interfaces';
import { CanvasRendererPlugin } from '../../CanvasRendererPlugin';

export class TextRenderer implements StyleRenderer {
render(
context: CanvasRenderingContext2D,
parsedStyle: ParsedTextStyleProps,
object: DisplayObject,
canvasContext: CanvasContext,
plugin: CanvasRendererPlugin,
runtime: GlobalRuntime,
) {
const {
lineWidth,
Expand Down
2 changes: 1 addition & 1 deletion packages/g-plugin-canvaskit-renderer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"@antv/g-lite": "workspace:*",
"@antv/g-math": "workspace:*",
"@antv/g-plugin-image-loader": "workspace:*",
"@antv/util": "^3.3.1",
"@antv/util": "^3.3.4",
"canvaskit-wasm": "^0.34.0",
"gl-matrix": "^3.4.3",
"tslib": "^2.5.3"
Expand Down
Loading