Skip to content

Commit

Permalink
settings to enable/disable smoot position animation, fixes #295
Browse files Browse the repository at this point in the history
  • Loading branch information
rinigus committed Aug 5, 2019
1 parent 261d0b3 commit bf6ffb9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions poor/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
"show_navigation_sign": True,
# "always", "exceeding", "never"
"show_speed_limit": "always",
"smooth_position_animation_when_navigating": True,
"tilt_when_navigating": True,
# "metric", "american" or "british".
"units": "metric",
Expand Down
2 changes: 2 additions & 0 deletions qml/Config.qml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ Item {
property bool showNarrative: false
property bool showNavigationSign: false
property string showSpeedLimit
property bool smoothPositionAnimationWhenNavigating: false
property bool tiltWhenNavigating
property string units
property string voiceGender
Expand Down Expand Up @@ -144,6 +145,7 @@ Item {
conf.showNarrative = c.show_narrative;
conf.showNavigationSign = c.show_navigation_sign;
conf.showSpeedLimit = c.show_speed_limit;
conf.smoothPositionAnimationWhenNavigating = c.smooth_position_animation_when_navigating;
conf.tiltWhenNavigating = c.tilt_when_navigating;
conf.units = c.units;
conf.voiceGender = c.voice_gender;
Expand Down
7 changes: 5 additions & 2 deletions qml/PositionMarker.qml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ Item {
property var position: QtPositioning.coordinate(49, 13)
property var positionShown

property bool _animatePosition: app.conf.smoothPositionAnimationWhenNavigating &&
(app.mode === modes.navigate || app.mode === modes.followMe)

readonly property var images: QtObject {
readonly property string moving: "pure-position-moving"
readonly property string still: "pure-position-still"
Expand All @@ -42,7 +45,7 @@ Item {

CoordinateAnimation {
id: animate
duration: (app.mode === modes.navigate || app.mode === modes.followMe) ? map.animationTime : 0
duration: marker._animatePosition ? map.animationTime : 0
easing.type: Easing.Linear
target: marker
property: "positionShown"
Expand All @@ -53,7 +56,7 @@ Item {
onDirectionChanged: marker.updateDirection();
onMetersPerPixelChanged: marker.updateUncertainty()
onPositionChanged: {
if (!positionShown) {
if (!positionShown || !marker._animatePosition) {
positionShown = QtPositioning.coordinate(map.position.coordinate.latitude, map.position.coordinate.longitude);
marker.position = QtPositioning.coordinate(map.position.coordinate.latitude, map.position.coordinate.longitude);
animate.to = marker.position;
Expand Down
8 changes: 8 additions & 0 deletions qml/PreferencesPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,14 @@ PagePL {
}
}

TextSwitchPL {
checked: app.conf.smoothPositionAnimationWhenNavigating
text: app.tr("Smooth position animation")
onCheckedChanged: {
app.conf.set("smooth_position_animation_when_navigating", checked);
}
}

FormLayoutPL {
spacing: styler.themePaddingMedium
width: parent.width
Expand Down

0 comments on commit bf6ffb9

Please sign in to comment.