From 3ecd5ba911d615ea40f03a65f125bde15b992ada Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Tue, 8 Mar 2005 02:57:19 +0000 Subject: 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 --- fluid/Fl_Window_Type.cxx | 36 ++++++++++++++++++++++-------------- 1 file 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) { -- cgit v1.2.3