Skip to content

Commit

Permalink
Select new objects after they have been created
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn committed Jul 20, 2015
1 parent cb4f8fe commit 2b0313b
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
2 changes: 2 additions & 0 deletions src/tiled/createobjecttool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ void CreateObjectTool::finishNewMapObject()
mapDocument()->undoStack()->push(new AddMapObject(mapDocument(),
objectGroup,
newMapObject));

mapDocument()->setSelectedObjects(QList<MapObject*>() << newMapObject);
}

void CreateObjectTool::mouseMovedWhileCreatingObject(const QPointF &, Qt::KeyboardModifiers)
Expand Down
3 changes: 2 additions & 1 deletion src/tiled/createpolygonobjecttool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ MapObject *CreatePolygonObjectTool::createNewMapObject()
return newMapObject;
}

void CreatePolygonObjectTool::finishNewMapObject(){
void CreatePolygonObjectTool::finishNewMapObject()
{
if (mNewMapObjectItem->mapObject()->polygon().size() >= 3)
CreateObjectTool::finishNewMapObject();
else
Expand Down
5 changes: 2 additions & 3 deletions src/tiled/createpolygonobjecttool.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include "createmultipointobjecttool.h"

namespace Tiled {

namespace Internal {

class CreatePolygonObjectTool: public CreateMultipointObjectTool
Expand All @@ -38,7 +37,7 @@ class CreatePolygonObjectTool: public CreateMultipointObjectTool
void finishNewMapObject();
};

}
}
} // namespace Internal
} // namespace Tiled

#endif // CREATEPOLYGONOBJECTTOOL_H
3 changes: 2 additions & 1 deletion src/tiled/createpolylineobjecttool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ MapObject *CreatePolylineObjectTool::createNewMapObject()
return newMapObject;
}

void CreatePolylineObjectTool::finishNewMapObject(){
void CreatePolylineObjectTool::finishNewMapObject()
{
if (mNewMapObjectItem->mapObject()->polygon().size() >= 2)
CreateObjectTool::finishNewMapObject();
else
Expand Down
5 changes: 2 additions & 3 deletions src/tiled/createpolylineobjecttool.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include "createmultipointobjecttool.h"

namespace Tiled {

namespace Internal {

class CreatePolylineObjectTool: public CreateMultipointObjectTool
Expand All @@ -38,7 +37,7 @@ class CreatePolylineObjectTool: public CreateMultipointObjectTool
void finishNewMapObject();
};

}
}
} // namespace Internal
} // namespace Tiled

#endif // CREATEPOLYLINEOBJECTTOOL_H

0 comments on commit 2b0313b

Please sign in to comment.