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 -->
<key action="MoveOrigin" shortcut="Space" />
<key action="RotateShape" shortcut="Alt" />
<key action="Spread" />
<!-- Without default shortcuts -->
<key action="LeftMouseButton" />

View File

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

View File

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

View File

@ -1728,6 +1728,8 @@ void Editor::updateToolLoopModifiersIndicators(const bool firstFromMouseDown)
modifiers |= int(tools::ToolLoopModifiers::kFromCenter);
if (int(action & KeyAction::RotateShape))
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::Intertwine* getIntertwine() override { return m_intertwine; }
tools::TracePolicy getTracePolicy() override {
int modifiers = int(this->getModifiers ());
if (modifiers & int(tools::ToolLoopModifiers::kSpread)) return tools::TracePolicy::Accumulate;
if (m_controller->handleTracePolicy())
return m_controller->getTracePolicy();
else

View File

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

View File

@ -75,6 +75,7 @@ namespace {
{ "SquareAspect" , I18N_KEY(square_aspect) , app::KeyAction::SquareAspect, 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 },
{ "Spread" , I18N_KEY(spread) , app::KeyAction::Spread, app::KeyContext::ShapeTool },
{ "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 }
};
@ -356,6 +357,7 @@ Key::Key(const KeyAction action,
case KeyAction::SquareAspect:
case KeyAction::DrawFromCenter:
case KeyAction::RotateShape:
case KeyAction::Spread:
m_keycontext = KeyContext::ShapeTool;
break;
case KeyAction::LeftMouseButton: