summaryrefslogtreecommitdiff
path: root/src/gui/piePreviewAddSign.vala
diff options
context:
space:
mode:
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);
}
}
}