@@ -5,6 +5,7 @@ use crate::util;
55use log:: { info, warn} ;
66const KEYBOARD_NUDGE_SMALL : i32 = 8 ;
77const KEYBOARD_NUDGE_LARGE : i32 = 32 ;
8+ const PROPERTIES_PANEL_COARSE_STEP : i32 = 5 ;
89
910use super :: {
1011 DrawingState , InputState , MAX_STROKE_THICKNESS , MIN_STROKE_THICKNESS , SelectionAxis ,
@@ -45,8 +46,31 @@ impl InputState {
4546 _ => { }
4647 }
4748
48- if matches ! ( key, Key :: Escape ) && self . properties_panel ( ) . is_some ( ) {
49- self . close_properties_panel ( ) ;
49+ if self . is_properties_panel_open ( ) {
50+ let adjust_step = if self . modifiers . shift {
51+ PROPERTIES_PANEL_COARSE_STEP
52+ } else {
53+ 1
54+ } ;
55+ let handled = match key {
56+ Key :: Escape => {
57+ self . close_properties_panel ( ) ;
58+ true
59+ }
60+ Key :: Up => self . focus_previous_properties_entry ( ) ,
61+ Key :: Down => self . focus_next_properties_entry ( ) ,
62+ Key :: Home => self . focus_first_properties_entry ( ) ,
63+ Key :: End => self . focus_last_properties_entry ( ) ,
64+ Key :: Return | Key :: Space => self . activate_properties_panel_entry ( ) ,
65+ Key :: Left => self . adjust_properties_panel_entry ( -adjust_step) ,
66+ Key :: Right => self . adjust_properties_panel_entry ( adjust_step) ,
67+ Key :: Char ( '+' ) | Key :: Char ( '=' ) => self . adjust_properties_panel_entry ( adjust_step) ,
68+ Key :: Char ( '-' ) | Key :: Char ( '_' ) => self . adjust_properties_panel_entry ( -adjust_step) ,
69+ _ => false ,
70+ } ;
71+ if handled {
72+ return ;
73+ }
5074 return ;
5175 }
5276
@@ -341,7 +365,10 @@ impl InputState {
341365
342366 /// Handle an action triggered by a keybinding.
343367 pub ( super ) fn handle_action ( & mut self , action : Action ) {
344- if !matches ! ( action, Action :: OpenContextMenu ) {
368+ if !matches ! (
369+ action,
370+ Action :: OpenContextMenu | Action :: ToggleSelectionProperties
371+ ) {
345372 self . close_properties_panel ( ) ;
346373 }
347374
@@ -755,6 +782,17 @@ impl InputState {
755782 self . toggle_context_menu_via_keyboard ( ) ;
756783 }
757784 }
785+ Action :: ToggleSelectionProperties => {
786+ if matches ! ( self . state, DrawingState :: Idle ) {
787+ if self . properties_panel ( ) . is_some ( ) {
788+ self . close_properties_panel ( ) ;
789+ } else if self . show_properties_panel ( ) {
790+ self . close_context_menu ( ) ;
791+ } else {
792+ self . set_ui_toast ( UiToastKind :: Warning , "No selection to edit." ) ;
793+ }
794+ }
795+ }
758796 Action :: OpenConfigurator => {
759797 self . launch_configurator ( ) ;
760798 }
0 commit comments