Skip to content
This repository has been archived by the owner on Oct 7, 2022. It is now read-only.

Commit

Permalink
Bugfix: add default line Cap and Join
Browse files Browse the repository at this point in the history
Our render hasn't been including nice rounded edges. This adds the
needed translation from Fabric to plain canvas ctx draw functions. We
can also default these properties to ensure they're always reasonable
for use.
  • Loading branch information
djmetzle committed Sep 12, 2022
1 parent 81bf127 commit 9782eb4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions mixins/highlighted_stroke.mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ module.exports = {
// in percentage of borderWidth
outlineWidth: 0.2,
outlineStyle: "#FFF",
strokeLineCap: "round",
strokeLineJoin: "round",

/**
* Provide a custom stroke function that draws a fat white line THEN a
Expand All @@ -15,6 +17,10 @@ module.exports = {
function scale(x) {
return Math.round(x) / myScale;
}

ctx.lineCap = this.strokeLineCap;
ctx.lineJoin = this.strokeLineJoin;

ctx.lineWidth = scale(this.borderWidth + outline);
ctx.strokeStyle = this.outlineStyle;
ctx.stroke();
Expand Down

0 comments on commit 9782eb4

Please sign in to comment.