Releases: antvis/G
5.18.19
Patch Changes
- Updated dependencies [51b42d0]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]
The insertBefore()
method inserts a node before a reference node as a child of a specified parent node.
const group1 = new Element();
const group2 = new Element();
const group3 = new Element();
const group4 = new Element();
// 2, 4, 3
group1.append(group2, group3);
group1.insertBefore(group4, group3);
If the given node already exists in the document, insertBefore() moves it from its current position to the new position. That is, it will automatically be removed from its existing parent before appending it to the specified new parent.
// 2, 3, 4 -> 2, 4, 3
group1.append(group2, group3, group4);
group1.insertBefore(group4, group3);
If refNode
is null, then newNode
is inserted at the end of node's child nodes.
// 2, 3, 4
group1.append(group2, group3);
group1.insertBefore(group4, null);
If refNode
is not the child of parentNode
, then newNode
is inserted at the end of node's child nodes.
// 2, 3, 4
group1.append(group2, group3);
group1.insertBefore(group4, group5); // non-existed node
@antv/[email protected]
We can render
component in JSX to any shape created with G API:
Online DEMO
import React, { useState, useEffect } from 'react';
import { Canvas as GCanvas, Group as GGroup } from '@antv/g';
import { Circle, render } from '@antv/react-g';
const CustomShape = () => {
const [size, setSize] = useState(100);
return <Circle cx={100} cy={100} r={size} stroke="#ff0000" lineWidth={2} />
};
useEffect(() => {
// Create Canvas & Group with G API
const canvas = new GCanvas({
container: 'C',
width: 500,
height: 500,
renderer: new Renderer(), // select a renderer
});
const group = new GGroup();
canvas.appendChild(group);
// Render to any shape with JSX syntax
render(<CustomShape />, group);
});
5.18.18
Patch Changes
- Updated dependencies [7e3dbd7]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]
Removing points
attribute in Polygon & Polyline won't throw error now:
polygon.removeAttribute('points');
polyline.removeAttribute('points');
5.18.17
Patch Changes
- Updated dependencies [d2ed3d6]
- @antv/[email protected]
Add onframe
callback in gotoLandmark
params:
camera.gotoLandmark('reset', {
duration: 1000,
easing: 'ease-in',
onfinish: () => {},
onframe: (t) => {
console.log(t); // [0, 1]
}
});
5.18.16
Patch Changes
Skip triggering render hooks when camera changed only.
- Updated dependencies [f109d83]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]
5.18.14
Patch Changes
-
e5d69c7: Fix gradient path & add more geometry.
-
Updated dependencies [e5d69c7]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]
5.18.13
Patch Changes
-
eb61cba: Add polyfill for performance.now.
-
eb61cba: Remove redundant m command when parsing path.
-
Updated dependencies [eb61cba]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]
5.18.11
Patch Changes
414d08d: Support multiple canvases in one container.
- Updated dependencies [414d08d]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]
5.18.9
Patch Changes
-
3d4f5da: Support size attenuation.
-
3d4f5da: Polyline should support 3D points.
-
3d4f5da: Support rotation when applying billboard effect.
-
Updated dependencies [3d4f5da]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]
5.18.8
5.18.8
Patch Changes
-
70aa0b3: Retrieve runtime from context instead of global.
-
789bd4c: Split a path containing multiple segments into subpaths.
-
Updated dependencies [70aa0b3]
-
Updated dependencies [789bd4c]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]