Add cropping
This commit is contained in:
parent
4c2b72e0f9
commit
6867e0b13f
19 changed files with 1414 additions and 52 deletions
|
|
@ -60,8 +60,8 @@ impl WidgetImpl for imp::LpImage {
|
|||
let obj = self.obj();
|
||||
let widget_width = self.widget_width();
|
||||
let widget_height = self.widget_height();
|
||||
let display_width = self.image_displayed_width();
|
||||
let display_height = self.image_displayed_height();
|
||||
let display_width = obj.image_displayed_width();
|
||||
let display_height = obj.image_displayed_height();
|
||||
|
||||
let applicable_zoom = self.applicable_zoom();
|
||||
|
||||
|
|
@ -333,3 +333,19 @@ impl imp::LpImage {
|
|||
None
|
||||
}
|
||||
}
|
||||
|
||||
impl LpImage {
|
||||
pub fn image_rendering_x(&self) -> f64 {
|
||||
let imp = self.imp();
|
||||
let widget_width = imp.widget_width();
|
||||
let display_width = self.image_displayed_width();
|
||||
imp.round_f64(f64::max((widget_width - display_width) / 2.0, 0.))
|
||||
}
|
||||
|
||||
pub fn image_rendering_y(&self) -> f64 {
|
||||
let imp = self.imp();
|
||||
let widget_height = imp.widget_height();
|
||||
let display_height = self.image_displayed_height();
|
||||
imp.round_f64(f64::max((widget_height - display_height) / 2.0, 0.))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue