Merge pull request #337 from Jacco/issue/301

Reduce target when fill hole with same color #301
This commit is contained in:
DD Liu 2018-04-03 18:56:58 -04:00 committed by GitHub
commit 6c6d3a8bfb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View file

@ -49,7 +49,7 @@ const _ungroupLoop = function (group, recursive, setSelectedItems) {
// iterate over group children recursively
for (let i = 0; i < group.children.length; i++) {
let groupChild = group.children[i];
if (groupChild.hasChildren()) {
if (groupChild instanceof paper.Group && groupChild.hasChildren()) {
// recursion (groups can contain groups, ie. from SVG import)
if (recursive) {
_ungroupLoop(groupChild, recursive, setSelectedItems);

View file

@ -122,7 +122,10 @@ class FillTool extends paper.Tool {
this.fillItem.parent.fillColor.toCSS() === this.addedFillItem.fillColor.toCSS()) {
this.addedFillItem.remove();
this.addedFillItem = null;
let parent = this.fillItem.parent;
this.fillItem.remove();
parent = parent.reduce();
parent.fillColor = this.fillColor;
} else if (this.addedFillItem) {
// Fill in a hole.
this.addedFillItem.data.noHover = false;