Tool cursor not drawn on touch devices, and fixed translating objects with touch
This commit is contained in:
parent
8b46c31bd7
commit
19983c7b1c
5 changed files with 29 additions and 3 deletions
|
|
@ -441,7 +441,7 @@ void DrawingProgramSelection::input_mouse_button_on_canvas_callback_modify_selec
|
|||
check_add_stroke_color_change_undo();
|
||||
}
|
||||
else if(mouse_collided_with_selection_aabb()) {
|
||||
translateData.startPos = drawP.world.get_mouse_world_pos();
|
||||
translateData.startPos = drawP.world.drawData.cam.c.from_space(button.pos);
|
||||
transformOpHappening = TransformOperation::TRANSLATE;
|
||||
translateData.translateWithKeys = false;
|
||||
check_add_stroke_color_change_undo();
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ bool BrushTool::prevent_undo_or_redo() {
|
|||
}
|
||||
|
||||
void BrushTool::draw(SkCanvas* canvas, const DrawData& drawData) {
|
||||
if(drawData.main->world->drawProg.controls.cursorHoveringOverCanvas) {
|
||||
if(!drawP.world.main.input.isTouchDevice && drawData.main->world->drawProg.controls.cursorHoveringOverCanvas) {
|
||||
auto relativeWidthResult = drawP.world.main.toolConfig.get_relative_width_stroke_size(drawP, drawP.world.drawData.cam.c.inverseScale);
|
||||
if(relativeWidthResult.first.has_value()) {
|
||||
SkPaint linePaint;
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ bool EraserTool::prevent_undo_or_redo() {
|
|||
}
|
||||
|
||||
void EraserTool::draw(SkCanvas* canvas, const DrawData& drawData) {
|
||||
if(drawData.main->world->drawProg.controls.cursorHoveringOverCanvas) {
|
||||
if(!drawP.world.main.input.isTouchDevice && drawData.main->world->drawProg.controls.cursorHoveringOverCanvas) {
|
||||
if(!lastPosOpt.has_value())
|
||||
lastPosOpt = drawData.main->input.mouse.pos;
|
||||
auto& lastPos = lastPosOpt.value();
|
||||
|
|
|
|||
|
|
@ -401,6 +401,8 @@ void InputManager::backend_mouse_button_up_update(const SDL_MouseButtonEvent& e)
|
|||
};
|
||||
main.input_mouse_button_callback(args);
|
||||
main.input_pure_mouse_button_callback(args);
|
||||
|
||||
isTouchDevice = false;
|
||||
}
|
||||
|
||||
void InputManager::backend_mouse_button_down_update(const SDL_MouseButtonEvent& e) {
|
||||
|
|
@ -427,6 +429,8 @@ void InputManager::backend_mouse_button_down_update(const SDL_MouseButtonEvent&
|
|||
};
|
||||
main.input_mouse_button_callback(args);
|
||||
main.input_pure_mouse_button_callback(args);
|
||||
|
||||
isTouchDevice = false;
|
||||
}
|
||||
|
||||
void InputManager::backend_mouse_motion_update(const SDL_MouseMotionEvent& e) {
|
||||
|
|
@ -442,6 +446,8 @@ void InputManager::backend_mouse_motion_update(const SDL_MouseMotionEvent& e) {
|
|||
.pos = mouseNewPos,
|
||||
.move = mouseRel
|
||||
});
|
||||
|
||||
isTouchDevice = false;
|
||||
}
|
||||
|
||||
void InputManager::backend_mouse_wheel_update(const SDL_MouseWheelEvent& e) {
|
||||
|
|
@ -455,6 +461,8 @@ void InputManager::backend_mouse_wheel_update(const SDL_MouseWheelEvent& e) {
|
|||
.amount = {e.x, e.y},
|
||||
.tickAmount = {e.integer_x, e.integer_y}
|
||||
});
|
||||
|
||||
isTouchDevice = false;
|
||||
}
|
||||
|
||||
void InputManager::backend_pen_button_down_update(const SDL_PenButtonEvent& e) {
|
||||
|
|
@ -488,6 +496,8 @@ void InputManager::backend_pen_button_down_update(const SDL_PenButtonEvent& e) {
|
|||
.down = e.down,
|
||||
.pos = mouseNewPos
|
||||
});
|
||||
|
||||
isTouchDevice = false;
|
||||
}
|
||||
|
||||
void InputManager::backend_pen_button_up_update(const SDL_PenButtonEvent& e) {
|
||||
|
|
@ -520,6 +530,8 @@ void InputManager::backend_pen_button_up_update(const SDL_PenButtonEvent& e) {
|
|||
.down = e.down,
|
||||
.pos = mouseNewPos
|
||||
});
|
||||
|
||||
isTouchDevice = false;
|
||||
}
|
||||
|
||||
void InputManager::backend_pen_touch_down_update(const SDL_PenTouchEvent& e) {
|
||||
|
|
@ -547,6 +559,8 @@ void InputManager::backend_pen_touch_down_update(const SDL_PenTouchEvent& e) {
|
|||
.eraser = e.eraser,
|
||||
.pos = mouseNewPos
|
||||
});
|
||||
|
||||
isTouchDevice = false;
|
||||
}
|
||||
|
||||
void InputManager::backend_pen_touch_up_update(const SDL_PenTouchEvent& e) {
|
||||
|
|
@ -570,6 +584,8 @@ void InputManager::backend_pen_touch_up_update(const SDL_PenTouchEvent& e) {
|
|||
.eraser = e.eraser,
|
||||
.pos = mouseNewPos
|
||||
});
|
||||
|
||||
isTouchDevice = false;
|
||||
}
|
||||
|
||||
void InputManager::backend_pen_motion_update(const SDL_PenMotionEvent& e) {
|
||||
|
|
@ -588,6 +604,8 @@ void InputManager::backend_pen_motion_update(const SDL_PenMotionEvent& e) {
|
|||
.pos = mouseNewPos,
|
||||
.move = mouseRel
|
||||
});
|
||||
|
||||
isTouchDevice = false;
|
||||
}
|
||||
|
||||
void InputManager::backend_pen_axis_update(const SDL_PenAxisEvent& e) {
|
||||
|
|
@ -648,6 +666,8 @@ void InputManager::backend_touch_finger_down_update(const SDL_TouchFingerEvent&
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
isTouchDevice = true;
|
||||
}
|
||||
|
||||
void InputManager::backend_touch_finger_up_update(const SDL_TouchFingerEvent& e) {
|
||||
|
|
@ -714,6 +734,8 @@ void InputManager::backend_touch_finger_up_update(const SDL_TouchFingerEvent& e)
|
|||
std::erase_if(touch.fingers, [&e](auto& tE) {
|
||||
return e.fingerID == tE.fingerID;
|
||||
});
|
||||
|
||||
isTouchDevice = true;
|
||||
}
|
||||
|
||||
void InputManager::backend_touch_finger_motion_update(const SDL_TouchFingerEvent& e) {
|
||||
|
|
@ -778,6 +800,8 @@ void InputManager::backend_touch_finger_motion_update(const SDL_TouchFingerEvent
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
isTouchDevice = true;
|
||||
}
|
||||
|
||||
void InputManager::backend_key_down_update(const SDL_KeyboardEvent& e) {
|
||||
|
|
|
|||
|
|
@ -99,6 +99,8 @@ struct InputManager {
|
|||
std::array<KeyData, 256> buttons;
|
||||
} pen;
|
||||
|
||||
bool isTouchDevice = true;
|
||||
|
||||
void set_rich_text_box_input_front(const std::shared_ptr<RichText::TextBox>& nTextBox, const std::shared_ptr<RichText::TextBox::Cursor>& nCursor, bool isRichTextBox, const std::optional<RichText::TextStyleModifier::ModifierMap>& nModMap = std::nullopt);
|
||||
void set_rich_text_box_input_back(const std::shared_ptr<RichText::TextBox>& nTextBox, const std::shared_ptr<RichText::TextBox::Cursor>& nCursor, bool isRichTextBox, const std::optional<RichText::TextStyleModifier::ModifierMap>& nModMap = std::nullopt);
|
||||
void remove_rich_text_box_input(const std::shared_ptr<RichText::TextBox>& nTextBox);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue