diff options
author | 2020-04-18 19:27:54 +0200 | |
---|---|---|
committer | 2020-07-08 10:59:57 +0200 | |
commit | f7a370b6b9b5d33d1d3c078d2865eacf813cd652 (patch) | |
tree | 248abe05293dd6d48cf4bed7b655d71c4cb12c79 /native | |
parent | afd9274de26ccf65285df02007b4ddb697bea9a3 (diff) | |
download | iced-f7a370b6b9b5d33d1d3c078d2865eacf813cd652.tar.gz iced-f7a370b6b9b5d33d1d3c078d2865eacf813cd652.tar.bz2 iced-f7a370b6b9b5d33d1d3c078d2865eacf813cd652.zip |
Implement `Overlay::translate`
Diffstat (limited to 'native')
-rw-r--r-- | native/src/overlay.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/native/src/overlay.rs b/native/src/overlay.rs index d7a1e082..57f11fbf 100644 --- a/native/src/overlay.rs +++ b/native/src/overlay.rs @@ -1,4 +1,6 @@ -use crate::{layout, Clipboard, Event, Hasher, Layer, Layout, Point, Size}; +use crate::{ + layout, Clipboard, Event, Hasher, Layer, Layout, Point, Size, Vector, +}; use std::rc::Rc; #[allow(missing_debug_implementations)] @@ -18,6 +20,11 @@ where Self { position, layer } } + pub fn translate(mut self, translation: Vector) -> Self { + self.position = self.position + translation; + self + } + pub fn map<B>(self, f: Rc<dyn Fn(Message) -> B>) -> Overlay<'a, B, Renderer> where Message: 'static, |