Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ All configuration is done either at the config file in `XDG_CONFIG_DIR/.config/s

<kbd>1</kbd>, <kbd>2</kbd>, <kbd>3</kbd>, …, <kbd>9</kbd>, <kbd>0</kbd> — select nth color from the color palette

If out of range select custom color <sup>NEXTRELEASE</sup>

#### Tool Selection Shortcuts (configurable) <sup>0.20.0</sup>
Default single-key shortcuts:
- <kbd>p</kbd>: Pointer tool
Expand Down
10 changes: 7 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,15 @@ impl Component for App {
.emit(ToolsToolbarInput::SwitchSelectedTool(tool));
}
AppInput::ColorSwitchShortcut(index) => {
let palette_len = APP_CONFIG.read().color_palette().palette().len() as u64;
let color_button = if index < palette_len {
ui::toolbars::ColorButtons::Palette(index)
} else {
ui::toolbars::ColorButtons::Custom
};
self.style_toolbar
.sender()
.emit(StyleToolbarInput::ColorButtonSelected(
ui::toolbars::ColorButtons::Palette(index),
));
.emit(StyleToolbarInput::ColorButtonSelected(color_button));
}
AppInput::ScaleFactorChanged => {
self.sketch_board
Expand Down
10 changes: 3 additions & 7 deletions src/sketch_board.rs
Original file line number Diff line number Diff line change
Expand Up @@ -895,13 +895,9 @@ impl SketchBoard {
} else {
hotkey_digit - 1
};
if APP_CONFIG.read().color_palette().palette().len()
>= (index_digit + 1) as usize
{
sender
.output_sender()
.emit(SketchBoardOutput::ColorSwitchShortcut(index_digit as u64));
}
sender
.output_sender()
.emit(SketchBoardOutput::ColorSwitchShortcut(index_digit as u64));
}
}
TextEventMsg::Preedit {
Expand Down
Loading