File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -43,3 +43,20 @@ pub enum Event {
43
43
/// Frame events
44
44
Frame ( Instant , WlSurface , Id ) ,
45
45
}
46
+
47
+ impl Event {
48
+ /// Translate the event by some vector
49
+ pub fn translate ( & mut self , vector : crate :: vector:: Vector ) {
50
+ match self {
51
+ Event :: DndOffer ( DndOfferEvent :: Enter { x, y, .. } ) => {
52
+ * x += vector. x as f64 ;
53
+ * y += vector. y as f64 ;
54
+ }
55
+ Event :: DndOffer ( DndOfferEvent :: Motion { x, y } ) => {
56
+ * x += vector. x as f64 ;
57
+ * y += vector. y as f64 ;
58
+ }
59
+ _ => { }
60
+ }
61
+ }
62
+ }
Original file line number Diff line number Diff line change @@ -657,7 +657,7 @@ pub fn layout<Renderer>(
657
657
/// accordingly.
658
658
pub fn update < Message > (
659
659
state : & mut State ,
660
- event : Event ,
660
+ # [ allow ( unused_mut ) ] mut event : Event ,
661
661
layout : Layout < ' _ > ,
662
662
cursor : mouse:: Cursor ,
663
663
clipboard : & mut dyn Clipboard ,
@@ -699,6 +699,14 @@ pub fn update<Message>(
699
699
700
700
let translation = state. translation ( direction, bounds, content_bounds) ;
701
701
702
+ #[ cfg( feature = "wayland" ) ]
703
+ if let Event :: PlatformSpecific (
704
+ iced_runtime:: core:: event:: PlatformSpecific :: Wayland ( e) ,
705
+ ) = & mut event
706
+ {
707
+ e. translate ( translation) ;
708
+ }
709
+
702
710
update_content (
703
711
event. clone ( ) ,
704
712
content,
You can’t perform that action at this time.
0 commit comments