Eliminate unnecessary allocation
This commit is contained in:
parent
fb036529a2
commit
470723c232
1 changed files with 23 additions and 23 deletions
|
|
@ -757,32 +757,12 @@ pub fn draw<Renderer, T>(
|
||||||
cursor_position
|
cursor_position
|
||||||
};
|
};
|
||||||
|
|
||||||
// Render picked pane last
|
let mut render_picked_pane = None;
|
||||||
let mut elements = elements.zip(layout.children()).collect::<Vec<_>>();
|
|
||||||
elements
|
|
||||||
.sort_by_key(|((id, _), _)| picked_pane.map(|(id, _)| id) == Some(*id));
|
|
||||||
|
|
||||||
for ((id, pane), layout) in elements {
|
for ((id, pane), layout) in elements.zip(layout.children()) {
|
||||||
match picked_pane {
|
match picked_pane {
|
||||||
Some((dragging, origin)) if id == dragging => {
|
Some((dragging, origin)) if id == dragging => {
|
||||||
let bounds = layout.bounds();
|
render_picked_pane = Some((pane, origin, layout.bounds()));
|
||||||
|
|
||||||
renderer.with_translation(
|
|
||||||
cursor_position
|
|
||||||
- Point::new(bounds.x + origin.x, bounds.y + origin.y),
|
|
||||||
|renderer| {
|
|
||||||
renderer.with_layer(bounds, |renderer| {
|
|
||||||
draw_pane(
|
|
||||||
pane,
|
|
||||||
renderer,
|
|
||||||
default_style,
|
|
||||||
layout,
|
|
||||||
pane_cursor_position,
|
|
||||||
viewport,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
draw_pane(
|
draw_pane(
|
||||||
|
|
@ -797,6 +777,26 @@ pub fn draw<Renderer, T>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Render picked pane last
|
||||||
|
if let Some((pane, origin, bounds)) = render_picked_pane {
|
||||||
|
renderer.with_translation(
|
||||||
|
cursor_position
|
||||||
|
- Point::new(bounds.x + origin.x, bounds.y + origin.y),
|
||||||
|
|renderer| {
|
||||||
|
renderer.with_layer(bounds, |renderer| {
|
||||||
|
draw_pane(
|
||||||
|
pane,
|
||||||
|
renderer,
|
||||||
|
default_style,
|
||||||
|
layout,
|
||||||
|
pane_cursor_position,
|
||||||
|
viewport,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
if let Some((axis, split_region, is_picked)) = picked_split {
|
if let Some((axis, split_region, is_picked)) = picked_split {
|
||||||
let highlight = if is_picked {
|
let highlight = if is_picked {
|
||||||
theme.picked_split(style)
|
theme.picked_split(style)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue