@@ -162,55 +162,59 @@ impl PointerHandler for WaylandState {
162162 0
163163 } ;
164164
165- if self . input_state . modifiers . shift {
166- if scroll_direction > 0 {
165+ match scroll_direction . cmp ( & 0 ) {
166+ std :: cmp :: Ordering :: Greater if self . input_state . modifiers . shift => {
167167 self . input_state . adjust_font_size ( -2.0 ) ;
168168 debug ! (
169169 "Font size decreased: {:.1}px" ,
170170 self . input_state. current_font_size
171171 ) ;
172- } else if scroll_direction < 0 {
172+ }
173+ std:: cmp:: Ordering :: Less if self . input_state . modifiers . shift => {
173174 self . input_state . adjust_font_size ( 2.0 ) ;
174175 debug ! (
175176 "Font size increased: {:.1}px" ,
176177 self . input_state. current_font_size
177178 ) ;
178179 }
179- } else if scroll_direction != 0 {
180- let delta = if scroll_direction > 0 { -1.0 } else { 1.0 } ;
181- let eraser_active = self . input_state . active_tool ( ) == Tool :: Eraser ;
182- #[ cfg( tablet) ]
183- let prev_thickness = self . input_state . current_thickness ;
180+ std :: cmp :: Ordering :: Greater | std :: cmp :: Ordering :: Less => {
181+ let delta = if scroll_direction > 0 { -1.0 } else { 1.0 } ;
182+ let eraser_active = self . input_state . active_tool ( ) == Tool :: Eraser ;
183+ #[ cfg( tablet) ]
184+ let prev_thickness = self . input_state . current_thickness ;
184185
185- if self . input_state . nudge_thickness_for_active_tool ( delta) {
186- if eraser_active {
187- debug ! (
188- "Eraser size adjusted: {:.0}px" ,
189- self . input_state. eraser_size
190- ) ;
191- } else {
192- debug ! (
193- "Thickness adjusted: {:.0}px" ,
194- self . input_state. current_thickness
195- ) ;
186+ if self . input_state . nudge_thickness_for_active_tool ( delta) {
187+ if eraser_active {
188+ debug ! (
189+ "Eraser size adjusted: {:.0}px" ,
190+ self . input_state. eraser_size
191+ ) ;
192+ } else {
193+ debug ! (
194+ "Thickness adjusted: {:.0}px" ,
195+ self . input_state. current_thickness
196+ ) ;
197+ }
198+ self . input_state . needs_redraw = true ;
196199 }
197- self . input_state . needs_redraw = true ;
198- }
199- #[ cfg( tablet) ]
200- if !eraser_active
201- && ( self . input_state . current_thickness - prev_thickness) . abs ( )
202- > f64:: EPSILON
203- {
204- self . stylus_base_thickness = Some ( self . input_state . current_thickness ) ;
205- if self . stylus_tip_down {
206- self . stylus_pressure_thickness =
200+ #[ cfg( tablet) ]
201+ if !eraser_active
202+ && ( self . input_state . current_thickness - prev_thickness) . abs ( )
203+ > f64:: EPSILON
204+ {
205+ self . stylus_base_thickness =
207206 Some ( self . input_state . current_thickness ) ;
208- self . record_stylus_peak ( self . input_state . current_thickness ) ;
209- } else {
210- self . stylus_pressure_thickness = None ;
211- self . stylus_peak_thickness = None ;
207+ if self . stylus_tip_down {
208+ self . stylus_pressure_thickness =
209+ Some ( self . input_state . current_thickness ) ;
210+ self . record_stylus_peak ( self . input_state . current_thickness ) ;
211+ } else {
212+ self . stylus_pressure_thickness = None ;
213+ self . stylus_peak_thickness = None ;
214+ }
212215 }
213216 }
217+ std:: cmp:: Ordering :: Equal => { }
214218 }
215219 }
216220 }
0 commit comments