summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ToolAddRect.cpp25
1 files changed, 15 insertions, 10 deletions
diff --git a/ToolAddRect.cpp b/ToolAddRect.cpp
index a266756..6551be6 100644
--- a/ToolAddRect.cpp
+++ b/ToolAddRect.cpp
@@ -17,6 +17,8 @@ Room ToolAddRect::createRoom() {
ToolAddRect::ToolAddRect(EditManager *editManager) : Renderer(editManager), sidebar(editManager) {
this->editManager = editManager;
+ pressed = false;
+
image = gtk_image_new_from_stock(GTK_STOCK_MISSING_IMAGE, GTK_ICON_SIZE_BUTTON);
g_object_ref_sink(G_OBJECT(image));
}
@@ -72,18 +74,21 @@ bool ToolAddRect::buttonRelease(unsigned int button) {
pressed = false;
- if(!editManager->getHoveredVertex())
- return false;
-
- Room room = createRoom();
-
- if(!editManager->polygonOk(room))
- return false;
-
- editManager->addRoom(room);
+ if(editManager->getHoveredVertex()) {
+ Room room = createRoom();
+
+ if(editManager->polygonOk(room)) {
+ editManager->addRoom(room);
+
+ editManager->redraw();
+ sidebar.update();
+
+ return true;
+ }
+ }
editManager->redraw();
sidebar.update();
- return true;
+ return false;
}