-
Notifications
You must be signed in to change notification settings - Fork 298
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
Widgets centered on first frame #655
Comments
I tested with rendering 20 buttons, and the effect was more visible. Believe I saw this once in one of the Conrod examples, but the effect is harder to notice here since the window is appearing in the same moment. In Turbine, you notice it when pressing C after the window has loaded. |
Printing out rectangle and color in primitive::shape::framed_rectangle::KIND => {
if let Some(framed_rectangle) = container.unique_widget_state::<::FramedRectangle>() {
let frame = framed_rectangle.style.get_frame(theme);
if frame > 0.0 {
let frame_color = framed_rectangle.style.get_frame_color(theme);
let frame_rect = container.rect;
draw_rectangle(context, graphics, frame_rect, frame_color);
}
let color = framed_rectangle.style.get_color(theme);
let rect = container.rect.pad(frame);
static mut i: u32 = 0;
println!("{:?}", rect);
println!("{:?}", color);
unsafe { i += 1; if i > 5 { panic!(""); } }
draw_rectangle(context, graphics, rect, color);
}
}, Getting:
|
This draws one blue rectangle on top of a black rectangle. I printed out first |
Hmmm strange! Thanks for the details, will have a look into it now. |
Tested with |
I did test a few times and thought it was no longer occurring, however after testing again a few times I did just notice it. My hypothesis: The way turbine currently captures the cursor is by only passing any events to conrod when the cursor is not captured by turbine - this means that conrod doesn't get any window size information until the first time conrod gets a In the mean-time, this could be fixed by only blocking mouse events (rather than all events) from conrod while turbine captures the mouse, rather than blocking all events as is currently the case. i.e. something like if !(capture_cursor && e.is_mouse_event()) {
ui.handle_event(e);
} I'll leave this open for you to close once you can confirm that this fixes the issue on your end. |
I'm sending just the render events, since the other events that Conrod handles should be ignored when not active. See PistonDevelopers/turbine#42 |
In Turbine, when starting the application the widgets seems to be centered at the first frame, and then corrected at later frames.
Code:
The text was updated successfully, but these errors were encountered: