@antv/g-compat
TypeScript icon, indicating that this package has built-in type declarations

1.0.11 • Public • Published

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;

Readme

Keywords

Package Sidebar

Install

npm i @antv/g-compat

Weekly Downloads

5

Version

1.0.11

License

MIT

Unpacked Size

11.4 kB

Total Files

9

Last publish

Collaborators

  • lvisei
  • freestyle21
  • soundquiet
  • elaine.q.10
  • sturuby
  • sakuya223
  • serializedowen
  • xdzhao
  • yangzhanmei
  • wjgogogo
  • leungwensen
  • dori
  • iaaron
  • yard
  • simaq
  • dxq613
  • intchous
  • susan_ann
  • jinke.li
  • lzxue
  • army8735
  • atool
  • baizn
  • dengfuping
  • neoddish
  • jeffy2012
  • zqlu
  • afc163
  • pomelo-nwu
  • kopiluwaky
  • ccnuzindex
  • panyuqi
  • bubkoo
  • zengyue
  • kasmine
  • boyu.zlj
  • l1ud0ngq1
  • newbyvector
  • winniexing
  • chenluli
  • kn9117
  • xdddst
  • semious2020
  • esora
  • nadia_liu
  • bbsqq
  • mxz96102
  • openwayne
  • pearmini
  • pddpd
  • yiqianyao
  • zhanba
  • cxxxxxn
  • laixingui.lxg
  • susiwen8
  • yanxiong
  • zeyuwang
  • rainy25ghz
  • zhangjunjie-loki
  • flash1
  • yisi.wang
  • dreammy23
  • biupiubiupiu
  • basketduck
  • xuying1027
  • banxuan
  • bqxbqxbqx
  • duxinyue023
  • wang1212