Merge pull request #360 from fsih/fillTransparentText

Add ability to fill transparent text
This commit is contained in:
DD Liu 2018-04-11 14:45:56 -04:00 committed by GitHub
commit 6252366759
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View file

@ -26,7 +26,7 @@
"react-dom": "^16"
},
"devDependencies": {
"@scratch/paper": "0.11.20180329192534",
"@scratch/paper": "0.11.20180411183636",
"autoprefixer": "8.1.0",
"babel-cli": "6.26.0",
"babel-core": "^6.23.1",

View file

@ -44,8 +44,13 @@ class FillTool extends paper.Tool {
fill: true,
guide: false,
match: function (hitResult) {
return (hitResult.item instanceof paper.Path || hitResult.item instanceof paper.PointText) &&
(hitResult.item.hasFill() || hitResult.item.closed || isAlmostClosedPath(hitResult.item));
if (hitResult.item instanceof paper.Path &&
(hitResult.item.hasFill() || hitResult.item.closed || isAlmostClosedPath(hitResult.item))) {
return true;
}
if (hitResult.item instanceof paper.PointText) {
return true;
}
},
hitUnfilledPaths: true,
tolerance: FillTool.TOLERANCE / paper.view.zoom