UNPKG

konva

Version:

HTML5 2d canvas library for interactive graphics, design editors, whiteboards, and diagrams.

25 lines (24 loc) 682 B
import { Util } from "./Util.js"; import { Container } from "./Container.js"; import { _registerNode } from "./Global.js"; /** * Group constructor. Groups are used to contain shapes or other groups. * @constructor * @memberof Konva * @augments Konva.Container * @param {Object} config * @@nodeParams * @@containerParams * @example * var group = new Konva.Group(); */ export class Group extends Container { _validateAdd(child) { const type = child.getType(); if (type !== 'Group' && type !== 'Shape') { Util.throw('You may only add groups and shapes to groups.'); } } } Group.prototype.nodeType = 'Group'; _registerNode(Group);