How to use the @antv/g/lib.Group function in @antv/g

To help you get started, we’ve selected a few @antv/g examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github antvis / G6 / test / unit / item / node-spec.js View on Github external
it('node update, change shape', () => {
    const group = new G.Group();
    const node = new Node({
      model: {
        x: 100,
        y: 100,
        size: [ 20, 40 ],
        shape: 'rect',
        label: 'ni hao'
      },
      group
    });
    const shape = node.get('keyShape');
    expect(shape.get('type')).eql('rect');
    expect(shape.attr('width')).eql(20);
    expect(group.attr('matrix')[6]).eql(100);
    node.update({ shape: 'circle', size: 10, x: 50 });
    const newShape = node.get('keyShape');
github antvis / G6 / test / unit / item / node-spec.js View on Github external
it('node update', () => {
    const group = new G.Group();
    const node = new Node({
      model: {
        x: 5,
        y: 5,
        size: [ 40, 20 ],
        shape: 'rect',
        label: 'ni hao'
      },
      group
    });
    const shape = group.get('children')[0];
    expect(shape.attr('x')).eql(-20);
    expect(group.attr('matrix')[6]).eql(5);

    node.update({ x: 6, y: 10, size: [ 20, 20 ] });
    expect(group.attr('matrix')[6]).eql(6);
github antvis / G6 / test / unit / item / node-spec.js View on Github external
it('new node and destroy', () => {
    const group = new G.Group();
    const node = new Node({
      model: {
        x: 100,
        y: 100,
        shape: 'circle'
      },
      group,
      id: 'a'
    });
    expect(node.get('type')).eql('node');
    const shape = group.get('children')[0];
    expect(shape.attr('x')).eql(0);
    expect(group.attr('matrix')[6]).eql(100);
    expect(group.getCount()).eql(1);
    node.destroy();
    expect(node.destroyed).eql(true);
github antvis / G6 / test / unit / item / node-spec.js View on Github external
it('getLinkPointByAnchor', () => {
    const group = new G.Group();
    const node = new Node({
      model: {
        x: 100,
        y: 100,
        size: [ 20, 20 ],
        shape: 'rect',
        anchorPoints: [
          [ 0.5, 0 ], [ 1, 0.5 ], [ 0.5, 1 ], [ 0, 0.5 ]
        ]
      },
      group
    });
    const point = node.getLinkPointByAnchor(0);
    expect(snap(point.x, 100)).eql(true);
    expect(snap(point.y, 89.5)).eql(true);
github OXOYO / X-Flowchart-Vue / src / global / G6 / shape / extend / group.js View on Github external
const Util = require('../../util');
const Group = require('@antv/g/lib').Group;

module.exports = Util.augment(Group, {
  findByClassName(className) {
    return this.find(function(shape) {
      return shape.get('className') === className;
    });
  }
});
github antvis / G6 / src / shape / extend / group.js View on Github external
const Util = require('../../util');
const Group = require('@antv/g/lib').Group;

module.exports = Util.augment(Group, {
  findByClassName(className) {
    return this.find(function(shape) {
      return shape.get('className') === className;
    });
  }
});