Temporarily disable smart paths when checked and shift held (closes #294)

This commit is contained in:
BigBahss 2020-08-29 18:48:51 -04:00 committed by garak
parent 50e13ecae3
commit e597192cc0
2 changed files with 24 additions and 8 deletions

View file

@ -1011,11 +1011,19 @@ void Editor::onMapEndPaint(QGraphicsSceneMouseEvent *, MapPixmapItem *item) {
void Editor::setSmartPathCursorMode(QGraphicsSceneMouseEvent *event)
{
bool smartPathsEnabled = event->modifiers() & Qt::ShiftModifier;
if (smartPathsEnabled || settings->smartPathsEnabled) {
this->cursorMapTileRect->setSmartPathMode();
bool shiftPressed = event->modifiers() & Qt::ShiftModifier;
if (settings->smartPathsEnabled) {
if (!shiftPressed) {
this->cursorMapTileRect->setSmartPathMode();
} else {
this->cursorMapTileRect->setNormalPathMode();
}
} else {
this->cursorMapTileRect->setNormalPathMode();
if (shiftPressed) {
this->cursorMapTileRect->setSmartPathMode();
} else {
this->cursorMapTileRect->setNormalPathMode();
}
}
}

View file

@ -15,12 +15,20 @@ void MapPixmapItem::paint(QGraphicsSceneMouseEvent *event) {
int y = static_cast<int>(pos.y()) / 16;
// Paint onto the map.
bool smartPathsEnabled = event->modifiers() & Qt::ShiftModifier;
bool shiftPressed = event->modifiers() & Qt::ShiftModifier;
QPoint selectionDimensions = this->metatileSelector->getSelectionDimensions();
if ((this->settings->smartPathsEnabled || smartPathsEnabled) && selectionDimensions.x() == 3 && selectionDimensions.y() == 3) {
paintSmartPath(x, y);
if (settings->smartPathsEnabled) {
if (!shiftPressed && selectionDimensions.x() == 3 && selectionDimensions.y() == 3) {
paintSmartPath(x, y);
} else {
paintNormal(x, y);
}
} else {
paintNormal(x, y);
if (shiftPressed && selectionDimensions.x() == 3 && selectionDimensions.y() == 3) {
paintSmartPath(x, y);
} else {
paintNormal(x, y);
}
}
}
}