2 #include <score/tools/Cursor.hpp>
4 #include <QGraphicsItem>
5 #include <QGuiApplication>
13 static inline QRectF currentGeometry{};
14 static inline double origValue{};
15 static inline double currentSpeed{};
16 static inline double currentDelta{};
18 static void start(QGraphicsItem&
self,
double orig)
23 #if !defined(__EMSCRIPTEN__)
24 self.setCursor(QCursor(Qt::BlankCursor));
26 currentGeometry = qGuiApp->primaryScreen()->availableGeometry();
29 static void move_free(QGraphicsSceneMouseEvent* event)
31 auto delta = (
event->screenPos().y() -
event->lastScreenPos().y());
32 double ratio = qGuiApp->keyboardModifiers() & Qt::CTRL ? 0.2 : 1.;
33 if(std::abs(delta) < 500)
35 currentSpeed = ratio * delta;
36 currentDelta += ratio * delta;
39 const double max = currentGeometry.height();
40 if(event->screenPos().y() <= 100)
42 score::setCursorPos(QPointF(event->screenPos().x(), max - 101));
44 else if(event->screenPos().y() >= (max - 100))
46 score::setCursorPos(QPointF(event->screenPos().x(), 101));
50 static double move(QGraphicsSceneMouseEvent* event)
54 const double max = currentGeometry.height();
55 double v = origValue - currentDelta / max;
58 currentDelta = origValue * max;
63 currentDelta = ((origValue - 1.) * max);
70 static void stop(QGraphicsItem&
self, QGraphicsSceneMouseEvent* event)
72 score::setCursorPos(event->buttonDownScreenPos(Qt::LeftButton));
Base toolkit upon which the software is built.
Definition: Application.cpp:90