DPaint2 style "spread" modifier on shape tools

This commit is contained in:
Patrick Meehan 2024-05-23 19:07:02 -07:00
parent c44040fdc7
commit 3ac3038418
7 changed files with 12 additions and 0 deletions

View File

@ -671,6 +671,7 @@
<!-- Modifiers for two-or-more-points tools --> <!-- Modifiers for two-or-more-points tools -->
<key action="MoveOrigin" shortcut="Space" /> <key action="MoveOrigin" shortcut="Space" />
<key action="RotateShape" shortcut="Alt" /> <key action="RotateShape" shortcut="Alt" />
<key action="Spread" />
<!-- Without default shortcuts --> <!-- Without default shortcuts -->
<key action="LeftMouseButton" /> <key action="LeftMouseButton" />

View File

@ -943,6 +943,7 @@ move_origin = Move Origin
square_aspect = Square Aspect square_aspect = Square Aspect
draw_from_center = Draw From Center draw_from_center = Draw From Center
rotate_shape = Rotate Shape rotate_shape = Rotate Shape
spread = Spread
trigger_left_mouse_button = Trigger Left Mouse Button trigger_left_mouse_button = Trigger Left Mouse Button
trigger_right_mouse_button = Trigger Right Mouse Button trigger_right_mouse_button = Trigger Right Mouse Button
ok = &OK ok = &OK

View File

@ -22,6 +22,7 @@ namespace tools {
kSquareAspect = 0x00000020, kSquareAspect = 0x00000020,
kFromCenter = 0x00000040, kFromCenter = 0x00000040,
kRotateShape = 0x00000080, kRotateShape = 0x00000080,
kSpread = 0x00000100,
}; };
} // namespace tools } // namespace tools

View File

@ -1728,6 +1728,8 @@ void Editor::updateToolLoopModifiersIndicators(const bool firstFromMouseDown)
modifiers |= int(tools::ToolLoopModifiers::kFromCenter); modifiers |= int(tools::ToolLoopModifiers::kFromCenter);
if (int(action & KeyAction::RotateShape)) if (int(action & KeyAction::RotateShape))
modifiers |= int(tools::ToolLoopModifiers::kRotateShape); modifiers |= int(tools::ToolLoopModifiers::kRotateShape);
if (int(action & KeyAction::Spread))
modifiers |= int(tools::ToolLoopModifiers::kSpread);
} }
} }

View File

@ -381,6 +381,10 @@ public:
tools::PointShape* getPointShape() override { return m_pointShape; } tools::PointShape* getPointShape() override { return m_pointShape; }
tools::Intertwine* getIntertwine() override { return m_intertwine; } tools::Intertwine* getIntertwine() override { return m_intertwine; }
tools::TracePolicy getTracePolicy() override { tools::TracePolicy getTracePolicy() override {
int modifiers = int(this->getModifiers ());
if (modifiers & int(tools::ToolLoopModifiers::kSpread)) return tools::TracePolicy::Accumulate;
if (m_controller->handleTracePolicy()) if (m_controller->handleTracePolicy())
return m_controller->getTracePolicy(); return m_controller->getTracePolicy();
else else

View File

@ -68,6 +68,7 @@ namespace app {
AngleSnapFromLastPoint = 0x00010000, AngleSnapFromLastPoint = 0x00010000,
RotateShape = 0x00020000, RotateShape = 0x00020000,
FineControl = 0x00040000, FineControl = 0x00040000,
Spread = 0x00080000,
}; };
enum class WheelAction { enum class WheelAction {

View File

@ -75,6 +75,7 @@ namespace {
{ "SquareAspect" , I18N_KEY(square_aspect) , app::KeyAction::SquareAspect, app::KeyContext::ShapeTool }, { "SquareAspect" , I18N_KEY(square_aspect) , app::KeyAction::SquareAspect, app::KeyContext::ShapeTool },
{ "DrawFromCenter" , I18N_KEY(draw_from_center) , app::KeyAction::DrawFromCenter, app::KeyContext::ShapeTool }, { "DrawFromCenter" , I18N_KEY(draw_from_center) , app::KeyAction::DrawFromCenter, app::KeyContext::ShapeTool },
{ "RotateShape" , I18N_KEY(rotate_shape) , app::KeyAction::RotateShape, app::KeyContext::ShapeTool }, { "RotateShape" , I18N_KEY(rotate_shape) , app::KeyAction::RotateShape, app::KeyContext::ShapeTool },
{ "Spread" , I18N_KEY(spread) , app::KeyAction::Spread, app::KeyContext::ShapeTool },
{ "LeftMouseButton" , I18N_KEY(trigger_left_mouse_button) , app::KeyAction::LeftMouseButton, app::KeyContext::Any }, { "LeftMouseButton" , I18N_KEY(trigger_left_mouse_button) , app::KeyAction::LeftMouseButton, app::KeyContext::Any },
{ "RightMouseButton" , I18N_KEY(trigger_right_mouse_button) , app::KeyAction::RightMouseButton, app::KeyContext::Any } { "RightMouseButton" , I18N_KEY(trigger_right_mouse_button) , app::KeyAction::RightMouseButton, app::KeyContext::Any }
}; };
@ -356,6 +357,7 @@ Key::Key(const KeyAction action,
case KeyAction::SquareAspect: case KeyAction::SquareAspect:
case KeyAction::DrawFromCenter: case KeyAction::DrawFromCenter:
case KeyAction::RotateShape: case KeyAction::RotateShape:
case KeyAction::Spread:
m_keycontext = KeyContext::ShapeTool; m_keycontext = KeyContext::ShapeTool;
break; break;
case KeyAction::LeftMouseButton: case KeyAction::LeftMouseButton: