Skip to content

Commit 2abc052

Browse files
committed
only snap to stars and not other objects
1 parent 922d8b1 commit 2abc052

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

plugins/SkyCultureMaker/src/ScmDraw.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,18 @@ bool scm::ScmDraw::handleMouseMoves(int x, int y, Qt::MouseButtons b)
274274
{
275275
if (snapToStar)
276276
{
277+
// this wouldve been easier with cleverFind but that is private
277278
StelObjectMgr &objectMgr = app.getStelObjectMgr();
278-
objectMgr.findAndSelect(core, x, y);
279+
bool found = objectMgr.findAndSelect(core, x, y);
280+
// only keep the selection if a star was selected
281+
if (found && objectMgr.getWasSelected())
282+
{
283+
StelObjectP stelObj = objectMgr.getLastSelectedObject();
284+
if (stelObj->getType() != "Star")
285+
{
286+
objectMgr.unSelect();
287+
}
288+
}
279289
}
280290

281291
if (hasFlag(drawState, (Drawing::hasStart | Drawing::hasFloatingEnd)))
@@ -406,7 +416,7 @@ std::vector<scm::CoordinateLine> scm::ScmDraw::getCoordinates() const
406416
return drawnLines.coordinates;
407417
}
408418

409-
void scm::ScmDraw::loadLines(const std::vector<CoordinateLine>& coordinates, const std::vector<StarLine>& stars)
419+
void scm::ScmDraw::loadLines(const std::vector<CoordinateLine> &coordinates, const std::vector<StarLine> &stars)
410420
{
411421
// copy the coordinates and stars to drawnLines
412422
drawnLines.coordinates = coordinates;

0 commit comments

Comments
 (0)