@antv/g-compat
The migration build which provides some compatible API for G 4.0.
Last updated 2 years ago by panyuqi .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install @antv/g-compat 
SYNC missed versions from official npm registry.

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;

Current Tags

  • 1.0.11                                ...           latest (2 years ago)

11 Versions

  • 1.0.11                                ...           2 years ago
  • 1.0.10                                ...           2 years ago
  • 1.0.9                                ...           2 years ago
  • 1.0.8                                ...           2 years ago
  • 1.0.7                                ...           2 years ago
  • 1.0.6                                ...           2 years ago
  • 1.0.5                                ...           2 years ago
  • 1.0.4                                ...           2 years ago
  • 1.0.3                                ...           2 years ago
  • 1.0.2                                ...           2 years ago
  • 1.0.1                                ...           2 years ago

Copyright 2013 - present © cnpmjs.org | Home |