Group

Group

new Group(config);

Group constructor. Groups are used to contain shapes or other groups.

  • config: Object or Null, if config is an object, it can contain the following attributes:

Name

Type

Description

zIndex

Number

z-index for group, used to adjust the drawing order.

visible

Boolean

visible or hidden

className

String

mark of the object, specified by users

Example:

const group = new F2.G.Group();

Methods

getChildren()

/**
 * Get the elements contained in the container
 * @return {Array}
 */
getChildren()

isDestroyed()

isVisible()

isGroup()

addShape(type, config)

The config parameter passed in is the configuration of the shape, includes:

addGroup(config)

config can be Null or Object, if the config is an object, passed in is the configuration for Group can be:

add(items)

contain(item)

sort()

getBBox()

The bounding box returned has the following structure:

arrow-up-right

getParent()

show()

hide()

get(name)

set(name, value)

getMatrix()

setMatrix(m)

transform(actions)

Perform matrix transformation on the current object.

The operations supported in actions are 't' (translate), 's' (scale), 'r' (rotate), operations can be combined in any combination order. For example:

translate(x, y)

rotate(radians)

scale(sx, sy)

setTransform(actions)

Do translating, rotating and scaling operations after resetting the matrix.

The actions parameter is same as the parameter in transform(actions).

clear()

remove(destroy)

destroy()

Destroy the element itself, if it has a parent, remove it from parent.

Last updated