@antv/g-compat
v1.0.11
Published
The migration build which provides some compatible API for G 4.0.
Downloads
46
Maintainers
Readme
English | 简体中文
Provides partial G 4.0 compatible APIs, e.g.
// 4.0
circle.getCount();
// Equivalent to DOM API
circle.childElementCount;
Package name inspired by @vue/compat
.
https://v3-migration.vuejs.org/migration-build.html
Deprecated API
The following APIs provided in G 4.0 can be replaced by the corresponding DOM APIs in the new version.
getCount
Get the number of child nodes.
circle.getCount(); // [0]
// Equivalent to
circle.childElementCount; // [0]
getParent
Get the parent node.
circle.getParent();
// Equivalent to
circle.parentElement;
getChildren
Get the list of child nodes.
circle.getChildren();
// Equivalent to
circle.children;
getFirst
Get the first child node.
circle.getFirst();
// Equivalent to
circle.firstElementChild;
getLast
Get the last child node.
circle.getLast();
// Equivalent to
circle.lastElementChild;
getChildByIndex
Get child nodes by index.
circle.getChildByIndex(index);
// Equivalent to
circle.children[index];
add
Add child nodes.
parent.add(child);
// Equivalent to
parent.appendChild(child);
setClip
Set the cropped graphics.
circle.setClip(clipPath);
// Equivalent to
circle.style.clipPath = clipPath;
getClip
Get cropped graphics.
circle.getClip();
// Equivalent to
circle.style.clipPath;
set
Set in the initialization configuration.
circle.set('my-prop', 1);
// Equivalent to
circle.config['my-prop'] = 1;
get
Obtain in the initialization configuration.
circle.get('my-prop');
// Equivalent to
circle.config['my-prop'];
show
Show node.
circle.show();
// Equivalent to
circle.style.visibility = 'visible';
hide
Hide node.
circle.hide();
// Equivalent to
circle.style.visibility = 'hidden';
moveTo / move
Moving node in the world coordinate system.
circle.moveTo(x, y, z);
circle.move(x, y, z);
// Equivalent to
circle.setPosition(x, y, z);
setZIndex
Set the zIndex
of node:
circle.setZIndex(100);
// Equivalent to
circle.style.zIndex = 100;