Browse Source

Fix offset value when selecting another connection

yenatch 6 years ago
parent
commit
ae4158ce7b
1 changed files with 2 additions and 1 deletions
  1. 2
    1
      editor.cpp

+ 2
- 1
editor.cpp View File

@@ -276,6 +276,7 @@ void Editor::onConnectionItemSelected(ConnectionPixmapItem* connectionItem) {
276 276
     setConnectionEditControlValues(selected_connection_item->connection);
277 277
     ui->spinBox_ConnectionOffset->setMaximum(selected_connection_item->getMaxOffset());
278 278
     ui->spinBox_ConnectionOffset->setMinimum(selected_connection_item->getMinOffset());
279
+    onConnectionOffsetChanged(selected_connection_item->connection->offset.toInt());
279 280
 }
280 281
 
281 282
 void Editor::setSelectedConnectionFromMap(QString mapName) {
@@ -534,7 +535,7 @@ void Editor::updateConnectionOffset(int offset) {
534 535
     selected_connection_item->connection->offset = QString::number(offset);
535 536
     if (selected_connection_item->connection->direction == "up" || selected_connection_item->connection->direction == "down") {
536 537
         selected_connection_item->setX(selected_connection_item->initialX + (offset - selected_connection_item->initialOffset) * 16);
537
-    } else {
538
+    } else if (selected_connection_item->connection->direction == "left" || selected_connection_item->connection->direction == "right") {
538 539
         selected_connection_item->setY(selected_connection_item->initialY + (offset - selected_connection_item->initialOffset) * 16);
539 540
     }
540 541
     selected_connection_item->blockSignals(false);