mirror of
https://github.com/huderlem/porymap.git
synced 2026-03-21 17:45:44 -05:00
Sync Connections tab map view position
This commit is contained in:
parent
dbc13484b1
commit
bbe34e4983
|
|
@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|||
and this project somewhat adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). The MAJOR version number is bumped when there are **"Breaking Changes"** in the pret projects. For more on this, see [the manual page on breaking changes](https://huderlem.github.io/porymap/manual/breaking-changes.html).
|
||||
|
||||
## [Unreleased]
|
||||
### Changed
|
||||
- The scroll position of the map view now remains the same between the Connections tab and the Map/Events tabs.
|
||||
|
||||
### Fixed
|
||||
- Fix warning not appearing when the log file exceeds maximum size.
|
||||
- Fix unnecessary resources being used to watch files.
|
||||
|
|
|
|||
|
|
@ -4,11 +4,26 @@
|
|||
#include <QGraphicsView>
|
||||
#include <QMouseEvent>
|
||||
|
||||
class NoScrollGraphicsView : public QGraphicsView
|
||||
// For general utility features that we add to QGraphicsView
|
||||
class GraphicsView : public QGraphicsView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
NoScrollGraphicsView(QWidget *parent = nullptr) : QGraphicsView(parent) {}
|
||||
GraphicsView(QWidget *parent = nullptr) : QGraphicsView(parent) {}
|
||||
|
||||
void centerOn(const QGraphicsView *other) {
|
||||
if (other && other->viewport()) {
|
||||
QPoint center = other->viewport()->rect().center();
|
||||
QGraphicsView::centerOn(other->mapToScene(center));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class NoScrollGraphicsView : public GraphicsView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
NoScrollGraphicsView(QWidget *parent = nullptr) : GraphicsView(parent) {}
|
||||
|
||||
protected:
|
||||
void wheelEvent(QWheelEvent *event) {
|
||||
|
|
@ -32,11 +47,11 @@ signals:
|
|||
void clicked(QMouseEvent *event);
|
||||
};
|
||||
|
||||
class ConnectionsView : public QGraphicsView
|
||||
class ConnectionsView : public GraphicsView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ConnectionsView(QWidget *parent = nullptr) : QGraphicsView(parent) {}
|
||||
ConnectionsView(QWidget *parent = nullptr) : GraphicsView(parent) {}
|
||||
|
||||
signals:
|
||||
void pressedDelete();
|
||||
|
|
|
|||
|
|
@ -8,13 +8,13 @@
|
|||
|
||||
class Editor;
|
||||
|
||||
class MapView : public QGraphicsView
|
||||
class MapView : public GraphicsView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MapView() : QGraphicsView() {}
|
||||
MapView(QWidget *parent) : QGraphicsView(parent) {}
|
||||
MapView() : GraphicsView() {}
|
||||
MapView(QWidget *parent) : GraphicsView(parent) {}
|
||||
|
||||
Editor *editor;
|
||||
|
||||
|
|
|
|||
|
|
@ -177,10 +177,20 @@ void Editor::setEditMode(EditMode editMode) {
|
|||
this->ui->pushButton_ChangeDimensions->setEnabled(editingLayout);
|
||||
this->ui->checkBox_smartPaths->setEnabled(editingLayout);
|
||||
|
||||
if (this->editMode == EditMode::Events || oldEditMode == EditMode::Events) {
|
||||
if (this->editMode != oldEditMode) {
|
||||
// When switching to or from the Connections tab we sync up the two separate map graphics views.
|
||||
if (this->editMode == EditMode::Connections) {
|
||||
ui->graphicsView_Connections->centerOn(ui->graphicsView_Map);
|
||||
} else if (oldEditMode == EditMode::Connections) {
|
||||
ui->graphicsView_Map->centerOn(ui->graphicsView_Connections);
|
||||
}
|
||||
|
||||
// When switching to or from the Events tab the opacity of the events changes. Redraw the events to reflect that change.
|
||||
redrawAllEvents();
|
||||
if (this->editMode == EditMode::Events || oldEditMode == EditMode::Events) {
|
||||
redrawAllEvents();
|
||||
}
|
||||
}
|
||||
|
||||
if (this->editMode == EditMode::Events){
|
||||
updateWarpEventWarnings();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user