bugfix [#24331] EdgeSlide not as flawless as 2.49's

ensure minimum mouse distance for sliding edge verts else it becomes unusable.
This commit is contained in:
Campbell Barton 2010-10-21 13:33:51 +00:00
parent bef30b270b
commit 59d1740671

@ -4563,7 +4563,26 @@ static int createSlideVerts(TransInfo *t)
start[0] = t->mval[0];
start[1] = t->mval[1];
add_v3_v3v3(end, start, vec);
/* Ensure minimum screen distance, when looking top down on edge loops */
#define EDGE_SLIDE_MIN 30
if (len_squared_v2v2(start, end) < (EDGE_SLIDE_MIN * EDGE_SLIDE_MIN)) {
if(ABS(start[0]-end[0]) + ABS(start[1]-end[1]) < 4.0f) {
/* even more exceptional case, points are ontop of eachother */
end[0]= start[0];
end[1]= start[1] + EDGE_SLIDE_MIN;
}
else {
sub_v2_v2(end, start);
normalize_v2(end);
mul_v2_fl(end, EDGE_SLIDE_MIN);
add_v2_v2(end, start);
}
}
#undef EDGE_SLIDE_MIN
sld->start[0] = (short) start[0];
sld->start[1] = (short) start[1];
sld->end[0] = (short) end[0];