chore: clippy
This commit is contained in:
parent
3b70bc0265
commit
0847247c33
77 changed files with 865 additions and 1029 deletions
|
|
@ -80,7 +80,7 @@ impl OutputZoomState {
|
|||
let focal_point = if output_geometry.contains(cursor_position) {
|
||||
match movement {
|
||||
ZoomMovement::Continuously | ZoomMovement::OnEdge => {
|
||||
cursor_position.to_local(&output)
|
||||
cursor_position.to_local(output)
|
||||
}
|
||||
ZoomMovement::Centered => {
|
||||
let mut zoomed_output_geometry = output.geometry().to_f64().downscale(level);
|
||||
|
|
@ -89,18 +89,18 @@ impl OutputZoomState {
|
|||
|
||||
let mut focal_point = zoomed_output_geometry
|
||||
.loc
|
||||
.to_local(&output)
|
||||
.to_local(output)
|
||||
.upscale(level)
|
||||
.to_global(&output);
|
||||
.to_global(output);
|
||||
focal_point.x = focal_point.x.clamp(
|
||||
output_geometry.loc.x as f64,
|
||||
((output_geometry.loc.x + output_geometry.size.w) as f64).next_lower(), // FIXME: Replace with f64::next_down when stable
|
||||
output_geometry.loc.x,
|
||||
(output_geometry.loc.x + output_geometry.size.w).next_lower(), // FIXME: Replace with f64::next_down when stable
|
||||
);
|
||||
focal_point.y = focal_point.y.clamp(
|
||||
output_geometry.loc.y as f64,
|
||||
((output_geometry.loc.y + output_geometry.size.h) as f64).next_lower(), // FIXME: Replace with f64::next_down when stable
|
||||
output_geometry.loc.y,
|
||||
(output_geometry.loc.y + output_geometry.size.h).next_lower(), // FIXME: Replace with f64::next_down when stable
|
||||
);
|
||||
focal_point.to_local(&output)
|
||||
focal_point.to_local(output)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
@ -282,16 +282,16 @@ impl ZoomState {
|
|||
if !zoomed_output_geometry
|
||||
.overlaps_or_touches(Rectangle::new(original_position, Size::from((16, 16))))
|
||||
{
|
||||
zoomed_output_geometry.loc = cursor_position.to_global(&output)
|
||||
zoomed_output_geometry.loc = cursor_position.to_global(output)
|
||||
- zoomed_output_geometry.size.downscale(2).to_point();
|
||||
let mut focal_point = zoomed_output_geometry
|
||||
.loc
|
||||
.to_local(&output)
|
||||
.to_local(output)
|
||||
.upscale(
|
||||
output_geometry.size.w
|
||||
/ (output_geometry.size.w - zoomed_output_geometry.size.w),
|
||||
)
|
||||
.to_global(&output);
|
||||
.to_global(output);
|
||||
focal_point.x = focal_point.x.clamp(
|
||||
output_geometry.loc.x,
|
||||
output_geometry.loc.x + output_geometry.size.w - 1,
|
||||
|
|
@ -302,10 +302,10 @@ impl ZoomState {
|
|||
);
|
||||
output_state_ref.previous_point =
|
||||
Some((output_state_ref.focal_point, Instant::now()));
|
||||
output_state_ref.focal_point = focal_point.to_local(&output).to_f64();
|
||||
} else if !zoomed_output_geometry.contains(cursor_position.to_global(&output)) {
|
||||
let mut diff = output_state_ref.focal_point.to_global(&output)
|
||||
+ (cursor_position.to_global(&output) - original_position)
|
||||
output_state_ref.focal_point = focal_point.to_local(output).to_f64();
|
||||
} else if !zoomed_output_geometry.contains(cursor_position.to_global(output)) {
|
||||
let mut diff = output_state_ref.focal_point.to_global(output)
|
||||
+ (cursor_position.to_global(output) - original_position)
|
||||
.to_f64()
|
||||
.upscale(output_state_ref.level);
|
||||
diff.x = diff.x.clamp(
|
||||
|
|
@ -316,18 +316,18 @@ impl ZoomState {
|
|||
output_geometry.loc.y as f64,
|
||||
((output_geometry.loc.y + output_geometry.size.h) as f64).next_lower(), // FIXME: Replace with f64::next_down when stable
|
||||
);
|
||||
diff -= output_state_ref.focal_point.to_global(&output);
|
||||
diff -= output_state_ref.focal_point.to_global(output);
|
||||
|
||||
output_state_ref.focal_point += diff.as_logical().as_local();
|
||||
}
|
||||
}
|
||||
ZoomMovement::Centered => {
|
||||
zoomed_output_geometry.loc = cursor_position.to_global(&output)
|
||||
zoomed_output_geometry.loc = cursor_position.to_global(output)
|
||||
- zoomed_output_geometry.size.downscale(2).to_point();
|
||||
|
||||
let mut focal_point = zoomed_output_geometry
|
||||
.loc
|
||||
.to_local(&output)
|
||||
.to_local(output)
|
||||
.upscale(
|
||||
output_geometry
|
||||
.size
|
||||
|
|
@ -335,7 +335,7 @@ impl ZoomState {
|
|||
.checked_div(output_geometry.size.w - zoomed_output_geometry.size.w)
|
||||
.unwrap_or(1),
|
||||
)
|
||||
.to_global(&output);
|
||||
.to_global(output);
|
||||
focal_point.x = focal_point.x.clamp(
|
||||
output_geometry.loc.x,
|
||||
output_geometry.loc.x + output_geometry.size.w - 1,
|
||||
|
|
@ -344,7 +344,7 @@ impl ZoomState {
|
|||
output_geometry.loc.y,
|
||||
output_geometry.loc.y + output_geometry.size.h - 1,
|
||||
);
|
||||
output_state_ref.focal_point = focal_point.to_local(&output).to_f64();
|
||||
output_state_ref.focal_point = focal_point.to_local(output).to_f64();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue