You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
horizontal_wrapped does not work with scope inside
When scope is used inside horizontal_wrapped it newer wraps.
I discovered it, when trying to use Drag & Drop, based on the example where with_layer_id is used to create the effect, but it internally calls scope.
To Reproduce
Steps to reproduce the behavior:
ui.horizontal_wrapped(|ui:&mut egui::Ui|{for x in anything {drag_source(ui,/*...*/);// or just
ui.scope(/*...*/);}});
It will newer wrap
Expected behavior horizontal_wrapped can be used with Drag & Drop (meaning with scope inside).
Screenshots
my app
before d&d
drag "Harvester" card (Card is not wrapped, which causes it to be on first row, which causes everything to shift, scroll area to resize, and only part of card being visible)
dragging other (not beginning of wrapped row) cards works, because of partial workaround
Desktop:
OS: Windows 10
Browser Chrome, Firefox
Additional context
Partial workaround applied in my app, to have drag and drop not broken for most is to remove the scope in "not dragging part" of the code:
partial workaround
fndrag_source(ui:&mut egui::Ui,id:Id,body:implFnOnce(&mut egui::Ui) -> Response){let is_being_dragged = ui.memory(|mem| mem.is_being_dragged(id));if !is_being_dragged {// this is the fixed versionlet response = body(ui);//let response = ui.scope(body).response; // this is the broken version where everything would be on single line, with no wraplet response = ui.interact(response.rect, id,Sense::drag());if response.hovered(){
ui.ctx().set_cursor_icon(egui::CursorIcon::Grab);}}else{
ui.ctx().set_cursor_icon(egui::CursorIcon::Grabbing);let layer_id = egui::LayerId::new(egui::Order::Tooltip, id);// here it breaks, because `with_layer_id` does not have "no `scope`" versionlet response = ui.with_layer_id(layer_id, body).response;ifletSome(pointer_pos) = ui.ctx().pointer_interact_pos(){let delta = pointer_pos - response.rect.center();
ui.ctx().translate_layer(layer_id, delta);}}}
The text was updated successfully, but these errors were encountered:
horizontal_wrapped does not work with scope inside
When scope is used inside horizontal_wrapped it newer wraps.
I discovered it, when trying to use Drag & Drop, based on the example where with_layer_id is used to create the effect, but it internally calls scope.
To Reproduce
Steps to reproduce the behavior:
It will newer wrap
Expected behavior
horizontal_wrapped can be used with Drag & Drop (meaning with scope inside).
Screenshots
my app
before d&d
drag "Harvester" card (Card is not wrapped, which causes it to be on first row, which causes everything to shift, scroll area to resize, and only part of card being visible)
dragging other (not beginning of wrapped row) cards works, because of partial workaround
Desktop:
Additional context
Partial workaround applied in my app, to have drag and drop not broken for most is to remove the scope in "not dragging part" of the code:
partial workaround
The text was updated successfully, but these errors were encountered: