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 auto* screen = qGuiApp->screenAt(QCursor::pos());
28 screen = qGuiApp->primaryScreen();
29 currentGeometry = screen->availableGeometry();
32 static void move_free(QGraphicsSceneMouseEvent* event)
34 auto delta = (
event->screenPos().y() -
event->lastScreenPos().y());
35 double ratio = qGuiApp->keyboardModifiers() & Qt::CTRL ? 0.2 : 1.;
36 if(std::abs(delta) < 500)
38 currentSpeed = ratio * delta;
39 currentDelta += ratio * delta;
42 const double top = currentGeometry.top();
43 const double bottom = currentGeometry.bottom();
44 if(event->screenPos().y() <= top + 100)
46 score::setCursorPos(QPointF(event->screenPos().x(), bottom - 101));
48 else if(event->screenPos().y() >= bottom - 100)
50 score::setCursorPos(QPointF(event->screenPos().x(), top + 101));
54 static double move(QGraphicsSceneMouseEvent* event)
58 const double max = currentGeometry.height();
59 double v = origValue - currentDelta / max;
62 currentDelta = origValue * max;
67 currentDelta = ((origValue - 1.) * max);
74 static void stop(QGraphicsItem& self, QGraphicsSceneMouseEvent* event)
76 score::setCursorPos(event->buttonDownScreenPos(Qt::LeftButton));