Route canvas input mode switching through planner

This commit is contained in:
2026-06-03 11:28:41 +02:00
parent 91e1c2c9a3
commit c56d301b29
3 changed files with 28 additions and 7 deletions

View File

@@ -44,7 +44,7 @@ agent or engineer to remove them without reconstructing context from chat.
| DEBT-0024 | Open | Modernization | Grid/heightmap/lightmap UI planning now consumes pure `pp_app_core` through `NodePanelGrid` and `pano_cli plan-grid-operation`, but live execution still performs legacy image loading, OpenGL texture updates, nanort lightmap baking, progress UI, and `Canvas::draw_objects` commit directly | Preserve grid/lightmap behavior while moving renderable grid commands toward app/renderer/document boundaries | `pp_app_core_grid_ui_tests`; `pano_cli plan-grid-operation --kind render --float32 --texture-resolution 1024 --samples 32`; `ctest --preset desktop-fast --build-config Debug` | Grid heightmap/lightmap execution is owned by app/renderer/document services with `NodePanelGrid` acting only as UI adapter | | DEBT-0024 | Open | Modernization | Grid/heightmap/lightmap UI planning now consumes pure `pp_app_core` through `NodePanelGrid` and `pano_cli plan-grid-operation`, but live execution still performs legacy image loading, OpenGL texture updates, nanort lightmap baking, progress UI, and `Canvas::draw_objects` commit directly | Preserve grid/lightmap behavior while moving renderable grid commands toward app/renderer/document boundaries | `pp_app_core_grid_ui_tests`; `pano_cli plan-grid-operation --kind render --float32 --texture-resolution 1024 --samples 32`; `ctest --preset desktop-fast --build-config Debug` | Grid heightmap/lightmap execution is owned by app/renderer/document services with `NodePanelGrid` acting only as UI adapter |
| DEBT-0025 | Open | Modernization | Quick brush/color slot and mini-state planning now consumes pure `pp_app_core` through `NodePanelQuick` and `pano_cli plan-quick-operation`, but live execution still mutates legacy quick UI widgets, `Brush` previews, color picker popup state, and preset popup state directly | Preserve quick-panel behavior while quick brush/color commands move toward a brush/app command boundary with safer automation coverage | `pp_app_core_quick_ui_tests`; `pano_cli plan-quick-operation --kind brush --current-index 0 --slot-index 2`; `pano_cli plan-quick-operation --kind restore --brush-index 2 --color-index 1 --fire-event`; `ctest --preset desktop-fast --build-config Debug` | Quick-panel selection, popup, restore, reset, brush preview, and color execution are owned by app/brush/UI services with `NodePanelQuick` acting only as UI adapter | | DEBT-0025 | Open | Modernization | Quick brush/color slot and mini-state planning now consumes pure `pp_app_core` through `NodePanelQuick` and `pano_cli plan-quick-operation`, but live execution still mutates legacy quick UI widgets, `Brush` previews, color picker popup state, and preset popup state directly | Preserve quick-panel behavior while quick brush/color commands move toward a brush/app command boundary with safer automation coverage | `pp_app_core_quick_ui_tests`; `pano_cli plan-quick-operation --kind brush --current-index 0 --slot-index 2`; `pano_cli plan-quick-operation --kind restore --brush-index 2 --color-index 1 --fire-event`; `ctest --preset desktop-fast --build-config Debug` | Quick-panel selection, popup, restore, reset, brush preview, and color execution are owned by app/brush/UI services with `NodePanelQuick` acting only as UI adapter |
| DEBT-0026 | Open | Modernization | Toolbar and canvas history command planning now consumes pure `pp_app_core` through `App::init_toolbar_main`, `NodeCanvas`, and `pano_cli plan-history-operation`, but live execution still mutates legacy `ActionManager` stacks and `Canvas::I` unsaved state directly | Preserve undo/redo/clear behavior while moving action history toward document/app command services | `pp_app_core_history_ui_tests`; `pano_cli plan-history-operation --kind undo --undo-count 2`; `pano_cli plan-history-operation --kind clear --undo-count 2 --redo-count 1 --memory-bytes 4096`; `ctest --preset desktop-fast --build-config Debug` | Undo/redo/clear execution is owned by document/app history services with toolbar and canvas input acting only as adapters | | DEBT-0026 | Open | Modernization | Toolbar and canvas history command planning now consumes pure `pp_app_core` through `App::init_toolbar_main`, `NodeCanvas`, and `pano_cli plan-history-operation`, but live execution still mutates legacy `ActionManager` stacks and `Canvas::I` unsaved state directly | Preserve undo/redo/clear behavior while moving action history toward document/app command services | `pp_app_core_history_ui_tests`; `pano_cli plan-history-operation --kind undo --undo-count 2`; `pano_cli plan-history-operation --kind clear --undo-count 2 --redo-count 1 --memory-bytes 4096`; `ctest --preset desktop-fast --build-config Debug` | Undo/redo/clear execution is owned by document/app history services with toolbar and canvas input acting only as adapters |
| DEBT-0027 | Open | Modernization | Canvas draw-tool toolbar command and active-state planning now consume pure `pp_app_core` through `App::init_toolbar_draw`, `App::update`, `pano_cli plan-canvas-tool`, and `pano_cli plan-canvas-tool-state`, but live execution/state storage still mutates or reads legacy `Canvas` mode state, pen picking state, touch-lock state, and transform copy/cut action objects directly | Preserve current toolbar behavior while canvas input/tools move toward an app/document command boundary | `pp_app_core_canvas_tool_ui_tests`; `pano_cli plan-canvas-tool --kind copy`; `pano_cli plan-canvas-tool-state --mode draw --picking --touch-lock`; `ctest --preset desktop-fast --build-config Debug` | Canvas tool selection, toolbar state refresh, picking, touch lock, and transform action execution are owned by app/document/canvas services with toolbar callbacks acting only as adapters | | DEBT-0027 | Open | Modernization | Canvas draw-tool toolbar command, canvas input mode switching, and active-state planning now consume pure `pp_app_core` through `App::init_toolbar_draw`, `App::update`, `NodeCanvas`, `pano_cli plan-canvas-tool`, and `pano_cli plan-canvas-tool-state`, but live execution/state storage still mutates or reads legacy `Canvas` mode state, pen picking state, touch-lock state, and transform copy/cut action objects directly | Preserve current toolbar, stylus eraser, and keyboard draw/erase behavior while canvas input/tools move toward an app/document command boundary | `pp_app_core_canvas_tool_ui_tests`; `pano_cli plan-canvas-tool --kind copy`; `pano_cli plan-canvas-tool-state --mode draw --picking --touch-lock`; `ctest --preset desktop-fast --build-config Debug` | Canvas tool selection, toolbar state refresh, picking, touch lock, stylus eraser/key mode switching, and transform action execution are owned by app/document/canvas services with toolbar/canvas callbacks acting only as adapters |
## Closed Debt ## Closed Debt

View File

@@ -504,7 +504,9 @@ camera, grid, copy, cut, fill, mask, flood-fill, pick, and touch-lock toolbar
commands before legacy `Canvas` mode, pen picking, touch-lock, and transform commands before legacy `Canvas` mode, pen picking, touch-lock, and transform
state mutation continue. `pano_cli plan-canvas-tool-state` exposes the matching state mutation continue. `pano_cli plan-canvas-tool-state` exposes the matching
toolbar active-state refresh used by `App::update` before legacy `Canvas` mode toolbar active-state refresh used by `App::update` before legacy `Canvas` mode
state remains the source of truth. state remains the source of truth. `NodeCanvas` stylus eraser and `E` key
draw/erase mode switching also consume the same app-core command planner before
legacy canvas mode execution continues.
`pano_cli plan-grid-operation` exposes app-core planning for grid heightmap `pano_cli plan-grid-operation` exposes app-core planning for grid heightmap
pick/load/reload/clear, lightmap render capability/limit checks, and heightmap pick/load/reload/clear, lightmap render capability/limit checks, and heightmap
commit used by the live grid panel before legacy image loading, OpenGL texture commit used by the live grid panel before legacy image loading, OpenGL texture

View File

@@ -2,6 +2,7 @@
#include <cstdint> #include <cstdint>
#include "app_core/canvas_tool_ui.h"
#include "app_core/history_ui.h" #include "app_core/history_ui.h"
#include "app.h" #include "app.h"
#include "log.h" #include "log.h"
@@ -36,6 +37,24 @@ void run_history_redo_if_available()
ActionManager::redo(); ActionManager::redo();
} }
void run_canvas_tool_mode(pp::app::CanvasToolMode mode)
{
const auto plan = pp::app::plan_canvas_tool_select(mode);
if (!plan.updates_canvas_mode)
return;
switch (plan.mode) {
case pp::app::CanvasToolMode::draw:
Canvas::set_mode(kCanvasMode::Draw);
return;
case pp::app::CanvasToolMode::erase:
Canvas::set_mode(kCanvasMode::Erase);
return;
default:
return;
}
}
} }
Node* NodeCanvas::clone_instantiate() const Node* NodeCanvas::clone_instantiate() const
@@ -588,9 +607,9 @@ kEventResult NodeCanvas::handle_event(Event* e)
case kEventType::MouseMove: case kEventType::MouseMove:
if (stylus_eraser != me->m_eraser) if (stylus_eraser != me->m_eraser)
{ {
Canvas::set_mode(me->m_eraser ? run_canvas_tool_mode(me->m_eraser ?
kCanvasMode::Erase : pp::app::CanvasToolMode::erase :
kCanvasMode::Draw); pp::app::CanvasToolMode::draw);
stylus_eraser = me->m_eraser; stylus_eraser = me->m_eraser;
} }
case kEventType::MouseScroll: case kEventType::MouseScroll:
@@ -613,7 +632,7 @@ kEventResult NodeCanvas::handle_event(Event* e)
break; break;
case kEventType::KeyDown: case kEventType::KeyDown:
if (ke->m_key == kKey::KeyE) if (ke->m_key == kKey::KeyE)
Canvas::set_mode(kCanvasMode::Erase); run_canvas_tool_mode(pp::app::CanvasToolMode::erase);
if (ke->m_key == kKey::AndroidBack) if (ke->m_key == kKey::AndroidBack)
run_history_undo_if_available(); run_history_undo_if_available();
if (ke->m_key == kKey::KeyAlt && m_mouse_focus) if (ke->m_key == kKey::KeyAlt && m_mouse_focus)
@@ -624,7 +643,7 @@ kEventResult NodeCanvas::handle_event(Event* e)
case kEventType::KeyUp: case kEventType::KeyUp:
update_cursor(); update_cursor();
if (ke->m_key == kKey::KeyE) if (ke->m_key == kKey::KeyE)
Canvas::set_mode(kCanvasMode::Draw); run_canvas_tool_mode(pp::app::CanvasToolMode::draw);
if (ke->m_key == kKey::KeyTab) if (ke->m_key == kKey::KeyTab)
App::I->toggle_ui(); App::I->toggle_ui();
if (ke->m_key == kKey::KeyZ && App::I->keys[(int)kKey::KeyCtrl]) if (ke->m_key == kKey::KeyZ && App::I->keys[(int)kKey::KeyCtrl])