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
Stroke rounded rect visual artifacts #3955
Comments
Does this happen in Canvas and WebGL, or just one of them? My guess would be it only happens in Canvas. |
@photonstorm Nope, it happen in Webgl |
Can you test this with the current master version please? I pushed a fix for the arc function today which I'm hoping will solve this too. |
@photonstorm CANVAS looks good, but WEBGL still has artifacts |
Can you make this happen in any desktop browsers? (as I can't) - and which Android browser is it? Or is this a compiled app? May have to leave this as a known issue, because the time involved investigating it is likely prohibitive. |
@photonstorm it happens only on Android devices, and actually not on every. It visible in Android browser (chrome), also in fb messenger (instant games) |
What about the filled rounded rectangles? And is it just rounded rects? Do other Graphics shapes appear ok? |
only stroked rounded rect has artifacts, default rect (filled, stroked) looks fine, the same as filled rounded rect |
This is what the function does:
Which is basically just a bunch of Graphics commands in a sequence. Could you try re-creating the above (so just calling the Graphics commands directly) but add in a |
i recreated, but it doesn't help at all.
|
How about breaking it down a bit - so rather than the whole rectangle, how about just having the first moveTo, lineTo and arc calls? Do you still see it then? (comment out the rest of the commands) - if not, add the next line in and try again. I'm curious to know at which point you get one of those extra lines to appear. I'd rather solve this than leave it as-is. |
Does it work if you repeat for all 4 corners? If so we can merge this back in with master. |
Could there be a problem with the negative angles? I guess there should not be as angles can be negative, but you never know. Below the angles are changed to be positive.
|
@photonstorm yeah it does |
@alexeymolchan you could try the non-negative version above, but otherwise please paste the full working combination here so I can merge it into master, as I've never been able to reproduce this, so I need to see what combination gets it working for you. |
@photonstorm i already tried with non-negative angles, but it still produce artifacts.
|
Just to say that I can re-create this locally now, so I'll look into it further. While the above did work for me I need to understand why it's happening at all, so will carry on debugging it. |
Thank you for submitting this issue (yes, 2 years ago!). We have fixed this and the fix has been pushed to the |
I'm still seeing this issue in Phaser 3.55.2 on older Android devices (Android 5 or so) as well as Kindle devices - even new Kindles, such as the Kindle 7 running FireOS 7, however FireOS is based on an older version of Android, so I think that is why. The issue doesn't appear on Windows, Mac, or iOS, seems to be just older Android devices. The Browserstack device I test with is a Samsung Galaxy S6 running Android 5, and we have a Kindle 7 running FireOS 7 that the issues appears in as well. |
@photonstorm I wrote my own func with arc. Now it works without extra lines. This code works good: function drawRoundedRect(x, y, width, height, angle, object){
let graph = object.add.graphics();
graph.beginPath();
graph.lineStyle(4, 0x00ff00);
graph.moveTo(x, y);
graph.arc(x + angle,y + height,angle,Phaser.Math.DegToRad(180),Phaser.Math.DegToRad(90),true);
graph.arc(x+angle+width,y+height,angle,Phaser.Math.DegToRad(90),Phaser.Math.DegToRad(0),true);
graph.arc(x+angle+width,y,angle,Phaser.Math.DegToRad(0),Phaser.Math.DegToRad(270),true);
graph.arc(x+angle,y,angle,Phaser.Math.DegToRad(270),Phaser.Math.DegToRad(180),true);
graph.strokePath();
return graph;
} Hope that strokeRoundedRect() will be fixed finally :) |
I changed your code a little, and I managed to fix the box better in my case, maybe it's a different version, and it worked fine for me:
|
Vesion: 3.12 beta 2, also 3.11
screenshot taken from example - https://labs.phaser.io/view.html?src=src/game%20objects/graphics/stroke%20rounded%20rectangle.js
These artifacts appear only on Android devices.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: