File tree Expand file tree Collapse file tree 3 files changed +18
-4
lines changed
Expand file tree Collapse file tree 3 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -112,8 +112,15 @@ impl Adapter {
112112 let window = view. window ( ) . unwrap ( ) ;
113113 let point = window. convert_point_from_screen ( point) ;
114114 let point = view. convert_point_from_view ( point, None ) ;
115- let view_bounds = view. bounds ( ) ;
116- let point = Point :: new ( point. x , view_bounds. size . height - point. y ) ;
115+ let point = Point :: new (
116+ point. x ,
117+ if view. is_flipped ( ) {
118+ point. y
119+ } else {
120+ let view_bounds = view. bounds ( ) ;
121+ view_bounds. size . height - point. y
122+ } ,
123+ ) ;
117124
118125 let state = context. tree . read ( ) ;
119126 let root = state. root ( ) ;
Original file line number Diff line number Diff line change @@ -41,5 +41,8 @@ extern_methods!(
4141 point: NSPoint ,
4242 view: Option <& NSView >,
4343 ) -> NSPoint ;
44+
45+ #[ sel( isFlipped) ]
46+ pub ( crate ) fn is_flipped( & self ) -> bool ;
4447 }
4548) ;
Original file line number Diff line number Diff line change @@ -351,11 +351,15 @@ declare_class!(
351351 } ;
352352
353353 node. bounding_box( ) . map_or( NSRect :: ZERO , |rect| {
354- let view_bounds = view. bounds( ) ;
355354 let rect = NSRect {
356355 origin: NSPoint {
357356 x: rect. x0,
358- y: view_bounds. size. height - rect. y1,
357+ y: if view. is_flipped( ) {
358+ rect. y0
359+ } else {
360+ let view_bounds = view. bounds( ) ;
361+ view_bounds. size. height - rect. y1
362+ } ,
359363 } ,
360364 size: NSSize {
361365 width: rect. width( ) ,
You can’t perform that action at this time.
0 commit comments