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 baseMapWidth;
|
||||||
int baseMapHeight;
|
int baseMapHeight;
|
||||||
void render(qreal opacity = 1);
|
void render(qreal opacity = 1);
|
||||||
int getMinOffset();
|
|
||||||
int getMaxOffset();
|
|
||||||
void setEditable(bool editable);
|
void setEditable(bool editable);
|
||||||
bool getEditable();
|
bool getEditable();
|
||||||
void updateHighlight(bool selected);
|
void updateHighlight(bool selected);
|
||||||
|
|
|
@ -822,12 +822,6 @@ void Editor::redrawConnection(ConnectionPixmapItem* connectionItem) {
|
||||||
|
|
||||||
connectionItem->basePixmap = pixmap;
|
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) {
|
if (connectionItem == selected_connection_item) {
|
||||||
QPainter painter(&pixmap);
|
QPainter painter(&pixmap);
|
||||||
painter.setPen(QColor(255, 0, 255));
|
painter.setPen(QColor(255, 0, 255));
|
||||||
|
@ -855,8 +849,6 @@ void Editor::updateConnectionOffset(int offset) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
selected_connection_item->blockSignals(true);
|
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;
|
selected_connection_item->connection->offset = offset;
|
||||||
if (selected_connection_item->connection->direction == "up" || selected_connection_item->connection->direction == "down") {
|
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);
|
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);
|
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)
|
QVariant ConnectionPixmapItem::itemChange(GraphicsItemChange change, const QVariant &value)
|
||||||
{
|
{
|
||||||
if (change == ItemPositionChange) {
|
if (change == ItemPositionChange) {
|
||||||
|
@ -37,8 +23,6 @@ QVariant ConnectionPixmapItem::itemChange(GraphicsItemChange change, const QVari
|
||||||
if (this->connection->direction == "up" || this->connection->direction == "down") {
|
if (this->connection->direction == "up" || this->connection->direction == "down") {
|
||||||
x = round(newPos.x() / 16) * 16;
|
x = round(newPos.x() / 16) * 16;
|
||||||
newOffset += (x - initialX) / 16;
|
newOffset += (x - initialX) / 16;
|
||||||
newOffset = qMin(newOffset, this->getMaxOffset());
|
|
||||||
newOffset = qMax(newOffset, this->getMinOffset());
|
|
||||||
x = newOffset * 16;
|
x = newOffset * 16;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -48,8 +32,6 @@ QVariant ConnectionPixmapItem::itemChange(GraphicsItemChange change, const QVari
|
||||||
if (this->connection->direction == "right" || this->connection->direction == "left") {
|
if (this->connection->direction == "right" || this->connection->direction == "left") {
|
||||||
y = round(newPos.y() / 16) * 16;
|
y = round(newPos.y() / 16) * 16;
|
||||||
newOffset += (y - this->initialY) / 16;
|
newOffset += (y - this->initialY) / 16;
|
||||||
newOffset = qMin(newOffset, this->getMaxOffset());
|
|
||||||
newOffset = qMax(newOffset, this->getMinOffset());
|
|
||||||
y = newOffset * 16;
|
y = newOffset * 16;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -20,10 +20,8 @@ ConnectionsListItem::ConnectionsListItem(QWidget *parent, const QStringList &map
|
||||||
ui->comboBox_Map->setMinimumContentsLength(6);
|
ui->comboBox_Map->setMinimumContentsLength(6);
|
||||||
ui->comboBox_Map->addItems(mapNames);
|
ui->comboBox_Map->addItems(mapNames);
|
||||||
|
|
||||||
/* TODO: Spin box limits
|
ui->spinBox_Offset->setMinimum(INT_MIN);
|
||||||
ui->spinBox_ConnectionOffset->setMaximum(selected_connection_item->getMaxOffset());
|
ui->spinBox_Offset->setMaximum(INT_MAX);
|
||||||
ui->spinBox_ConnectionOffset->setMinimum(selected_connection_item->getMinOffset());
|
|
||||||
*/
|
|
||||||
|
|
||||||
// TODO:
|
// TODO:
|
||||||
//connect(ui->button_Delete, &QAbstractButton::clicked, [this](bool) { this->d;});
|
//connect(ui->button_Delete, &QAbstractButton::clicked, [this](bool) { this->d;});
|
||||||
|
|
Loading…
Reference in a new issue