Remove Pixels: Mul<Pixels, Output = Pixels>
impl, add ScaledPixels ops (#27451)
It doesn't make sense to have `Pixels: Mul<Pixels, Output = Pixels>` as the output should be `Pixels^2` (area), so these impls are removed. All code where these impls were used are improved by instead multiplying by `f32` or `usize`. Also adds math op impls that are present for `Pixels` but absent for `ScaledPixels`. Adds missing `Mul<Pixels> for usize` to both. Release Notes: - N/A
This commit is contained in:
parent
581d67398a
commit
9fc570c4be
9 changed files with 120 additions and 56 deletions
|
@ -4571,9 +4571,9 @@ impl Render for ProjectPanel {
|
|||
.with_render_fn(
|
||||
cx.entity().clone(),
|
||||
move |this, params, _, cx| {
|
||||
const LEFT_OFFSET: f32 = 14.;
|
||||
const PADDING_Y: f32 = 4.;
|
||||
const HITBOX_OVERDRAW: f32 = 3.;
|
||||
const LEFT_OFFSET: Pixels = px(14.);
|
||||
const PADDING_Y: Pixels = px(4.);
|
||||
const HITBOX_OVERDRAW: Pixels = px(3.);
|
||||
|
||||
let active_indent_guide_index =
|
||||
this.find_active_indent_guide(¶ms.indent_guides, cx);
|
||||
|
@ -4589,19 +4589,16 @@ impl Render for ProjectPanel {
|
|||
let offset = if layout.continues_offscreen {
|
||||
px(0.)
|
||||
} else {
|
||||
px(PADDING_Y)
|
||||
PADDING_Y
|
||||
};
|
||||
let bounds = Bounds::new(
|
||||
point(
|
||||
px(layout.offset.x as f32) * indent_size
|
||||
+ px(LEFT_OFFSET),
|
||||
px(layout.offset.y as f32) * item_height
|
||||
+ offset,
|
||||
layout.offset.x * indent_size + LEFT_OFFSET,
|
||||
layout.offset.y * item_height + offset,
|
||||
),
|
||||
size(
|
||||
px(1.),
|
||||
px(layout.length as f32) * item_height
|
||||
- px(offset.0 * 2.),
|
||||
layout.length * item_height - offset * 2.,
|
||||
),
|
||||
);
|
||||
ui::RenderedIndentGuide {
|
||||
|
@ -4610,12 +4607,11 @@ impl Render for ProjectPanel {
|
|||
is_active: Some(idx) == active_indent_guide_index,
|
||||
hitbox: Some(Bounds::new(
|
||||
point(
|
||||
bounds.origin.x - px(HITBOX_OVERDRAW),
|
||||
bounds.origin.x - HITBOX_OVERDRAW,
|
||||
bounds.origin.y,
|
||||
),
|
||||
size(
|
||||
bounds.size.width
|
||||
+ px(2. * HITBOX_OVERDRAW),
|
||||
bounds.size.width + HITBOX_OVERDRAW * 2.,
|
||||
bounds.size.height,
|
||||
),
|
||||
)),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue