This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 126515
Collapse All | Expand All

(-)api.visual/src/org/netbeans/modules/visual/action/AlignWithSupport.java (+20 lines)
Lines 83-92 Link Here
83
83
84
            int b1 = sceneWidgetBounds.x;
84
            int b1 = sceneWidgetBounds.x;
85
            int b2 = sceneWidgetBounds.x + sceneWidgetBounds.width;
85
            int b2 = sceneWidgetBounds.x + sceneWidgetBounds.width;
86
            int b3 = sceneWidgetBounds.x + (sceneWidgetBounds.width/2);
86
87
87
            for (Rectangle rectangle : regions) {
88
            for (Rectangle rectangle : regions) {
88
                int a1 = rectangle.x;
89
                int a1 = rectangle.x;
89
                int a2 = a1 + rectangle.width;
90
                int a2 = a1 + rectangle.width;
91
                int a3 = a1 +(rectangle.width/2);
90
92
91
                int d;
93
                int d;
92
                boolean snapNow = false;
94
                boolean snapNow = false;
Lines 125-130 Link Here
125
                    }
127
                    }
126
                }
128
                }
127
129
130
                d = Math.abs(a3 - b3);
131
                if ((snap && d < dx) || (!snap && d < GRAVITY)) {
132
                    snap = snapNow = true;
133
                    xs = a3 - (b3 - b1);
134
                    x = a3;
135
                    dx = d;
136
                }
137
128
                if (snapNow) {
138
                if (snapNow) {
129
                    y1 = rectangle.y;
139
                    y1 = rectangle.y;
130
                    y2 = rectangle.y + rectangle.height;
140
                    y2 = rectangle.y + rectangle.height;
Lines 151-160 Link Here
151
161
152
            int b1 = sceneWidgetBounds.y;
162
            int b1 = sceneWidgetBounds.y;
153
            int b2 = sceneWidgetBounds.y + sceneWidgetBounds.height;
163
            int b2 = sceneWidgetBounds.y + sceneWidgetBounds.height;
164
            int b3 = sceneWidgetBounds.y + (sceneWidgetBounds.height/2);
154
165
155
            for (Rectangle rectangle : regions) {
166
            for (Rectangle rectangle : regions) {
156
                int a1 = rectangle.y;
167
                int a1 = rectangle.y;
157
                int a2 = a1 + rectangle.height;
168
                int a2 = a1 + rectangle.height;
169
                int a3 = a1 + (rectangle.height/2);
158
170
159
                int d;
171
                int d;
160
                boolean snapNow = false;
172
                boolean snapNow = false;
Lines 189-194 Link Here
189
                    dy = d;
201
                    dy = d;
190
                }
202
                }
191
203
204
                d = Math.abs(a3 - b3);
205
                if ((snap && d < dy) || (!snap && d < GRAVITY)) {
206
                    snap = snapNow = true;
207
                    ys = a3 - (b3 - b1);
208
                    y = a3;
209
                    dy = d;
210
                }
211
192
                if (snapNow) {
212
                if (snapNow) {
193
                    x1 = rectangle.x;
213
                    x1 = rectangle.x;
194
                    x2 = rectangle.x + rectangle.width;
214
                    x2 = rectangle.x + rectangle.width;

Return to bug 126515