Skip to content

Commit

Permalink
Save/restore the ctx during renderTopLayer(). (fabricjs#5392)
Browse files Browse the repository at this point in the history
Previously, the line dash setting could be left enabled within
_drawSelection() [which is called by renderTopLayer()], which could
cause subsequent user-side line stroke calls on the top canvas to be
dashed when they weren't explicitly specified to be by the user.

See http://jsfiddle.net/qtb4prok/ for a repro.
  • Loading branch information
AndrewJDR authored and asturur committed Dec 9, 2018
1 parent a77e80e commit cb9a43a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/canvas.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@
},

renderTopLayer: function(ctx) {
ctx.save();
if (this.isDrawingMode && this._isCurrentlyDrawing) {
this.freeDrawingBrush && this.freeDrawingBrush._render();
this.contextTopDirty = true;
Expand All @@ -407,6 +408,7 @@
this._drawSelection(ctx);
this.contextTopDirty = true;
}
ctx.restore();
},

/**
Expand Down

0 comments on commit cb9a43a

Please sign in to comment.