diff --git a/package.json b/package.json index 20e60cb617..f7fac2f97a 100644 --- a/package.json +++ b/package.json @@ -99,7 +99,7 @@ "screenshot": "node ./bin/screenshot.js", "start": "npm run dev", "test": "torch --compile --renderer --recursive ./test/unit", - "test-live": "torch --compile --interactive --watch --recursive ./test/unit/plugins/tool.textDisplay-spec.js", + "test-live": "torch --compile --interactive --watch --recursive ./test/unit/", "watch": "webpack --config webpack-dev.config.js", "win-dev": "node ./bin/win-dev.js" }, diff --git a/src/extend/g/group.js b/src/extend/g/group.js index 3b69b52834..a926b0e301 100755 --- a/src/extend/g/group.js +++ b/src/extend/g/group.js @@ -61,6 +61,19 @@ Util.augment(Mixin, { sortBy(callback) { const children = this.get('children'); this.set('children', Util.radixSort(children, callback)); + }, + /** + * clear inner elements + * @param {boolean} bool if destroy child + * @return {object} this + */ + clear(bool) { + const children = this._cfg.children; + for (let i = children.length - 1; i >= 0; i--) { + children[i].remove(bool); + } + this._cfg.children = []; + return this; } });