Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

save/restore the ctx around dashed line selections. #5392

Conversation

AndrewJDR
Copy link
Contributor

Previously, the line dash setting could be left enabled, which could cause other user-side stroke calls on the top canvas to be dotted when they weren't intended to be.

@asturur
Copy link
Member

asturur commented Nov 16, 2018

renderTopLayer: function(ctx) {

What about putting the save/restore couple at start and end of that function i linked so that we cover also all the strokeStyle and fillStyle that happen in that function?

Also please let's reproduce your use case of bug ( how were you drawing on the top canvas? ) and let's make a visual test from it.

@asturur
Copy link
Member

asturur commented Nov 25, 2018

@AndrewJDR any chance to follow up?

@AndrewJDR
Copy link
Contributor Author

AndrewJDR commented Dec 8, 2018

Yes apologies, just been busy.

Please check out this jsfiddle: http://jsfiddle.net/qtb4prok/

Be sure to drag a selection box inside the canvas within 5 seconds, or the issue will not be reproduced (I don't know how to automate creating a selection box easily off the top of my head, so it's manual).

Or you can drag anywhere during the box animation, and it will turn into a dashed box.

@asturur
Copy link
Member

asturur commented Dec 8, 2018

As as i said the PR looks good if we can move the save/restore couple in the function i suggested.

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.
@AndrewJDR AndrewJDR force-pushed the save_restore_ctx_during_dashed_line_selections branch from 57ef7bb to 43e6965 Compare December 9, 2018 06:35
@AndrewJDR
Copy link
Contributor Author

Should be all set 👍

@asturur asturur merged commit c2ca903 into fabricjs:master Dec 9, 2018
@asturur asturur mentioned this pull request Dec 10, 2018
thiagocunha pushed a commit to thiagocunha/fabric.js that referenced this pull request Nov 18, 2019
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants