When curves to be split intersect at multiple points, don't just
choose arbitrarily. Instead, split at the point closest to the mouse pointer. [git-p4: depot-paths = "//depot/solvespace/": change = 2170]solver
parent
9ae29aa0e9
commit
319ba16541
15
modify.cpp
15
modify.cpp
|
@ -608,9 +608,20 @@ void GraphicsWindow::SplitLinesOrCurves(void) {
|
||||||
ZERO(&inters);
|
ZERO(&inters);
|
||||||
sbla.AllIntersectionsWith(&sblb, &inters);
|
sbla.AllIntersectionsWith(&sblb, &inters);
|
||||||
|
|
||||||
// If there's multiple points, then just take the first one.
|
|
||||||
if(inters.l.n > 0) {
|
if(inters.l.n > 0) {
|
||||||
Vector pi = inters.l.elem[0].p;
|
Vector pi;
|
||||||
|
// If there's multiple points, then take the one closest to the
|
||||||
|
// mouse pointer.
|
||||||
|
double dmin = VERY_POSITIVE;
|
||||||
|
SPoint *sp;
|
||||||
|
for(sp = inters.l.First(); sp; sp = inters.l.NextAfter(sp)) {
|
||||||
|
double d = ProjectPoint(sp->p).DistanceTo(currentMousePosition);
|
||||||
|
if(d < dmin) {
|
||||||
|
dmin = d;
|
||||||
|
pi = sp->p;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SS.UndoRemember();
|
SS.UndoRemember();
|
||||||
hEntity hia = SplitEntity(ha, pi),
|
hEntity hia = SplitEntity(ha, pi),
|
||||||
hib = SplitEntity(hb, pi);
|
hib = SplitEntity(hb, pi);
|
||||||
|
|
|
@ -108,6 +108,7 @@ void GraphicsWindow::MouseMoved(double x, double y, bool leftDown,
|
||||||
}
|
}
|
||||||
|
|
||||||
Point2d mp = Point2d::From(x, y);
|
Point2d mp = Point2d::From(x, y);
|
||||||
|
currentMousePosition = mp;
|
||||||
|
|
||||||
if(rightDown && orig.mouse.DistanceTo(mp) < 5 && !orig.startedMoving) {
|
if(rightDown && orig.mouse.DistanceTo(mp) < 5 && !orig.startedMoving) {
|
||||||
// Avoid accidentally panning (or rotating if shift is down) if the
|
// Avoid accidentally panning (or rotating if shift is down) if the
|
||||||
|
|
3
ui.h
3
ui.h
|
@ -420,6 +420,9 @@ public:
|
||||||
bool startedMoving;
|
bool startedMoving;
|
||||||
} orig;
|
} orig;
|
||||||
|
|
||||||
|
// Most recent mouse position, updated every time the mouse moves.
|
||||||
|
Point2d currentMousePosition;
|
||||||
|
|
||||||
// When the user is dragging a point, don't solve multiple times without
|
// When the user is dragging a point, don't solve multiple times without
|
||||||
// allowing a paint in between. The extra solves are wasted if they're
|
// allowing a paint in between. The extra solves are wasted if they're
|
||||||
// not displayed.
|
// not displayed.
|
||||||
|
|
|
@ -4,7 +4,6 @@ crude DXF, HPGL import
|
||||||
a request to import a plane thing
|
a request to import a plane thing
|
||||||
make export assemble only contours in same group
|
make export assemble only contours in same group
|
||||||
make export rewrite fill color same as stroke color
|
make export rewrite fill color same as stroke color
|
||||||
choose split point closest to mouse pointer
|
|
||||||
|
|
||||||
-----
|
-----
|
||||||
rounding, as a special group
|
rounding, as a special group
|
||||||
|
|
Loading…
Reference in New Issue