show or hide rects immediately with shortcuts

This commit is contained in:
garak 2020-09-07 14:05:17 -04:00
parent 0aca9ba943
commit 40078888f8
3 changed files with 12 additions and 0 deletions

View file

@ -33,6 +33,7 @@ public:
MetatileSelector *metatileSelector;
Settings *settings;
bool active;
bool has_mouse = false;
bool right_click;
int paint_tile_initial_x;
int paint_tile_initial_y;
@ -93,6 +94,7 @@ signals:
protected:
void hoverMoveEvent(QGraphicsSceneHoverEvent*);
void hoverEnterEvent(QGraphicsSceneHoverEvent*);
void hoverLeaveEvent(QGraphicsSceneHoverEvent*);
void mousePressEvent(QGraphicsSceneMouseEvent*);
void mouseMoveEvent(QGraphicsSceneMouseEvent*);

View file

@ -1366,6 +1366,9 @@ void MainWindow::on_actionPlayer_View_Rectangle_triggered()
bool enabled = ui->actionPlayer_View_Rectangle->isChecked();
porymapConfig.setShowPlayerView(enabled);
this->editor->settings->playerViewRectEnabled = enabled;
if (this->editor->map_item->has_mouse) {
this->editor->playerViewRect->setVisible(enabled);
}
}
void MainWindow::on_actionCursor_Tile_Outline_triggered()
@ -1373,6 +1376,9 @@ void MainWindow::on_actionCursor_Tile_Outline_triggered()
bool enabled = ui->actionCursor_Tile_Outline->isChecked();
porymapConfig.setShowCursorTile(enabled);
this->editor->settings->cursorTileRectEnabled = enabled;
if (this->editor->map_item->has_mouse) {
this->editor->cursorMapTileRect->setVisible(enabled);
}
}
void MainWindow::on_actionUse_Encounter_Json_triggered(bool checked)

View file

@ -747,11 +747,15 @@ void MapPixmapItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event) {
setCursor(this->settings->mapCursor);
}
}
void MapPixmapItem::hoverEnterEvent(QGraphicsSceneHoverEvent *) {
this->has_mouse = true;
}
void MapPixmapItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *) {
emit this->hoveredMapMetatileCleared();
if (this->settings->betterCursors && this->paintingMode != MapPixmapItem::PaintMode::Disabled) {
unsetCursor();
}
this->has_mouse = false;
}
void MapPixmapItem::mousePressEvent(QGraphicsSceneMouseEvent *event) {
QPointF pos = event->pos();