Pen events passed to tools
This commit is contained in:
parent
5b6316bd15
commit
4814780bec
10 changed files with 141 additions and 17 deletions
|
|
@ -159,6 +159,7 @@ void DrawingProgram::input_key_callback(const InputManager::KeyCallbackArgs& key
|
|||
else if(!key.down && tempMoveToolSwitch == TemporaryMoveToolSwitch::PAN) {
|
||||
switch_to_tool(toolTypeAfterTempMove);
|
||||
tempMoveToolSwitch = TemporaryMoveToolSwitch::NONE;
|
||||
pen_tool_switch_check();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -171,6 +172,7 @@ void DrawingProgram::input_key_callback(const InputManager::KeyCallbackArgs& key
|
|||
else if(!key.down && tempMoveToolSwitch == TemporaryMoveToolSwitch::ZOOM) {
|
||||
switch_to_tool(toolTypeAfterTempMove);
|
||||
tempMoveToolSwitch = TemporaryMoveToolSwitch::NONE;
|
||||
pen_tool_switch_check();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -178,6 +180,34 @@ void DrawingProgram::input_key_callback(const InputManager::KeyCallbackArgs& key
|
|||
drawTool->input_key_callback(key);
|
||||
}
|
||||
|
||||
void DrawingProgram::input_pure_mouse_button_callback(const InputManager::MouseButtonCallbackArgs& button) {
|
||||
drawTool->input_pure_mouse_button_callback(button);
|
||||
}
|
||||
|
||||
void DrawingProgram::input_pure_mouse_motion_callback(const InputManager::MouseMotionCallbackArgs& motion) {
|
||||
drawTool->input_pure_mouse_motion_callback(motion);
|
||||
}
|
||||
|
||||
void DrawingProgram::input_pen_button_callback(const InputManager::PenButtonCallbackArgs& button) {
|
||||
pen_tool_switch_check();
|
||||
drawTool->input_pen_button_callback(button);
|
||||
}
|
||||
|
||||
void DrawingProgram::input_pen_touch_callback(const InputManager::PenTouchCallbackArgs& touch) {
|
||||
pen_tool_switch_check();
|
||||
drawTool->input_pen_touch_callback(touch);
|
||||
}
|
||||
|
||||
void DrawingProgram::input_pen_motion_callback(const InputManager::PenMotionCallbackArgs& motion) {
|
||||
pen_tool_switch_check();
|
||||
drawTool->input_pen_motion_callback(motion);
|
||||
}
|
||||
|
||||
void DrawingProgram::input_pen_axis_callback(const InputManager::PenAxisCallbackArgs& axis) {
|
||||
pen_tool_switch_check();
|
||||
drawTool->input_pen_axis_callback(axis);
|
||||
}
|
||||
|
||||
void DrawingProgram::server_init_no_file() {
|
||||
layerMan.server_init_no_file();
|
||||
}
|
||||
|
|
@ -372,8 +402,6 @@ void DrawingProgram::modify_grid(const NetworkingObjects::NetObjWeakPtr<WorldGri
|
|||
}
|
||||
|
||||
void DrawingProgram::update() {
|
||||
tool_temporary_switch_update();
|
||||
|
||||
controls.cursorHoveringOverCanvas = world.main.toolbar.check_if_position_isnt_obstructed(world.main.input.mouse.pos);
|
||||
|
||||
controls.previousMouseWorldPos = controls.currentMouseWorldPos;
|
||||
|
|
@ -386,7 +414,6 @@ void DrawingProgram::update() {
|
|||
|
||||
drag_drop_update();
|
||||
|
||||
|
||||
selection.update();
|
||||
drawTool->tool_update();
|
||||
|
||||
|
|
@ -400,7 +427,7 @@ void DrawingProgram::update() {
|
|||
rebuild_cache();
|
||||
}
|
||||
|
||||
void DrawingProgram::tool_temporary_switch_update() {
|
||||
void DrawingProgram::pen_tool_switch_check() {
|
||||
if(world.main.input.pen.isEraser && !temporaryEraser && tempMoveToolSwitch == TemporaryMoveToolSwitch::NONE) {
|
||||
if(drawTool->get_type() == DrawingProgramToolType::BRUSH)
|
||||
switch_to_tool(DrawingProgramToolType::ERASER);
|
||||
|
|
|
|||
|
|
@ -61,6 +61,12 @@ class DrawingProgram {
|
|||
void input_key_callback(const InputManager::KeyCallbackArgs& key);
|
||||
void input_mouse_button_callback(const InputManager::MouseButtonCallbackArgs& button);
|
||||
void input_mouse_motion_callback(const InputManager::MouseMotionCallbackArgs& motion);
|
||||
void input_pure_mouse_button_callback(const InputManager::MouseButtonCallbackArgs& button);
|
||||
void input_pure_mouse_motion_callback(const InputManager::MouseMotionCallbackArgs& motion);
|
||||
void input_pen_button_callback(const InputManager::PenButtonCallbackArgs& button);
|
||||
void input_pen_touch_callback(const InputManager::PenTouchCallbackArgs& touch);
|
||||
void input_pen_motion_callback(const InputManager::PenMotionCallbackArgs& motion);
|
||||
void input_pen_axis_callback(const InputManager::PenAxisCallbackArgs& axis);
|
||||
private:
|
||||
void process_transform_message(const std::vector<std::pair<NetworkingObjects::NetObjID, CoordSpaceHelper>>& transforms);
|
||||
|
||||
|
|
@ -86,7 +92,7 @@ class DrawingProgram {
|
|||
std::unique_ptr<DrawingProgramToolBase> toolToSwitchToAfterUpdate;
|
||||
std::unordered_set<CanvasComponentContainer::ObjInfo*> updateableComponents;
|
||||
|
||||
void tool_temporary_switch_update();
|
||||
void pen_tool_switch_check();
|
||||
enum class TemporaryMoveToolSwitch {
|
||||
NONE,
|
||||
PAN,
|
||||
|
|
|
|||
|
|
@ -58,3 +58,9 @@ std::unique_ptr<DrawingProgramToolBase> DrawingProgramToolBase::allocate_tool_ty
|
|||
void DrawingProgramToolBase::input_key_callback(const InputManager::KeyCallbackArgs& key) {}
|
||||
void DrawingProgramToolBase::input_mouse_button_on_canvas_callback(const InputManager::MouseButtonCallbackArgs& button) {}
|
||||
void DrawingProgramToolBase::input_mouse_motion_callback(const InputManager::MouseMotionCallbackArgs& motion) {}
|
||||
void DrawingProgramToolBase::input_pure_mouse_button_callback(const InputManager::MouseButtonCallbackArgs& button) {}
|
||||
void DrawingProgramToolBase::input_pure_mouse_motion_callback(const InputManager::MouseMotionCallbackArgs& motion) {}
|
||||
void DrawingProgramToolBase::input_pen_button_callback(const InputManager::PenButtonCallbackArgs& button) {}
|
||||
void DrawingProgramToolBase::input_pen_touch_callback(const InputManager::PenTouchCallbackArgs& touch) {}
|
||||
void DrawingProgramToolBase::input_pen_motion_callback(const InputManager::PenMotionCallbackArgs& motion) {}
|
||||
void DrawingProgramToolBase::input_pen_axis_callback(const InputManager::PenAxisCallbackArgs& axis) {}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,12 @@ class DrawingProgramToolBase {
|
|||
virtual void input_key_callback(const InputManager::KeyCallbackArgs& key);
|
||||
virtual void input_mouse_button_on_canvas_callback(const InputManager::MouseButtonCallbackArgs& button);
|
||||
virtual void input_mouse_motion_callback(const InputManager::MouseMotionCallbackArgs& motion);
|
||||
virtual void input_pure_mouse_button_callback(const InputManager::MouseButtonCallbackArgs& button);
|
||||
virtual void input_pure_mouse_motion_callback(const InputManager::MouseMotionCallbackArgs& motion);
|
||||
virtual void input_pen_button_callback(const InputManager::PenButtonCallbackArgs& button);
|
||||
virtual void input_pen_touch_callback(const InputManager::PenTouchCallbackArgs& touch);
|
||||
virtual void input_pen_motion_callback(const InputManager::PenMotionCallbackArgs& motion);
|
||||
virtual void input_pen_axis_callback(const InputManager::PenAxisCallbackArgs& axis);
|
||||
virtual ~DrawingProgramToolBase();
|
||||
static std::unique_ptr<DrawingProgramToolBase> allocate_tool_type(DrawingProgram& drawP, DrawingProgramToolType t);
|
||||
protected:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue