Skip to content

Commit

Permalink
Fix filling again...
Browse files Browse the repository at this point in the history
  • Loading branch information
Demonstrandum committed Mar 2, 2019
1 parent cf0bee1 commit fc27733
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ A friendlier way interact with the canvas.
jsdelivr CDN (use this to import):
- Canvas
```
https://cdn.jsdelivr.net/gh/Demonstrandum/BasicCanvas@v1.0.6/lib/BasicCanvas.js
https://cdn.jsdelivr.net/gh/Demonstrandum/BasicCanvas@v1.0.8/lib/BasicCanvas.js
```
- Shapes
```
https://cdn.jsdelivr.net/gh/Demonstrandum/BasicCanvas@v1.0.6/lib/BasicShapes.js
https://cdn.jsdelivr.net/gh/Demonstrandum/BasicCanvas@v1.0.8/lib/BasicShapes.js
```
- DOM
```
https://cdn.jsdelivr.net/gh/Demonstrandum/BasicCanvas@v1.0.6/lib/BasicDOM.js
https://cdn.jsdelivr.net/gh/Demonstrandum/BasicCanvas@v1.0.8/lib/BasicDOM.js
```

TODO: Instructions on usage, for now look at the example files (and/or source files), still a small project.
Expand Down
6 changes: 4 additions & 2 deletions lib/BasicCanvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,9 @@ class Shape {
temp_color = this.canvas.fill;
}

if (this.hollow || temp_color.valueOf() === 'transparent') {
if (this.hollow
|| temp_color.valueOf() === 'transparent'
|| (this.vertices.length < 3 && !this.primitive)) {
return;
}

Expand All @@ -432,7 +434,7 @@ class Shape {
c.moveTo(...this.vertices[0]);
for (const vertex of this.vertices.slice(1)) {
c.lineTo(...vertex);
}
}
}
} else {
this.primitive();
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "basiccanvas",
"title": "BasicCanvas",
"description": "Simple JavaScript canvas abstractions.",
"version": "1.0.7",
"version": "1.0.8",
"main": "lib/BasicCanvas.js",
"homepage": "https://github.com/Demonstrandum/BasicCanvas/",
"author": {
Expand Down

0 comments on commit fc27733

Please sign in to comment.