Merge pull request #497 from GriffinRichards/border-hover
Display message when hovering on border metatiles
This commit is contained in:
commit
066110f3a1
4 changed files with 34 additions and 0 deletions
|
@ -10,6 +10,9 @@ The **"Breaking Changes"** listed below are changes that have been made in the d
|
|||
### Added
|
||||
- Add `setScale` to the scripting API.
|
||||
|
||||
### Changed
|
||||
- Hovering on border metatiles with the mouse will now display their information in the bottom bar.
|
||||
|
||||
### Fixed
|
||||
- Fix New Map settings being preserved when switching projects.
|
||||
|
||||
|
|
|
@ -18,9 +18,18 @@ public:
|
|||
Map *map;
|
||||
void draw();
|
||||
signals:
|
||||
void hoveredBorderMetatileSelectionChanged(uint16_t);
|
||||
void hoveredBorderMetatileSelectionCleared();
|
||||
void borderMetatilesChanged();
|
||||
|
||||
private:
|
||||
void hoverUpdate(const QPointF &);
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent*);
|
||||
void mouseMoveEvent(QGraphicsSceneMouseEvent*);
|
||||
void hoverMoveEvent(QGraphicsSceneHoverEvent*);
|
||||
void hoverLeaveEvent(QGraphicsSceneHoverEvent*);
|
||||
};
|
||||
|
||||
#endif // BORDERMETATILESPIXMAPITEM_H
|
||||
|
|
|
@ -1443,6 +1443,10 @@ void Editor::displayBorderMetatiles() {
|
|||
selected_border_metatiles_item->draw();
|
||||
scene_selected_border_metatiles->addItem(selected_border_metatiles_item);
|
||||
|
||||
connect(selected_border_metatiles_item, &BorderMetatilesPixmapItem::hoveredBorderMetatileSelectionChanged,
|
||||
this, &Editor::onHoveredMetatileSelectionChanged);
|
||||
connect(selected_border_metatiles_item, &BorderMetatilesPixmapItem::hoveredBorderMetatileSelectionCleared,
|
||||
this, &Editor::onHoveredMetatileSelectionCleared);
|
||||
connect(selected_border_metatiles_item, &BorderMetatilesPixmapItem::borderMetatilesChanged,
|
||||
this, &Editor::onBorderMetatilesChanged);
|
||||
}
|
||||
|
|
|
@ -54,3 +54,21 @@ void BorderMetatilesPixmapItem::draw() {
|
|||
|
||||
emit borderMetatilesChanged();
|
||||
}
|
||||
|
||||
void BorderMetatilesPixmapItem::hoverUpdate(const QPointF &pixmapPos) {
|
||||
QPoint pos = Metatile::coordFromPixmapCoord(pixmapPos);
|
||||
uint16_t metatileId = this->map->getBorderMetatileId(pos.x(), pos.y());
|
||||
emit this->hoveredBorderMetatileSelectionChanged(metatileId);
|
||||
}
|
||||
|
||||
void BorderMetatilesPixmapItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) {
|
||||
this->hoverUpdate(event->pos());
|
||||
}
|
||||
|
||||
void BorderMetatilesPixmapItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event) {
|
||||
this->hoverUpdate(event->pos());
|
||||
}
|
||||
|
||||
void BorderMetatilesPixmapItem::hoverLeaveEvent(QGraphicsSceneHoverEvent*) {
|
||||
emit this->hoveredBorderMetatileSelectionCleared();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue