mirror of
https://github.com/huderlem/porymap.git
synced 2026-09-07 00:15:18 -05:00
Fix regression to cursor single tile mode
This commit is contained in:
@@ -50,12 +50,16 @@ public:
|
||||
void stopAnchor();
|
||||
void initRightClickSelectionAnchor(int coordX, int coordY);
|
||||
void stopRightClickSelectionAnchor();
|
||||
void setSmartPathMode(bool enable);
|
||||
bool getSmartPathMode() { return this->smartPathMode; }
|
||||
void setStraightPathMode(bool enable);
|
||||
bool getStraightPathMode() { return this->straightPathMode; }
|
||||
void setSingleTileMode();
|
||||
void stopSingleTileMode();
|
||||
|
||||
void setSmartPathMode(bool enable) { this->smartPathMode = enable; }
|
||||
bool getSmartPathMode() const { return this->smartPathMode; }
|
||||
|
||||
void setStraightPathMode(bool enable) { this->straightPathMode = enable; }
|
||||
bool getStraightPathMode() const { return this->straightPathMode; }
|
||||
|
||||
void setSingleTileMode(bool enable) { this->singleTileMode = enable; }
|
||||
bool getSingleTileMode() const { return this->singleTileMode; }
|
||||
|
||||
void updateLocation(int x, int y);
|
||||
void updateSelectionSize(int width, int height);
|
||||
void setActive(bool active);
|
||||
|
||||
@@ -168,11 +168,15 @@ void Editor::setEditMode(EditMode editMode) {
|
||||
if (editingLayout && this->layout) {
|
||||
editStack = &this->layout->editHistory;
|
||||
}
|
||||
this->cursorMapTileRect->setSingleTileMode();
|
||||
|
||||
this->cursorMapTileRect->setSingleTileMode(editMode == EditMode::Collision);
|
||||
this->cursorMapTileRect->setActive(editingLayout);
|
||||
this->playerViewRect->setActive(editingLayout);
|
||||
this->editGroup.setActiveStack(editStack);
|
||||
setMapEditingButtonsEnabled(editingLayout);
|
||||
this->ui->toolButton_Fill->setEnabled(editingLayout);
|
||||
this->ui->toolButton_Dropper->setEnabled(editingLayout);
|
||||
this->ui->pushButton_ChangeDimensions->setEnabled(editingLayout);
|
||||
this->ui->checkBox_smartPaths->setEnabled(editingLayout);
|
||||
|
||||
if (this->editMode == EditMode::Events || oldEditMode == EditMode::Events) {
|
||||
// When switching to or from the Events tab the opacity of the events changes. Redraw the events to reflect that change.
|
||||
@@ -183,22 +187,6 @@ void Editor::setEditMode(EditMode editMode) {
|
||||
}
|
||||
}
|
||||
|
||||
void Editor::setMapEditingButtonsEnabled(bool enabled) {
|
||||
this->ui->toolButton_Fill->setEnabled(enabled);
|
||||
this->ui->toolButton_Dropper->setEnabled(enabled);
|
||||
this->ui->pushButton_ChangeDimensions->setEnabled(enabled);
|
||||
// If the fill button is pressed, unpress it and select the pointer.
|
||||
if (!enabled && (this->ui->toolButton_Fill->isChecked() || this->ui->toolButton_Dropper->isChecked())) {
|
||||
this->mapEditAction = EditAction::Select;
|
||||
this->settings->mapCursor = QCursor();
|
||||
this->cursorMapTileRect->setSingleTileMode();
|
||||
this->ui->toolButton_Fill->setChecked(false);
|
||||
this->ui->toolButton_Dropper->setChecked(false);
|
||||
this->ui->toolButton_Select->setChecked(true);
|
||||
}
|
||||
this->ui->checkBox_smartPaths->setEnabled(enabled);
|
||||
}
|
||||
|
||||
void Editor::clearWildMonTables() {
|
||||
QStackedWidget *stack = ui->stackedWidget_WildMons;
|
||||
const QSignalBlocker blocker(stack);
|
||||
@@ -1406,7 +1394,6 @@ void Editor::mouseEvent_map(QGraphicsSceneMouseEvent *event, LayoutPixmapItem *i
|
||||
if (event->buttons() & Qt::RightButton) {
|
||||
this->eventEditAction = EditAction::Select;
|
||||
this->settings->mapCursor = QCursor();
|
||||
this->cursorMapTileRect->setSingleTileMode();
|
||||
this->ui->toolButton_Paint->setChecked(false);
|
||||
this->ui->toolButton_Select->setChecked(true);
|
||||
} else {
|
||||
|
||||
@@ -2454,7 +2454,7 @@ void MainWindow::on_toolButton_Paint_clicked()
|
||||
editor->settings->mapCursor = QCursor(QPixmap(":/icons/pencil_cursor.ico"), 10, 10);
|
||||
|
||||
if (ui->mapViewTab->currentIndex() != MapViewTab::Collision)
|
||||
editor->cursorMapTileRect->stopSingleTileMode();
|
||||
editor->cursorMapTileRect->setSingleTileMode(false);
|
||||
|
||||
ui->graphicsView_Map->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||
ui->graphicsView_Map->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||
@@ -2473,7 +2473,7 @@ void MainWindow::on_toolButton_Select_clicked()
|
||||
editor->eventEditAction = Editor::EditAction::Select;
|
||||
|
||||
editor->settings->mapCursor = QCursor();
|
||||
editor->cursorMapTileRect->setSingleTileMode();
|
||||
editor->cursorMapTileRect->setSingleTileMode(true);
|
||||
|
||||
ui->graphicsView_Map->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||
ui->graphicsView_Map->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||
@@ -2492,7 +2492,7 @@ void MainWindow::on_toolButton_Fill_clicked()
|
||||
editor->eventEditAction = Editor::EditAction::Fill;
|
||||
|
||||
editor->settings->mapCursor = QCursor(QPixmap(":/icons/fill_color_cursor.ico"), 10, 10);
|
||||
editor->cursorMapTileRect->setSingleTileMode();
|
||||
editor->cursorMapTileRect->setSingleTileMode(true);
|
||||
|
||||
ui->graphicsView_Map->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||
ui->graphicsView_Map->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||
@@ -2511,7 +2511,7 @@ void MainWindow::on_toolButton_Dropper_clicked()
|
||||
editor->eventEditAction = Editor::EditAction::Pick;
|
||||
|
||||
editor->settings->mapCursor = QCursor(QPixmap(":/icons/pipette_cursor.ico"), 10, 10);
|
||||
editor->cursorMapTileRect->setSingleTileMode();
|
||||
editor->cursorMapTileRect->setSingleTileMode(true);
|
||||
|
||||
ui->graphicsView_Map->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||
ui->graphicsView_Map->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||
@@ -2530,7 +2530,7 @@ void MainWindow::on_toolButton_Move_clicked()
|
||||
editor->eventEditAction = Editor::EditAction::Move;
|
||||
|
||||
editor->settings->mapCursor = QCursor(QPixmap(":/icons/move.ico"), 7, 7);
|
||||
editor->cursorMapTileRect->setSingleTileMode();
|
||||
editor->cursorMapTileRect->setSingleTileMode(true);
|
||||
|
||||
ui->graphicsView_Map->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
ui->graphicsView_Map->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
@@ -2549,7 +2549,7 @@ void MainWindow::on_toolButton_Shift_clicked()
|
||||
editor->eventEditAction = Editor::EditAction::Shift;
|
||||
|
||||
editor->settings->mapCursor = QCursor(QPixmap(":/icons/shift_cursor.ico"), 10, 10);
|
||||
editor->cursorMapTileRect->setSingleTileMode();
|
||||
editor->cursorMapTileRect->setSingleTileMode(true);
|
||||
|
||||
ui->graphicsView_Map->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||
ui->graphicsView_Map->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||
|
||||
@@ -63,26 +63,6 @@ void CursorTileRect::updateSelectionSize(int width, int height)
|
||||
this->update();
|
||||
}
|
||||
|
||||
void CursorTileRect::setSmartPathMode(bool enable)
|
||||
{
|
||||
this->smartPathMode = enable;
|
||||
}
|
||||
|
||||
void CursorTileRect::setStraightPathMode(bool enable)
|
||||
{
|
||||
this->straightPathMode = enable;
|
||||
}
|
||||
|
||||
void CursorTileRect::setSingleTileMode()
|
||||
{
|
||||
this->singleTileMode = true;
|
||||
}
|
||||
|
||||
void CursorTileRect::stopSingleTileMode()
|
||||
{
|
||||
this->singleTileMode = false;
|
||||
}
|
||||
|
||||
bool CursorTileRect::smartPathInEffect()
|
||||
{
|
||||
return !this->rightClickSelectionAnchored && this->smartPathMode && this->selectionHeight == 3 && this->selectionWidth == 3;
|
||||
|
||||
Reference in New Issue
Block a user