Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/mapwidget.cc')
-rw-r--r--src/mapwidget.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/mapwidget.cc b/src/mapwidget.cc
index 2ce1def..d960c0a 100644
--- a/src/mapwidget.cc
+++ b/src/mapwidget.cc
@@ -290,15 +290,34 @@ EntityWidget *MapWidget::addEntity()
void MapWidget::duplicateSelected()
{
+ std::vector<EntityWidget *> new_widgets;
+
for (int i = 0; i < mapwidget_enties.size(); ++i) {
EntityWidget *entitywidget = mapwidget_enties.at(i);
if (entitywidget->selected()) {
// duplicate the child widget
+ EntityWidget *new_entitywidget = addEntity();
+ new_widgets.push_back(new_entitywidget);
+ new_entitywidget->assign(*entitywidget);
+
+ // offset the new widget's position
+ const int offset = 32;
+ Vector3f location = new_entitywidget->properties()->location();
+ new_entitywidget->properties()->set_location(location.x() + offset, location.y() - offset, location.z());
+ // deselect the old widgets
+ entitywidget->set_selected(false);
} else {
}
}
+
+ // select the new widgets
+ for(int i = 0; i < new_widgets.size(); ++i)
+ new_widgets.at(i)->set_selected(true);
+
+ resizeChildren();
+ update();
}
void MapWidget::deleteSelected()