Skip to content

Commit

Permalink
Rotate immidiately on first click
Browse files Browse the repository at this point in the history
  • Loading branch information
eplatonoff committed Sep 15, 2024
1 parent cc45f8d commit 4e250dc
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/MouseTracker.qml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ MouseArea {
}

onRotated: (delta) => {

const deltaSecs = delta * 10;

this._totalRotated += delta;
Expand All @@ -61,13 +60,18 @@ MouseArea {
const angle = GeometryScripts.mouseAngle(
Qt.point(mouse.x, mouse.y),
Qt.point(canvas.centreX, canvas.centreY));

// instantly rotate to the angle under the mouse in unitiated state
if (this._totalRotatedSecs === 0) {
this.rotated(angle < 0 ? (180 - angle) : angle);
}

this._prevAngle = angle;

globalTimer.stop();
pomodoroQueue.count > 1 ? pomodoroQueue.restoreDuration(0) : undefined
pomodoroQueue.infiniteMode = false
sequence.setCurrentItem(-1)

}

onPositionChanged: (mouse) => {
Expand All @@ -77,12 +81,10 @@ MouseArea {
Qt.point(mouse.x, mouse.y),
Qt.point(canvas.centreX, canvas.centreY));


const delta = GeometryScripts.lessDelta(angle, this._prevAngle);

this._prevAngle = angle;

this.rotated(delta);
}

}

0 comments on commit 4e250dc

Please sign in to comment.