@@ -5,7 +5,7 @@ use crate::engine::{EngineTask, EngineTaskSender};
55use crate :: tasks:: { OneOffTaskError , OneOffTaskHandle } ;
66use crate :: { Document , WidgetFlags } ;
77use p2d:: bounding_volume:: Aabb ;
8- use rnote_compose:: ext:: Affine2Ext ;
8+ use rnote_compose:: ext:: { AabbExt , Affine2Ext } ;
99use serde:: { Deserialize , Serialize } ;
1010use std:: time:: Duration ;
1111use tracing:: error;
@@ -132,28 +132,21 @@ impl Camera {
132132
133133 /// The minimum and maximum surface bounds (document including overshoot) in surface coordinate space.
134134 pub fn surface_mins_maxs ( & self , doc : & Document ) -> ( na:: Vector2 < f64 > , na:: Vector2 < f64 > ) {
135- let bounds = self
135+ let document_bounds = self
136136 . document_to_view_transform ( )
137137 . transform_aabb ( doc. bounds ( ) ) ;
138138
139- let ( h_lower, h_upper) = match doc. config . layout {
140- Layout :: FixedSize | Layout :: ContinuousVertical => (
141- bounds. mins . x - Self :: OVERSHOOT_HORIZONTAL ,
142- bounds. maxs . x + Self :: OVERSHOOT_HORIZONTAL ,
143- ) ,
144- Layout :: SemiInfinite => ( bounds. mins . x - Self :: OVERSHOOT_HORIZONTAL , bounds. maxs . x ) ,
145- Layout :: Infinite => ( bounds. mins . x , bounds. maxs . x ) ,
146- } ;
147- let ( v_lower, v_upper) = match doc. config . layout {
148- Layout :: FixedSize | Layout :: ContinuousVertical => (
149- bounds. mins . y - Self :: OVERSHOOT_VERTICAL ,
150- bounds. maxs . y + Self :: OVERSHOOT_VERTICAL ,
151- ) ,
152- Layout :: SemiInfinite => ( bounds. mins . y - Self :: OVERSHOOT_VERTICAL , bounds. maxs . y ) ,
153- Layout :: Infinite => ( bounds. mins . y , bounds. maxs . y ) ,
139+ let bounds = match doc. config . layout {
140+ Layout :: FixedSize | Layout :: ContinuousVertical | Layout :: SemiInfinite => {
141+ document_bounds. extend_by ( na:: vector![
142+ Self :: OVERSHOOT_HORIZONTAL ,
143+ Self :: OVERSHOOT_VERTICAL
144+ ] )
145+ }
146+ Layout :: Infinite => document_bounds,
154147 } ;
155148
156- ( na :: vector! [ h_lower , v_lower ] , na :: vector! [ h_upper , v_upper ] )
149+ ( bounds . mins . coords , bounds . maxs . coords )
157150 }
158151
159152 /// The current viewport size in surface coordinate space.
0 commit comments