mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-03 23:41:56 +00:00
Pencil: support multiple lines with Shift+click (#1387)
This commit is contained in:
parent
265d18635c
commit
a370a6e719
@ -128,6 +128,12 @@ bool DrawingState::onMouseUp(Editor* editor, MouseMessage* msg)
|
|||||||
|
|
||||||
// Update the timeline. TODO make this state observable by the timeline.
|
// Update the timeline. TODO make this state observable by the timeline.
|
||||||
App::instance()->timeline()->updateUsingEditor(editor);
|
App::instance()->timeline()->updateUsingEditor(editor);
|
||||||
|
|
||||||
|
// Restart again? Here we handle the case to draw multiple lines
|
||||||
|
// using Shift+click with the Pencil tool. When we release the mouse
|
||||||
|
// button, if the Shift key is pressed, the whole ToolLoop starts
|
||||||
|
// again.
|
||||||
|
checkStartDrawingStraightLine(editor);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -487,22 +487,8 @@ bool StandbyState::onSetCursor(Editor* editor, const gfx::Point& mouseScreenPos)
|
|||||||
|
|
||||||
bool StandbyState::onKeyDown(Editor* editor, KeyMessage* msg)
|
bool StandbyState::onKeyDown(Editor* editor, KeyMessage* msg)
|
||||||
{
|
{
|
||||||
// Start line preview with shift key
|
if (checkStartDrawingStraightLine(editor))
|
||||||
if (editor->startStraightLineWithFreehandTool()) {
|
return true;
|
||||||
DrawingState* drawingState =
|
|
||||||
startDrawingState(editor,
|
|
||||||
DrawingType::LineFreehand,
|
|
||||||
tools::Pointer(
|
|
||||||
editor->document()->lastDrawingPoint(),
|
|
||||||
tools::Pointer::Left));
|
|
||||||
if (drawingState) {
|
|
||||||
drawingState->sendMovementToToolLoop(
|
|
||||||
tools::Pointer(
|
|
||||||
editor->screenToEditor(ui::get_mouse_position()),
|
|
||||||
tools::Pointer::Left));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -621,6 +607,27 @@ DrawingState* StandbyState::startDrawingState(Editor* editor,
|
|||||||
return static_cast<DrawingState*>(newState.get());
|
return static_cast<DrawingState*>(newState.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool StandbyState::checkStartDrawingStraightLine(Editor* editor)
|
||||||
|
{
|
||||||
|
// Start line preview with shift key
|
||||||
|
if (editor->startStraightLineWithFreehandTool()) {
|
||||||
|
DrawingState* drawingState =
|
||||||
|
startDrawingState(editor,
|
||||||
|
DrawingType::LineFreehand,
|
||||||
|
tools::Pointer(
|
||||||
|
editor->document()->lastDrawingPoint(),
|
||||||
|
tools::Pointer::Left));
|
||||||
|
if (drawingState) {
|
||||||
|
drawingState->sendMovementToToolLoop(
|
||||||
|
tools::Pointer(
|
||||||
|
editor->screenToEditor(ui::get_mouse_position()),
|
||||||
|
tools::Pointer::Left));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
Transformation StandbyState::getTransformation(Editor* editor)
|
Transformation StandbyState::getTransformation(Editor* editor)
|
||||||
{
|
{
|
||||||
Transformation t = editor->document()->getTransformation();
|
Transformation t = editor->document()->getTransformation();
|
||||||
|
@ -50,6 +50,7 @@ namespace app {
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void callEyedropper(Editor* editor);
|
void callEyedropper(Editor* editor);
|
||||||
|
bool checkStartDrawingStraightLine(Editor* editor);
|
||||||
|
|
||||||
class Decorator : public EditorDecorator {
|
class Decorator : public EditorDecorator {
|
||||||
public:
|
public:
|
||||||
|
Loading…
Reference in New Issue
Block a user