diff --git a/include/ui/connectionpixmapitem.h b/include/ui/connectionpixmapitem.h index c3d98cff..fd1042fd 100644 --- a/include/ui/connectionpixmapitem.h +++ b/include/ui/connectionpixmapitem.h @@ -27,8 +27,6 @@ public: int baseMapWidth; int baseMapHeight; void render(qreal opacity = 1); - int getMinOffset(); - int getMaxOffset(); void setEditable(bool editable); bool getEditable(); void updateHighlight(bool selected); diff --git a/src/editor.cpp b/src/editor.cpp index ec3e7f0b..bd217f81 100644 --- a/src/editor.cpp +++ b/src/editor.cpp @@ -822,12 +822,6 @@ void Editor::redrawConnection(ConnectionPixmapItem* connectionItem) { connectionItem->basePixmap = pixmap; - // TODO: Make sure offset limiting is correct (and updated) - // New map may have a different minimum offset than the last one. The maximum will be the same. - /*int min = selected_connection_item->getMinOffset(); - //ui->spinBox_ConnectionOffset->setMinimum(min); // Connections TODO: - onConnectionOffsetChanged(qMax(min, selected_connection_item->connection->offset));*/ - if (connectionItem == selected_connection_item) { QPainter painter(&pixmap); painter.setPen(QColor(255, 0, 255)); @@ -855,8 +849,6 @@ void Editor::updateConnectionOffset(int offset) { return; selected_connection_item->blockSignals(true); - offset = qMin(offset, selected_connection_item->getMaxOffset()); - offset = qMax(offset, selected_connection_item->getMinOffset()); selected_connection_item->connection->offset = offset; if (selected_connection_item->connection->direction == "up" || selected_connection_item->connection->direction == "down") { selected_connection_item->setX(selected_connection_item->initialX + (offset - selected_connection_item->initialOffset) * 16); diff --git a/src/ui/connectionpixmapitem.cpp b/src/ui/connectionpixmapitem.cpp index 256c556a..65907490 100644 --- a/src/ui/connectionpixmapitem.cpp +++ b/src/ui/connectionpixmapitem.cpp @@ -13,20 +13,6 @@ void ConnectionPixmapItem::render(qreal opacity) { this->setPixmap(newPixmap); } -int ConnectionPixmapItem::getMinOffset() { - if (this->connection->direction == "up" || this->connection->direction == "down") - return -(this->pixmap().width() / 16) - 6; - else - return -(this->pixmap().height() / 16) - 6; -} - -int ConnectionPixmapItem::getMaxOffset() { - if (this->connection->direction == "up" || this->connection->direction == "down") - return this->baseMapWidth + 6; - else - return this->baseMapHeight + 6; -} - QVariant ConnectionPixmapItem::itemChange(GraphicsItemChange change, const QVariant &value) { if (change == ItemPositionChange) { @@ -37,8 +23,6 @@ QVariant ConnectionPixmapItem::itemChange(GraphicsItemChange change, const QVari if (this->connection->direction == "up" || this->connection->direction == "down") { x = round(newPos.x() / 16) * 16; newOffset += (x - initialX) / 16; - newOffset = qMin(newOffset, this->getMaxOffset()); - newOffset = qMax(newOffset, this->getMinOffset()); x = newOffset * 16; } else { @@ -48,8 +32,6 @@ QVariant ConnectionPixmapItem::itemChange(GraphicsItemChange change, const QVari if (this->connection->direction == "right" || this->connection->direction == "left") { y = round(newPos.y() / 16) * 16; newOffset += (y - this->initialY) / 16; - newOffset = qMin(newOffset, this->getMaxOffset()); - newOffset = qMax(newOffset, this->getMinOffset()); y = newOffset * 16; } else { diff --git a/src/ui/connectionslistitem.cpp b/src/ui/connectionslistitem.cpp index 810b9a56..4980bff3 100644 --- a/src/ui/connectionslistitem.cpp +++ b/src/ui/connectionslistitem.cpp @@ -20,10 +20,8 @@ ConnectionsListItem::ConnectionsListItem(QWidget *parent, const QStringList &map ui->comboBox_Map->setMinimumContentsLength(6); ui->comboBox_Map->addItems(mapNames); - /* TODO: Spin box limits - ui->spinBox_ConnectionOffset->setMaximum(selected_connection_item->getMaxOffset()); - ui->spinBox_ConnectionOffset->setMinimum(selected_connection_item->getMinOffset()); - */ + ui->spinBox_Offset->setMinimum(INT_MIN); + ui->spinBox_Offset->setMaximum(INT_MAX); // TODO: //connect(ui->button_Delete, &QAbstractButton::clicked, [this](bool) { this->d;});