MCPcopy Create free account
hub / github.com/LibreSprite/LibreSprite / pressButton

Method pressButton

src/app/tools/tool_loop_manager.cpp:71–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71void ToolLoopManager::pressButton(const Pointer& pointer)
72{
73 m_lastPointer = pointer;
74
75 if (isCanceled())
76 return;
77
78 // If the user pressed the other mouse button...
79 if ((m_toolLoop->getMouseButton() == ToolLoop::Left && pointer.button() == Pointer::Right) ||
80 (m_toolLoop->getMouseButton() == ToolLoop::Right && pointer.button() == Pointer::Left)) {
81 // Cancel the tool-loop (the destination image should be completelly discarded)
82 m_toolLoop->cancel();
83 return;
84 }
85
86 // Convert the screen point to a sprite point
87 Point spritePoint = pointer.point();
88 m_toolLoop->setSpeed(Point(0, 0));
89 m_oldPoint = spritePoint;
90 snapToGrid(spritePoint);
91
92 m_toolLoop->getController()->pressButton(m_stroke, spritePoint, pointer.pressure());
93
94 std::string statusText;
95 m_toolLoop->getController()->getStatusBarText(m_stroke, statusText);
96 m_toolLoop->updateStatusBar(statusText.c_str());
97
98 doLoopStep(false);
99}
100
101bool ToolLoopManager::releaseButton(const Pointer& pointer)
102{

Callers

nothing calls this directly

Calls 10

PointClass · 0.85
getMouseButtonMethod · 0.80
pointMethod · 0.80
setSpeedMethod · 0.80
buttonMethod · 0.45
cancelMethod · 0.45
getControllerMethod · 0.45
pressureMethod · 0.45
getStatusBarTextMethod · 0.45
updateStatusBarMethod · 0.45

Tested by

no test coverage detected