mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-01 10:13:22 +00:00
fix #4217: Disable mouse stabilizer while previewing a straight line
This commit addresses the issue where the Shift+brush tool was not disabling the mouse stabilizer, leading to unintended behavior when previewing a line. This commit adds the necessary implementation to properly disable the stabilizer when Shift+brush tool is used. Additionally, the function DrawingState::disableMouseStabilizer() now calls ToolLoopManager::disableMouseStabilizer() to ensure the stabilizer is disabled correctly.
This commit is contained in:
parent
1f529bd610
commit
531b2ded75
@ -203,6 +203,12 @@ void ToolLoopManager::movement(Pointer pointer)
|
||||
doLoopStep(false);
|
||||
}
|
||||
|
||||
void ToolLoopManager::disableMouseStabilizer()
|
||||
{
|
||||
// Disable mouse stabilizer for the current ToolLoopManager
|
||||
m_dynamics.stabilizer = false;
|
||||
}
|
||||
|
||||
void ToolLoopManager::doLoopStep(bool lastStep)
|
||||
{
|
||||
// Original set of points to interwine (original user stroke,
|
||||
|
@ -78,6 +78,10 @@ public:
|
||||
// Should be called each time the user moves the mouse inside the editor.
|
||||
void movement(Pointer pointer);
|
||||
|
||||
// Should be called when Shift+brush tool is used to disable stabilizer
|
||||
// on the line preview
|
||||
void disableMouseStabilizer();
|
||||
|
||||
const Pointer& lastPointer() const { return m_lastPointer; }
|
||||
|
||||
private:
|
||||
|
@ -129,6 +129,12 @@ void DrawingState::initToolLoop(Editor* editor,
|
||||
editor->captureMouse();
|
||||
}
|
||||
|
||||
void DrawingState::disableMouseStabilizer()
|
||||
{
|
||||
ASSERT(m_toolLoopManager);
|
||||
m_toolLoopManager->disableMouseStabilizer();
|
||||
}
|
||||
|
||||
void DrawingState::sendMovementToToolLoop(const tools::Pointer& pointer)
|
||||
{
|
||||
ASSERT(m_toolLoopManager);
|
||||
|
@ -60,6 +60,10 @@ namespace app {
|
||||
const ui::MouseMessage* msg,
|
||||
const tools::Pointer& pointer);
|
||||
|
||||
// Used to disable the current ToolLoopManager's stabilizer
|
||||
// when Shift+brush tool is used to paint a line
|
||||
void disableMouseStabilizer();
|
||||
|
||||
// Used to send a movement() to the ToolLoopManager when
|
||||
// Shift+brush tool is used to paint a line.
|
||||
void sendMovementToToolLoop(const tools::Pointer& pointer);
|
||||
|
@ -696,6 +696,9 @@ bool StandbyState::checkStartDrawingStraightLine(Editor* editor,
|
||||
pointer ? pointer->type(): PointerType::Unknown,
|
||||
pointer ? pointer->pressure(): 0.0f));
|
||||
if (drawingState) {
|
||||
// Disable stabilizer so that it does not affect the line preview
|
||||
drawingState->disableMouseStabilizer();
|
||||
|
||||
drawingState->sendMovementToToolLoop(
|
||||
tools::Pointer(
|
||||
pointer ? pointer->point(): editor->screenToEditor(editor->mousePosInDisplay()),
|
||||
|
Loading…
x
Reference in New Issue
Block a user