Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions editor-core/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ pub fn has_unmatched_pair(line: &str) -> bool {
}
}
}
for (_, pair_count) in count.iter() {
for pair_count in count.values() {
if *pair_count < 0 {
return true;
}
}
for (_, left) in pair_first.iter() {
for left in pair_first.values() {
if *left {
return true;
}
Expand Down
6 changes: 2 additions & 4 deletions src/app/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ impl ApplicationHandle {
}
#[cfg(not(target_arch = "wasm32"))]
AppUpdateEvent::MenuAction { action_id } => {
for (_, handle) in self.window_handles.iter_mut() {
for handle in self.window_handles.values_mut() {
if handle.window_state.context_menu.contains_key(&action_id)
|| handle.window_menu_actions.contains_key(&action_id)
{
Expand Down Expand Up @@ -371,9 +371,7 @@ impl ApplicationHandle {
window_handle.ime(ime);
}
WindowEvent::MouseWheel { .. } => {}
WindowEvent::PinchGesture {
delta: _, phase: _, ..
} => {}
WindowEvent::PinchGesture { .. } => {}
WindowEvent::TouchpadPressure { .. } => {}
WindowEvent::ScaleFactorChanged { scale_factor, .. } => {
window_handle.os_scale(scale_factor);
Expand Down
2 changes: 1 addition & 1 deletion src/event/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ impl<'a> GlobalEventCx<'a> {
| Event::Drag(_)
| Event::Custom(_)
| Event::Extracted => {
panic!("received {:?}, which is not an external event.", &event);
panic!("received {:?}, which is not an external event.", event);
}
}

Expand Down
18 changes: 9 additions & 9 deletions src/inspector/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,12 +291,12 @@ fn box_model_layer(
))
.style(|s| {
s.grid()
.grid_template_columns([fr(1.), auto(), fr(1.)])
.grid_template_columns([fr(1.0_f32), auto(), fr(1.0_f32)])
.width_full()
}),
Stack::new((left, child, right)).style(move |s| {
s.grid()
.grid_template_columns([fr(1.), auto(), fr(1.)])
.grid_template_columns([fr(1.0_f32), auto(), fr(1.0_f32)])
.items_center()
.col_gap(side_gap)
}),
Expand Down Expand Up @@ -828,13 +828,13 @@ fn selected_view(

let style_list = style
.debug_view(Some(&view.direct_style))
.style(|s| s.height_full().flex_grow(1.))
.style(|s| s.height_full().flex_grow(1.0_f32))
.scroll()
.style(|s| {
s.set(OverflowX, taffy::Overflow::Scroll)
.set(OverflowY, taffy::Overflow::Visible)
.height_full()
.flex_grow(1.)
.flex_grow(1.0_f32)
});

let selected_view_info = Stack::vertical_from_iter(
Expand All @@ -852,7 +852,7 @@ fn selected_view(
})
}),
)
.style(|s| s.flex_grow(1.).height_full().gap(2.0));
.style(|s| s.flex_grow(1.0_f32).height_full().gap(2.0));

let selected_view_summary = Stack::horizontal((
selected_view_info,
Expand All @@ -861,7 +861,7 @@ fn selected_view(
.style(|s| {
s.items_start()
.gap(16.0)
.flex_grow(1.)
.flex_grow(1.0_f32)
.justify_between()
.padding_right(15)
})
Expand All @@ -874,12 +874,12 @@ fn selected_view(

let selected_view_panel =
Stack::vertical((header("Selected View"), selected_view_summary))
.style(|s| s.width_full().min_size(0., 0.).flex_grow(1.));
.style(|s| s.width_full().min_size(0., 0.).flex_grow(1.0_f32));
let style_panel = Stack::vertical((header("View Style"), style_list))
.style(|s| s.width_full().min_size(0., 0.).flex_grow(1.));
.style(|s| s.width_full().min_size(0., 0.).flex_grow(1.0_f32));

Stack::vertical((selected_view_panel, style_panel))
.style(|s| s.width_full().flex_shrink(0.).gap(10).min_size(0., 0.))
.style(|s| s.width_full().flex_shrink(0.0_f32).gap(10).min_size(0., 0.))
.into_any()
} else {
Label::new("No selection")
Expand Down
24 changes: 17 additions & 7 deletions src/inspector/profiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ fn profile_view(profile: &Rc<Profile>) -> impl IntoView {
.map(|(i, frame)| {
let frame = frame.clone();
Stack::horizontal((
Label::new(format!("Frame #{i}")).style(|s| s.flex_grow(1.0)),
Label::new(format!("Frame #{i}")).style(|s| s.flex_grow(1.0_f32)),
Label::new(format!("{:.4} ms", frame.sum.as_secs_f64() * 1000.0))
.style(|s| s.margin_right(16)),
))
Expand Down Expand Up @@ -154,7 +154,7 @@ fn profile_view(profile: &Rc<Profile>) -> impl IntoView {
.style(|s| {
s.flex_basis(0)
.min_height(0)
.flex_grow(1.0)
.flex_grow(1.0_f32)
.with_theme(|s, t| s.background(t.bg_base()))
}),
header("Event").style(|s| {
Expand All @@ -163,7 +163,7 @@ fn profile_view(profile: &Rc<Profile>) -> impl IntoView {
}),
event_tooltip,
))
.style(|s| s.min_width(230.0).flex_grow(1.));
.style(|s| s.min_width(230.0).flex_grow(1.0_f32));

let timeline = dyn_container(
move || selected_frame.get(),
Expand Down Expand Up @@ -213,7 +213,12 @@ fn profile_view(profile: &Rc<Profile>) -> impl IntoView {
.style(move |s| s.min_width_pct(zoom.get() * 100.0).height_full()),
)
.custom_style(|s| s.vertical_track_inset(5.).show_bars_when_idle(false))
.style(|s| s.height_full().min_width(0).flex_basis(0).flex_grow(1.0))
.style(|s| {
s.height_full()
.min_width(0)
.flex_basis(0)
.flex_grow(1.0_f32)
})
.on_event(listener::PointerWheel, move |_cx, se| {
let delta = se.resolve_to_points(None, None);
zoom.set(zoom.get() * (1.0 - delta.y / 400.0));
Expand All @@ -231,12 +236,12 @@ fn profile_view(profile: &Rc<Profile>) -> impl IntoView {
s.width_full()
.min_height(0)
.flex_basis(0)
.flex_grow(1.0)
.flex_grow(1.0_f32)
.with_theme(|s, t| s.background(t.bg_base()))
});

let timeline = Stack::vertical((header("Timeline"), timeline))
.style(|s| s.min_width(0).flex_basis(0).flex_grow(1.0));
.style(|s| s.min_width(0).flex_basis(0).flex_grow(1.0_f32));

Resizable::new((frames, timeline)).style(|s| s.height_full().width_full().max_width_full())
}
Expand Down Expand Up @@ -293,7 +298,12 @@ pub fn profiler(window_id: WindowId) -> impl IntoView {
}
},
)
.style(|s| s.width_full().min_height(0).flex_basis(0).flex_grow(1.0));
.style(|s| {
s.width_full()
.min_height(0)
.flex_basis(0)
.flex_grow(1.0_f32)
});

// FIXME: This needs an extra `container` or the `Stack::vertical` ends up horizontal.
Container::new(Stack::vertical((button, separator, lower)).style(|s| s.size_full()))
Expand Down
17 changes: 11 additions & 6 deletions src/inspector/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ pub fn capture(window_id: WindowId) {
_ => panic!(),
},
)
.style(|s| s.flex_basis(0.0).min_height(0.0).flex_grow(1.0));
.style(|s| s.flex_basis(0.0).min_height(0.0).flex_grow(1.0_f32));

let separator = ().style(move |s| {
s.width_full()
Expand Down Expand Up @@ -268,7 +268,7 @@ fn capture_view(
.into_any(),
_ => panic!(),
}
.style(|s| s.min_size(0, 0.).flex_grow(1.))
.style(|s| s.min_size(0, 0.).flex_grow(1.0_f32))
.scroll()
.style(|s| {
s.width_full()
Expand Down Expand Up @@ -314,7 +314,7 @@ fn capture_view(
Resizable::new((
image_view.scroll().style(|s| {
s.min_size(0, 0)
.flex_grow(1.)
.flex_grow(1.0_f32)
.grid()
.items_center()
.justify_items(AlignItems::Center)
Expand All @@ -328,7 +328,7 @@ fn capture_view(
.min_size(0., 0.)
}),
))
.style(|s| s.min_size(0., 0.).flex_grow(1.));
.style(|s| s.min_size(0., 0.).flex_grow(1.0_f32));

let root = capture.root.clone();
let tree = view_tree(capture.clone(), capture_view, datas);
Expand Down Expand Up @@ -397,7 +397,12 @@ fn capture_view(
Stack::vertical((header("View Tree"), search, tree)).into_view()
};

let tree = tree.style(|s| s.height_full().min_width(0).flex_basis(0).flex_grow(1.0));
let tree = tree.style(|s| {
s.height_full()
.min_width(0)
.flex_basis(0)
.flex_grow(1.0_f32)
});

Resizable::new((left, tree))
.style(move |s| {
Expand Down Expand Up @@ -439,7 +444,7 @@ fn view_tree(
.class(ListClass)
.style(|s| {
s.flex_col()
.flex_grow(1.)
.flex_grow(1.0_f32)
.min_size(0., 0.)
.class(ListItemClass, |s| {
s.width_full()
Expand Down
2 changes: 1 addition & 1 deletion src/style/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ impl Style {
}

// Check if other has inherited properties we don't have
for (key, _) in other.map.iter() {
for key in other.map.keys() {
if let StyleKeyInfo::Prop(prop_info) = key.info
&& prop_info.inherited
&& !self.map.contains_key(key)
Expand Down
8 changes: 4 additions & 4 deletions src/style/theme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,8 @@ impl StylePropValue for DesignSystem {
.border_radius(6.0)
.min_width(280.0)
.min_height_pct(0.)
.flex_grow(0.)
.flex_shrink(1.)
.flex_grow(0.0_f32)
.flex_shrink(1.0_f32)
});

Some(content.into_any())
Expand Down Expand Up @@ -642,7 +642,7 @@ pub(crate) fn default_theme(os_theme: winit::window::Theme) -> Style {
.transition(Background, Transition::linear(100.millis()))
.focus(|s| s.with_theme(|s, t| s.hover(|s| s.background(t.bg_overlay()))))
.border_radius(100.pct())
.flex_shrink(0.)
.flex_shrink(0.0_f32)
.apply(border_style(false))
.apply(focus_style());

Expand Down Expand Up @@ -687,7 +687,7 @@ pub(crate) fn default_theme(os_theme: winit::window::Theme) -> Style {
})
.hover(|s| s.background(t.bg_overlay()))
})
.aspect_ratio(2.)
.aspect_ratio(2.0_f32)
// .focus(|s| s.with_theme(|s, t| s.hover(|s| s.background(t.bg_overlay()))))
.border_radius(50.pct())
.set(ToggleButtonCircleRad, 75.pct())
Expand Down
2 changes: 1 addition & 1 deletion src/style/transition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ impl Transition {

Stack::vertical_from_iter(rows).style(|s| {
s.grid()
.grid_template_columns([auto(), fr(1.)])
.grid_template_columns([auto(), fr(1.0_f32)])
.justify_center()
.items_center()
.row_gap(12)
Expand Down
10 changes: 5 additions & 5 deletions src/style/values.rs
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ where

let item_view = item.debug_view().unwrap_or_else(|| {
Label::new(format!("{:?}", item))
.style(|s| s.flex_grow(1.0))
.style(|s| s.flex_grow(1.0_f32))
.into_any()
});

Expand Down Expand Up @@ -815,7 +815,7 @@ impl<T: StylePropValue + 'static> StylePropValue for Vec<T> {

let item_view = item.debug_view().unwrap_or_else(|| {
Label::new(format!("{:?}", item))
.style(|s| s.flex_grow(1.0))
.style(|s| s.flex_grow(1.0_f32))
.into_any()
});

Expand Down Expand Up @@ -1090,7 +1090,7 @@ impl StylePropValue for Color {
.flatten()
.style(|s| {
s.grid()
.grid_template_columns([auto(), fr(1.)])
.grid_template_columns([auto(), fr(1.0_f32)])
.justify_center()
.items_center()
.row_gap(20)
Expand Down Expand Up @@ -1309,7 +1309,7 @@ impl StylePropValue for Stroke {

Stack::vertical_from_iter(rows).style(|s| {
s.grid()
.grid_template_columns([auto(), fr(1.)])
.grid_template_columns([auto(), fr(1.0_f32)])
.justify_center()
.items_center()
.row_gap(12)
Expand Down Expand Up @@ -1642,7 +1642,7 @@ impl StylePropValue for Affine {

let components_grid = (translate_row, rotate_row, scale_row).flatten().style(|s| {
s.grid()
.grid_template_columns([auto(), fr(1.)])
.grid_template_columns([auto(), fr(1.0_f32)])
.justify_center()
.items_center()
.row_gap(8)
Expand Down
2 changes: 1 addition & 1 deletion src/view/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,7 @@ impl View for Box<dyn View> {
}

fn post_paint(&mut self, cx: &mut PaintCx) {
(**self).paint(cx)
(**self).post_paint(cx)
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/views/dropdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ impl<T: Clone + std::cmp::PartialEq + std::fmt::Debug> Dropdown<T> {
.inset_left(inset.width)
.inset_top(inset.height)
.min_width(width.get())
.flex_shrink(0.)
.flex_shrink(0.0_f32)
}),
));
self.overlay_id.unwrap().set_style_parent(self.id);
Expand Down
2 changes: 1 addition & 1 deletion src/views/resizable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ impl View for ResizeChild {
Some(
Style::new()
.apply_opt(self.set_basis_percent, |s, percent| s.flex_basis(percent))
.apply_if(self.is_last, |s| s.flex_grow(1.))
.apply_if(self.is_last, |s| s.flex_grow(1.0_f32))
.min_size(0., 0.)
.overflow_x(Overflow::Clip)
.overflow_y(Overflow::Clip),
Expand Down
2 changes: 1 addition & 1 deletion src/views/scroll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,7 @@ impl ScrollCustomStyle {
self.0
.min_size(0., 0.)
.size_full()
.flex_grow(1.)
.flex_grow(1.0_f32)
.flex_basis(0.),
);
self
Expand Down
Loading
Loading