Use with_translation wherever possible
This commit is contained in:
parent
d8dffa411b
commit
a06682ff42
3 changed files with 29 additions and 38 deletions
|
|
@ -7,7 +7,7 @@ use crate::core::renderer;
|
||||||
use crate::core::widget::tree::{self, Tree};
|
use crate::core::widget::tree::{self, Tree};
|
||||||
use crate::core::{
|
use crate::core::{
|
||||||
Clipboard, Element, Layout, Length, Pixels, Point, Rectangle, Shell, Size,
|
Clipboard, Element, Layout, Length, Pixels, Point, Rectangle, Shell, Size,
|
||||||
Transformation, Vector, Widget,
|
Vector, Widget,
|
||||||
};
|
};
|
||||||
|
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
|
|
@ -328,21 +328,18 @@ where
|
||||||
};
|
};
|
||||||
|
|
||||||
renderer.with_layer(bounds, |renderer| {
|
renderer.with_layer(bounds, |renderer| {
|
||||||
renderer.with_transformation(
|
renderer.with_translation(translation, |renderer| {
|
||||||
Transformation::translate(translation.x, translation.y),
|
image::Renderer::draw(
|
||||||
|renderer| {
|
renderer,
|
||||||
image::Renderer::draw(
|
self.handle.clone(),
|
||||||
renderer,
|
self.filter_method,
|
||||||
self.handle.clone(),
|
Rectangle {
|
||||||
self.filter_method,
|
x: bounds.x,
|
||||||
Rectangle {
|
y: bounds.y,
|
||||||
x: bounds.x,
|
..Rectangle::with_size(image_size)
|
||||||
y: bounds.y,
|
},
|
||||||
..Rectangle::with_size(image_size)
|
);
|
||||||
},
|
});
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ use crate::core::widget;
|
||||||
use crate::core::widget::tree::{self, Tree};
|
use crate::core::widget::tree::{self, Tree};
|
||||||
use crate::core::{
|
use crate::core::{
|
||||||
Clipboard, Element, Layout, Length, Pixels, Point, Rectangle, Shell, Size,
|
Clipboard, Element, Layout, Length, Pixels, Point, Rectangle, Shell, Size,
|
||||||
Transformation, Vector, Widget,
|
Vector, Widget,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// A collection of panes distributed using either vertical or horizontal splits
|
/// A collection of panes distributed using either vertical or horizontal splits
|
||||||
|
|
@ -965,21 +965,18 @@ pub fn draw<Theme, Renderer, T>(
|
||||||
let translation = cursor_position
|
let translation = cursor_position
|
||||||
- Point::new(bounds.x + origin.x, bounds.y + origin.y);
|
- Point::new(bounds.x + origin.x, bounds.y + origin.y);
|
||||||
|
|
||||||
renderer.with_transformation(
|
renderer.with_translation(translation, |renderer| {
|
||||||
Transformation::translate(translation.x, translation.y),
|
renderer.with_layer(bounds, |renderer| {
|
||||||
|renderer| {
|
draw_pane(
|
||||||
renderer.with_layer(bounds, |renderer| {
|
pane,
|
||||||
draw_pane(
|
renderer,
|
||||||
pane,
|
default_style,
|
||||||
renderer,
|
layout,
|
||||||
default_style,
|
pane_cursor,
|
||||||
layout,
|
viewport,
|
||||||
pane_cursor,
|
);
|
||||||
viewport,
|
});
|
||||||
);
|
});
|
||||||
});
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,7 @@ use crate::core::mouse;
|
||||||
use crate::core::renderer::{self, Renderer as _};
|
use crate::core::renderer::{self, Renderer as _};
|
||||||
use crate::core::widget::Tree;
|
use crate::core::widget::Tree;
|
||||||
use crate::core::{
|
use crate::core::{
|
||||||
Color, Element, Layout, Length, Point, Rectangle, Size, Transformation,
|
Color, Element, Layout, Length, Point, Rectangle, Size, Vector, Widget,
|
||||||
Vector, Widget,
|
|
||||||
};
|
};
|
||||||
use crate::graphics::geometry::Renderer as _;
|
use crate::graphics::geometry::Renderer as _;
|
||||||
use crate::Renderer;
|
use crate::Renderer;
|
||||||
|
|
@ -120,10 +119,8 @@ impl<'a, Message, Theme> Widget<Message, Theme, Renderer> for QRCode<'a> {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
let translation = Vector::new(bounds.x, bounds.y);
|
renderer.with_translation(
|
||||||
|
bounds.position() - Point::ORIGIN,
|
||||||
renderer.with_transformation(
|
|
||||||
Transformation::translate(translation.x, translation.y),
|
|
||||||
|renderer| {
|
|renderer| {
|
||||||
renderer.draw(vec![geometry]);
|
renderer.draw(vec![geometry]);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue