Closed jimsynz closed 6 months ago
Okay, so I have found some more interesting information.
I have found that this happens for a square with a slightly pushed in side:
path(
[
:begin,
{:move_to, 40, 40},
{:line_to, 200, 40},
{:line_to, 180, 120},
{:line_to, 200, 200},
{:line_to, 40, 200},
:close_path
],
fill: :white,
stroke: {1, :red},
id: :shape
)
But here's the kicker - only when we transition into the new scene from another scene.
My app has a StartupScene
that performs some animations and then calls
def handle_info({:animate_done, :background, style}, scene) do
:timer.apply_after(1000, Scenic.ViewPort, :set_root, [
scene.viewport,
Podbox.Scenic.MainScene,
[bg_style: style]
])
{:noreply, scene}
end
which transitions to the MainScene
module. When the app starts up directly into the MainScene
it renders correctly:
https://github.com/ScenicFramework/scenic/assets/59449/59a78782-7db0-456f-8042-998cc54f5ec7
But when the scene transitions it renders incorrectly. I also found that if I crash the scene after the transition it redraws correctly:
https://github.com/ScenicFramework/scenic/assets/59449/9cd883cc-30b2-4159-9f2d-9bcd3c094778
I've tried different variations of calling Scenic.ViewPort.set_root/3
- calling it from another process via task, using Process.send_after/3
and calling it more conventionally. Nothing seems to make a difference.
Okay, that's pretty wild!
I feel like that might be a bug in the scenic driver--have you tried it with both cairo and nvg?
yeah okay, so I just reinstalled cairo
and gtk+3
and it compiled, so who knows why it was failing before. I can report that the problem doesn't manifest using cairo-gtk
as the driver.
It still repros with glfw
though right?
(And thank you very much for digging into this!)
Sorry - yes, it does. But since glfw
is deprecated maybe we just shrug, close this issue and move on with our lives?
That seems reasonable to me. Great work @jimsynz !
Checklist
Versions and Environment
Elixir:
Erlang:
Scenic:
I'm using
SCENIC_TARGET_LOCAL=glfw
to build on macOS asncairo-gtk
doesn't compile for me.OS:
AKA macOS Sonoma 14.4.1 (23E224)
Steps to reproduce
Draw a "lightning bolt" closed path and ask it to be filled:
Expected Behavior
I expected the fill to be applied inside the path.
Actual Behavior
Fill was applied outside the closed path.
Stack Trace
N/A
Additional Comments
So, I was trying to create a tiny battery status widget and I wanted to place a "lightning bolt" over the battery icon when connected to an external power supply. I discovered that the small polygon was not being filled correctly:
Thinking that it was simply an artifact of the path being so small, I tried scaling it up to see if that fixed the problem:
However as you can see, the bigger version also has the same problem:
Then I thought it could be a problem caused by the horizontal and vertical lines somehow, but that didn't fix it either:
I can't see anything wrong with the way that I am using the
path
primitive, so I am pretty sure that this is a bug and not PEBKAC.I did actually try other shapes like diamonds, hexagons etc, and had no problems so unfortunately I have no clues to help figure this out.