summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2005-03-08 02:57:19 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>2005-03-08 02:57:19 +0000
commit3ecd5ba911d615ea40f03a65f125bde15b992ada (patch)
tree7b697121ec22bfe38439a111245fd682b402afc3
parent9998dcc396c710b448c87f12f5c163ab0618e987 (diff)
Only horizontally snap align when the current widget is within 50
pixels vertically of the other widgets. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4088 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--fluid/Fl_Window_Type.cxx36
1 files changed, 22 insertions, 14 deletions
diff --git a/fluid/Fl_Window_Type.cxx b/fluid/Fl_Window_Type.cxx
index 86b16d0a9..163623dfb 100644
--- a/fluid/Fl_Window_Type.cxx
+++ b/fluid/Fl_Window_Type.cxx
@@ -53,6 +53,8 @@ extern int modflag;
extern Fl_Preferences fluid_prefs;
+inline int fl_min(int a, int b) { return (a < b ? a : b); }
+
#include "widget_panel.h"
// Update the XYWH values in the widget panel...
@@ -713,23 +715,29 @@ void Fl_Window_Type::draw_overlay() {
// Only check visible widgets...
if (!qw->o->visible_r()) continue;
- // Align to left of other widget...
- if ((drag & (LEFT | DRAG)) && abs(d = mybx - qw->o->x()) < 5) {
- dx += d;
- mybx += d;
- mybr += d;
+ // Do horizontal alignment when the widget is within 50
+ // pixels vertically...
+ if (fl_min(abs(qw->o->y() - mysel->o->y() - mysel->o->h()),
+ abs(mysel->o->y() - qw->o->y() - qw->o->h())) < 50) {
+ // Align to left of other widget...
+ if ((drag & (LEFT | DRAG)) && abs(d = mybx - qw->o->x()) < 5) {
+ dx += d;
+ mybx += d;
+ mybr += d;
- draw_left_brace(qw->o);
- }
+ draw_left_brace(qw->o);
+ }
- // Align to right of other widget...
- if ((drag & (RIGHT | DRAG)) && abs(d = qw->o->x() + qw->o->w() - mybr) < 5) {
- dx += d;
- mybx += d;
- mybr += d;
+ // Align to right of other widget...
+ if ((drag & (RIGHT | DRAG)) &&
+ abs(d = qw->o->x() + qw->o->w() - mybr) < 5) {
+ dx += d;
+ mybx += d;
+ mybr += d;
- draw_right_brace(qw->o);
- }
+ draw_right_brace(qw->o);
+ }
+ }
// Align to top of other widget...
if ((drag & (TOP | DRAG)) && abs(d = myby - qw->o->y()) < 5) {