Use info from events, and textbox place tool works with events

This commit is contained in:
Yousef Khadadeh 2026-03-03 10:18:47 +03:00
parent 3dc2455f13
commit 803eb2c08a
10 changed files with 72 additions and 58 deletions

View file

@ -77,6 +77,11 @@ void DrawingProgram::input_mouse_button_callback(const InputManager::MouseButton
else if(!button.down && button.button != InputManager::MouseButton::RIGHT) {
drawTool->input_mouse_button_on_canvas_callback(button);
}
if(toolToSwitchToAfterUpdate) {
switch_to_tool_ptr(std::move(toolToSwitchToAfterUpdate));
toolToSwitchToAfterUpdate = nullptr;
}
}
void DrawingProgram::input_mouse_motion_callback(const InputManager::MouseMotionCallbackArgs& motion) {
@ -385,12 +390,6 @@ void DrawingProgram::update() {
selection.update();
drawTool->tool_update();
// Switch tools after the tool update, not before, so that we dont have to call erase_component on the toolToSwitchToAfterUpdate as well (components will not be erased in this time period)
if(toolToSwitchToAfterUpdate) {
switch_to_tool_ptr(std::move(toolToSwitchToAfterUpdate));
toolToSwitchToAfterUpdate = nullptr;
}
if(controls.leftClickReleased)
controls.leftClickReleased = false;