Phase 5: Keyboard shortcuts and editor polish
- Tool shortcuts (editor active): B=Pen, E=Eraser, L=Line, R=Rect, C=Circle, I=Color Pick - Brush size: [/] keys decrease/increase by 2 - Zoom: 0=reset, +=zoom in, -=zoom out - Ctrl+Z=undo, Ctrl+S=commit (save edit) - A=toggle adjustments panel - Skip global hotkeys (Ctrl+B sidebar, number nav) when editor active - All 156 tests pass.
This commit is contained in:
parent
898322a398
commit
efa6d35864
@ -266,10 +266,61 @@ run_gui_app :: proc(state: ^core.Comic_State) -> shared.App_Error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if app.editor.active && !interaction_locked {
|
||||||
|
if rl.IsKeyPressed(.B) && !rl.IsKeyDown(.LEFT_CONTROL) && !rl.IsKeyDown(.RIGHT_CONTROL) {
|
||||||
|
app.editor.current_tool = .Pen
|
||||||
|
}
|
||||||
|
if rl.IsKeyPressed(.E) {
|
||||||
|
app.editor.current_tool = .Eraser
|
||||||
|
}
|
||||||
|
if rl.IsKeyPressed(.L) {
|
||||||
|
app.editor.current_tool = .Line
|
||||||
|
}
|
||||||
|
if rl.IsKeyPressed(.R) {
|
||||||
|
app.editor.current_tool = .Rectangle
|
||||||
|
}
|
||||||
|
if rl.IsKeyPressed(.C) && !rl.IsKeyDown(.LEFT_CONTROL) && !rl.IsKeyDown(.RIGHT_CONTROL) {
|
||||||
|
app.editor.current_tool = .Circle
|
||||||
|
}
|
||||||
|
if rl.IsKeyPressed(.I) {
|
||||||
|
app.editor.current_tool = .Color_Pick
|
||||||
|
}
|
||||||
|
if rl.IsKeyPressed(.LEFT_BRACKET) {
|
||||||
|
app.editor.brush_size = max(app.editor.brush_size - 2, 1)
|
||||||
|
}
|
||||||
|
if rl.IsKeyPressed(.RIGHT_BRACKET) {
|
||||||
|
app.editor.brush_size = min(app.editor.brush_size + 2, 80)
|
||||||
|
}
|
||||||
|
if rl.IsKeyPressed(.ZERO) {
|
||||||
|
app.editor.zoom = 1.0
|
||||||
|
app.editor.pan_offset = rl.Vector2{}
|
||||||
|
app.editor.needs_redraw = true
|
||||||
|
}
|
||||||
|
if rl.IsKeyPressed(.EQUAL) || rl.IsKeyPressed(.KP_ADD) {
|
||||||
|
app.editor.zoom = min(app.editor.zoom + 0.25, 8.0)
|
||||||
|
app.editor.needs_redraw = true
|
||||||
|
}
|
||||||
|
if rl.IsKeyPressed(.MINUS) || rl.IsKeyPressed(.KP_SUBTRACT) {
|
||||||
|
app.editor.zoom = max(app.editor.zoom - 0.25, 0.25)
|
||||||
|
app.editor.needs_redraw = true
|
||||||
|
}
|
||||||
|
if rl.IsKeyDown(.LEFT_CONTROL) || rl.IsKeyDown(.RIGHT_CONTROL) {
|
||||||
|
if rl.IsKeyPressed(.Z) {
|
||||||
|
editor_undo(&app.editor)
|
||||||
|
}
|
||||||
|
if rl.IsKeyPressed(.S) {
|
||||||
|
push_status(&app.status_msg, &app.action_log, editor_commit(&app))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if rl.IsKeyPressed(.A) && !rl.IsKeyDown(.LEFT_CONTROL) && !rl.IsKeyDown(.RIGHT_CONTROL) {
|
||||||
|
app.editor.show_adjust_panel = !app.editor.show_adjust_panel
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Compact mode forces the sidebar collapsed
|
// Compact mode forces the sidebar collapsed
|
||||||
if bp == .Compact { app.sidebar_collapsed = true }
|
if bp == .Compact { app.sidebar_collapsed = true }
|
||||||
|
|
||||||
if !interaction_locked {
|
if !interaction_locked && !app.editor.active {
|
||||||
if rl.IsKeyPressed(.B) && (rl.IsKeyDown(.LEFT_CONTROL) || rl.IsKeyDown(.RIGHT_CONTROL)) {
|
if rl.IsKeyPressed(.B) && (rl.IsKeyDown(.LEFT_CONTROL) || rl.IsKeyDown(.RIGHT_CONTROL)) {
|
||||||
app.sidebar_collapsed = !app.sidebar_collapsed
|
app.sidebar_collapsed = !app.sidebar_collapsed
|
||||||
status := "Sidebar expanded"
|
status := "Sidebar expanded"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user