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

View file

@ -1366,6 +1366,9 @@ void MainWindow::on_actionPlayer_View_Rectangle_triggered()
bool enabled = ui->actionPlayer_View_Rectangle->isChecked(); bool enabled = ui->actionPlayer_View_Rectangle->isChecked();
porymapConfig.setShowPlayerView(enabled); porymapConfig.setShowPlayerView(enabled);
this->editor->settings->playerViewRectEnabled = 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() 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(); bool enabled = ui->actionCursor_Tile_Outline->isChecked();
porymapConfig.setShowCursorTile(enabled); porymapConfig.setShowCursorTile(enabled);
this->editor->settings->cursorTileRectEnabled = 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) void MainWindow::on_actionUse_Encounter_Json_triggered(bool checked)

View file

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