From c2df96c44045ece30adbcb321f00a9c7d9f4ce88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Thu, 14 Jul 2016 10:24:04 +0200 Subject: [PATCH] Implement CompoundPath#closed. --- src/path/CompoundPath.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/path/CompoundPath.js b/src/path/CompoundPath.js index 201e3a7c..03a65b04 100644 --- a/src/path/CompoundPath.js +++ b/src/path/CompoundPath.js @@ -169,6 +169,30 @@ var CompoundPath = PathItem.extend(/** @lends CompoundPath# */{ this.reverse(); }, + /** + * Specifies whether the compound-path is fully closed, meaning all its + * contained sub-paths are closed path. + * + * @bean + * @type Boolean + * @see Path#isClosed() + */ + isClosed: function() { + var children = this._children; + for (var i = 0, l = children.length; i < l; i++) { + if (!children[i]._closed) + return false; + } + return true; + }, + + setClosed: function(closed) { + var children = this._children; + for (var i = 0, l = children.length; i < l; i++) { + children[i].setClosed(closed); + } + }, + /** * The first Segment contained within the compound-path, a short-cut to * calling {@link Path#getFirstSegment()} on {@link Item#getFirstChild()}.