Remove strict offset limitations
This commit is contained in:
parent
2fa3a9b398
commit
1f78fb9c4f
4 changed files with 2 additions and 32 deletions
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;});
|
||||
|
|
Loading…
Reference in a new issue