Skip to content

Commit

Permalink
Add check to boolean ops in brush modes to avoid empty paths
Browse files Browse the repository at this point in the history
  • Loading branch information
zachrispoli committed Apr 15, 2020
1 parent cb44778 commit 7309ee8
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 14 deletions.
12 changes: 9 additions & 3 deletions engine/dist/emptyproject.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<!-- The Wick Engine build is injected here during the engine build step (see gulpfile.js) -->
<script>
/*Wick Engine https://github.com/Wicklets/wick-engine*/
var WICK_ENGINE_BUILD_VERSION = "2020.4.15.13.19.3";
var WICK_ENGINE_BUILD_VERSION = "2020.4.15.15.30.19";
/*!
* Paper.js v0.12.4 - The Swiss Army Knife of Vector Graphics Scripting.
* http://paperjs.org/
Expand Down Expand Up @@ -56956,8 +56956,14 @@
if (otherPath === mask) return;

if (mask) {
mask = mask.unite(otherPath);
mask.remove();
var newMask = mask.unite(otherPath);

if (newMask.children && newMask.children.length === 0 || newMask.segments && newMask.segments.length === 0) {// Ignore boolean ops that result in empty paths
} else {
mask = newMask;
}

newMask.remove();
} else {
mask = otherPath;
}
Expand Down
12 changes: 9 additions & 3 deletions engine/dist/wickengine.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*Wick Engine https://github.com/Wicklets/wick-engine*/
var WICK_ENGINE_BUILD_VERSION = "2020.4.15.13.19.3";
var WICK_ENGINE_BUILD_VERSION = "2020.4.15.15.30.19";
/*!
* Paper.js v0.12.4 - The Swiss Army Knife of Vector Graphics Scripting.
* http://paperjs.org/
Expand Down Expand Up @@ -56941,8 +56941,14 @@ Wick.Tools.Brush = class extends Wick.Tool {
if (otherPath === mask) return;

if (mask) {
mask = mask.unite(otherPath);
mask.remove();
var newMask = mask.unite(otherPath);

if (newMask.children && newMask.children.length === 0 || newMask.segments && newMask.segments.length === 0) {// Ignore boolean ops that result in empty paths
} else {
mask = newMask;
}

newMask.remove();
} else {
mask = otherPath;
}
Expand Down
12 changes: 10 additions & 2 deletions engine/src/tools/Brush.js
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,16 @@ Wick.Tools.Brush = class extends Wick.Tool {
layer.children.forEach(otherPath => {
if(otherPath === mask) return;
if(mask) {
mask = mask.unite(otherPath);
mask.remove();
var newMask = mask.unite(otherPath);

if((newMask.children && newMask.children.length === 0) ||
(newMask.segments && newMask.segments.length === 0)) {
// Ignore boolean ops that result in empty paths
} else {
mask = newMask;
}

newMask.remove();
} else {
mask = otherPath;
}
Expand Down
12 changes: 9 additions & 3 deletions public/corelibs/wick-engine/emptyproject.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<!-- The Wick Engine build is injected here during the engine build step (see gulpfile.js) -->
<script>
/*Wick Engine https://github.com/Wicklets/wick-engine*/
var WICK_ENGINE_BUILD_VERSION = "2020.4.15.13.19.3";
var WICK_ENGINE_BUILD_VERSION = "2020.4.15.15.30.19";
/*!
* Paper.js v0.12.4 - The Swiss Army Knife of Vector Graphics Scripting.
* http://paperjs.org/
Expand Down Expand Up @@ -56956,8 +56956,14 @@
if (otherPath === mask) return;

if (mask) {
mask = mask.unite(otherPath);
mask.remove();
var newMask = mask.unite(otherPath);

if (newMask.children && newMask.children.length === 0 || newMask.segments && newMask.segments.length === 0) {// Ignore boolean ops that result in empty paths
} else {
mask = newMask;
}

newMask.remove();
} else {
mask = otherPath;
}
Expand Down
12 changes: 9 additions & 3 deletions public/corelibs/wick-engine/wickengine.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*Wick Engine https://github.com/Wicklets/wick-engine*/
var WICK_ENGINE_BUILD_VERSION = "2020.4.15.13.19.3";
var WICK_ENGINE_BUILD_VERSION = "2020.4.15.15.30.19";
/*!
* Paper.js v0.12.4 - The Swiss Army Knife of Vector Graphics Scripting.
* http://paperjs.org/
Expand Down Expand Up @@ -56941,8 +56941,14 @@ Wick.Tools.Brush = class extends Wick.Tool {
if (otherPath === mask) return;

if (mask) {
mask = mask.unite(otherPath);
mask.remove();
var newMask = mask.unite(otherPath);

if (newMask.children && newMask.children.length === 0 || newMask.segments && newMask.segments.length === 0) {// Ignore boolean ops that result in empty paths
} else {
mask = newMask;
}

newMask.remove();
} else {
mask = otherPath;
}
Expand Down

0 comments on commit 7309ee8

Please sign in to comment.