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

requestAnimFrame + setDimensions = Flickering on selection background color #6112

Closed
flexeo opened this issue Jan 22, 2020 · 10 comments · Fixed by #7646
Closed

requestAnimFrame + setDimensions = Flickering on selection background color #6112

flexeo opened this issue Jan 22, 2020 · 10 comments · Fixed by #7646
Labels

Comments

@flexeo
Copy link

flexeo commented Jan 22, 2020

Version

3.6.1

Test Case

https://jsfiddle.net/badabou/qxdnb0t4/6/

Information about environment

Chrome 79

Steps to reproduce

<canvas id="canvas" width="500" height="500" style="border:1px solid #ccc"></canvas>
<script>
var canvas = new fabric.Canvas('canvas');
canvas.setBackgroundColor('#ffffff');
canvas.setDimensions({ width: 200,	height:  200 }); // This line creates the flicker
canvas.renderAll();

fabric.util.requestAnimFrame(function requestAnimFrameRender() {
	canvas.requestRenderAll();
	fabric.util.requestAnimFrame(requestAnimFrameRender);
});
</script>
@asturur
Copy link
Member

asturur commented Jan 25, 2020

I m not sure where the flickering is.
requestRenderAll is going to set the render in the next frame, exactly as requestAnimationFrame is doing, inside a requestAnimationFrame you can safely use renderAll(), having it schedule a render on the next frame again, will probably make you render every 2 frame.

I can't see the flicker at all.

@asturur
Copy link
Member

asturur commented Jan 25, 2020

Can you try to describe the issue in a way i can replicate it?

@asturur asturur closed this as completed Jan 25, 2020
@flexeo
Copy link
Author

flexeo commented Jan 26, 2020

Here's a screen video of what's going on with the selection:
https://i.postimg.cc/k4dkyL78/ezgif-5-6f1cd80380ba.gif

I have this problem on Chrome + Firefox.

@asturur asturur reopened this Jan 26, 2020
@asturur
Copy link
Member

asturur commented Jan 26, 2020

you understand the communication problem is that the only english written text is the short title? Adding a more exhaustive description from the start would have been better.

@HATyCEHKA
Copy link

I have the same problem.
Selection frame became not transparent when stop mouse moving and do not release mouse button

@asturur asturur added the bug label Feb 6, 2020
@asturur
Copy link
Member

asturur commented Feb 6, 2020

yes is a bug and need a workaround. Continuos render cycle are not supported but i do not see why they should not work.

@yassilah
Copy link
Contributor

Actually i think it makes sense, it's just because on renderAll, only the containerContext is being cleared. By adding a canvas.clearContext(canvas.getSelectionContext()), this fixes the issue:

https://jsfiddle.net/gyqztLx4/

@hamzawain7
Copy link

Still happening, can you please bump up the priority.

112371091-08acf080-8d00-11eb-89d9-450d76a1ee69

@kirill-konshin
Copy link

@ShaMan123 @asturur we're also seeing this issue, pls raise priority and/or help to hotfix.

@ShaMan123
Copy link
Contributor

ShaMan123 commented Feb 3, 2022

You can see it happens with free drawing as well.
https://jsfiddle.net/9g4yo8zk/12/

Here it's fixed:
https://jsfiddle.net/9g4yo8zk/24/

PRing in a moment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants