summaryrefslogtreecommitdiff
path: root/src/gui/piePreviewAddSign.vala
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2015-08-02 08:18:11 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2015-08-02 08:18:11 +0200
commit0b56dfbf01171226a0bb035afcd13358b6477710 (patch)
tree7d4c1e2f57e6ea49fe56af50a0ba3414bf127927 /src/gui/piePreviewAddSign.vala
parenta1c05d93bbb3c1bdb0c0fed9d7110804037cfd55 (diff)
Imported Upstream version 0.6.4upstream/0.6.4
Diffstat (limited to 'src/gui/piePreviewAddSign.vala')
-rw-r--r--src/gui/piePreviewAddSign.vala18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/gui/piePreviewAddSign.vala b/src/gui/piePreviewAddSign.vala
index 4a92067..b3f6f7b 100644
--- a/src/gui/piePreviewAddSign.vala
+++ b/src/gui/piePreviewAddSign.vala
@@ -185,14 +185,18 @@ public class PiePreviewAddSign : GLib.Object {
/////////////////////////////////////////////////////////////////////
public void on_mouse_move(double angle) {
- double direction = 2.0 * PI * position/parent.slice_count();
- double diff = fabs(angle-direction);
+ if (parent.slice_count() > 0) {
+ double direction = 2.0 * PI * position/parent.slice_count();
+ double diff = fabs(angle-direction);
- if (diff > PI)
- diff = 2 * PI - diff;
+ if (diff > PI)
+ diff = 2 * PI - diff;
- if (diff < 0.5*PI/parent.slice_count()) this.activity.reset_target(1.0, 1.0);
- else this.activity.reset_target(-3.0, 1.5);
+ if (diff < 0.5*PI/parent.slice_count()) this.activity.reset_target(1.0, 1.0);
+ else this.activity.reset_target(-3.0, 1.5);
+ } else {
+ this.activity.reset_target(1.0, 1.0);
+ }
}
/////////////////////////////////////////////////////////////////////
@@ -211,8 +215,8 @@ public class PiePreviewAddSign : GLib.Object {
public void on_button_release(double x, double y) {
if (this.clicked.end == 0.9) {
- this.clicked.reset_target(1.0, 0.1);
this.on_clicked((int)this.position);
+ this.clicked.reset_target(1.0, 0.1);
}
}
}