summaryrefslogtreecommitdiff
path: root/src/CurveEditor.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/CurveEditor.cxx')
-rw-r--r--src/CurveEditor.cxx10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/CurveEditor.cxx b/src/CurveEditor.cxx
index a9bb7a5..b095d3d 100644
--- a/src/CurveEditor.cxx
+++ b/src/CurveEditor.cxx
@@ -24,6 +24,9 @@ CurveEditor::CurveEditor(int my_x, int my_y, int my_w, int my_h) :
n = 0;
acc = gsl_interp_accel_alloc();
spline = NULL;
+ add_point(0.0, 0.0);
+ add_point(0.5, 0.5);
+ add_point(1.0, 1.0);
}
void
@@ -83,8 +86,9 @@ CurveEditor::handle(int event) {
case FL_DRAG:
if (marked_point < 0)
return 1;
- if (marked_point > 0 && mark_x <= X[marked_point - 1] ||
- marked_point < n - 1 && mark_x >= X[marked_point + 1]) {
+ if (n >= 3 &&
+ (marked_point > 0 && mark_x <= X[marked_point - 1] ||
+ marked_point < n - 1 && mark_x >= X[marked_point + 1])) {
remove_point(marked_point);
marked_point = -1;
if (cb)
@@ -94,7 +98,7 @@ CurveEditor::handle(int event) {
return 1;
case FL_RELEASE:
if (marked_point >= 0) {
- if (cb)
+ if (n >= 3 && cb)
cb(this, cb_data);
marked_point = -1;
}