Skip to content

Commit

Permalink
fixed objects offsetting while resizing
Browse files Browse the repository at this point in the history
  • Loading branch information
Acuion committed Mar 30, 2017
1 parent d34d948 commit 7ffc8e4
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/tiled/mapdocument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,16 +348,14 @@ void MapDocument::resizeMap(const QSize &size, const QPoint &offset, bool remove
case Layer::ObjectGroupType: {
ObjectGroup *objectGroup = static_cast<ObjectGroup*>(layer);

// Remove objects that will fall outside of the map
if (removeObjects) {
for (MapObject *o : objectGroup->objects()) {
if (!visibleIn(visibleArea, o, mRenderer)) {
new RemoveMapObject(this, o, command);
} else {
QPointF oldPos = o->position();
QPointF newPos = oldPos + pixelOffset;
new MoveMapObject(this, o, newPos, oldPos, command);
}
for (MapObject *o : objectGroup->objects()) {
if (removeObjects && !visibleIn(visibleArea, o, mRenderer)) {
// Remove objects that will fall outside of the map
new RemoveMapObject(this, o, command);
} else {
QPointF oldPos = o->position();
QPointF newPos = oldPos + pixelOffset;
new MoveMapObject(this, o, newPos, oldPos, command);
}
}
break;
Expand Down

0 comments on commit 7ffc8e4

Please sign in to comment.