mirror of
https://github.com/huderlem/porymap.git
synced 2026-08-14 04:46:49 -05:00
Move map cursor UI and grid to foreground
This commit is contained in:
@@ -102,6 +102,8 @@ public:
|
||||
void duplicateSelectedEvents();
|
||||
void redrawObject(DraggablePixmapItem *item);
|
||||
QList<DraggablePixmapItem *> getObjects();
|
||||
void updateCursorRectPos(int x, int y);
|
||||
void setCursorRectVisible(bool visible);
|
||||
|
||||
QGraphicsScene *scene = nullptr;
|
||||
QGraphicsPixmapItem *current_view = nullptr;
|
||||
|
||||
@@ -41,10 +41,10 @@ public:
|
||||
}
|
||||
|
||||
painter->setPen(this->color);
|
||||
painter->drawRect(-1, -1, width + 2, height + 2);
|
||||
painter->drawRect(x() - 1, y() - 1, width + 2, height + 2);
|
||||
painter->setPen(QColor(0, 0, 0));
|
||||
painter->drawRect(-2, -2, width + 4, height + 4);
|
||||
painter->drawRect(0, 0, width, height);
|
||||
painter->drawRect(x() - 2, y() - 2, width + 4, height + 4);
|
||||
painter->drawRect(x(), y(), width, height);
|
||||
}
|
||||
void initAnchor(int coordX, int coordY);
|
||||
void stopAnchor();
|
||||
@@ -58,10 +58,10 @@ public:
|
||||
void stopSingleTileMode();
|
||||
void updateLocation(int x, int y);
|
||||
void updateSelectionSize(int width, int height);
|
||||
void setVisibility(bool visible);
|
||||
void setActive(bool active);
|
||||
bool *enabled;
|
||||
private:
|
||||
bool visible;
|
||||
bool active;
|
||||
int width;
|
||||
int height;
|
||||
bool anchored;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#ifndef GRAPHICSVIEW_H
|
||||
#define GRAPHICSVIEW_H
|
||||
|
||||
#include "overlay.h"
|
||||
#include <QGraphicsView>
|
||||
#include <QMouseEvent>
|
||||
|
||||
@@ -12,23 +11,14 @@ class GraphicsView : public QGraphicsView
|
||||
public:
|
||||
GraphicsView() : QGraphicsView() {}
|
||||
GraphicsView(QWidget *parent) : QGraphicsView(parent) {}
|
||||
Overlay * getOverlay(int layer);
|
||||
void clearOverlays();
|
||||
void setOverlaysHidden(bool hidden);
|
||||
void setOverlaysX(int x);
|
||||
void setOverlaysY(int y);
|
||||
void setOverlaysPosition(int x, int y);
|
||||
void moveOverlays(int deltaX, int deltaY);
|
||||
|
||||
public:
|
||||
// GraphicsView_Object object;
|
||||
Editor *editor;
|
||||
QMap<int, Overlay*> overlayMap;
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void mouseMoveEvent(QMouseEvent *event);
|
||||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
void drawForeground(QPainter *painter, const QRectF &rect);
|
||||
void moveEvent(QMoveEvent *event);
|
||||
};
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ public:
|
||||
bool prevStraightPathState;
|
||||
int straight_path_initial_x;
|
||||
int straight_path_initial_y;
|
||||
QPoint metatilePos;
|
||||
enum Axis {
|
||||
None = 0,
|
||||
X,
|
||||
|
||||
26
include/ui/mapview.h
Normal file
26
include/ui/mapview.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#ifndef MAPVIEW_H
|
||||
#define MAPVIEW_H
|
||||
|
||||
#include "graphicsview.h"
|
||||
#include "overlay.h"
|
||||
|
||||
class MapView : public GraphicsView
|
||||
{
|
||||
public:
|
||||
MapView() : GraphicsView() {}
|
||||
MapView(QWidget *parent) : GraphicsView(parent) {}
|
||||
Overlay * getOverlay(int layer);
|
||||
void clearOverlays();
|
||||
void setOverlaysHidden(bool hidden);
|
||||
void setOverlaysX(int x);
|
||||
void setOverlaysY(int y);
|
||||
void setOverlaysPosition(int x, int y);
|
||||
void moveOverlays(int deltaX, int deltaY);
|
||||
|
||||
public:
|
||||
QMap<int, Overlay*> overlayMap;
|
||||
protected:
|
||||
void drawForeground(QPainter *painter, const QRectF &rect);
|
||||
};
|
||||
|
||||
#endif // GRAPHICSVIEW_H
|
||||
@@ -20,11 +20,12 @@ public:
|
||||
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) override
|
||||
{
|
||||
if (!(*enabled)) return;
|
||||
painter->setPen(this->color);
|
||||
painter->drawRect(-2, -2, this->width + 3, this->height + 3);
|
||||
painter->drawRect(x() - 2, y() - 2, this->width + 3, this->height + 3);
|
||||
painter->setPen(QColor(0, 0, 0));
|
||||
painter->drawRect(-3, -3, this->width + 5, this->height + 5);
|
||||
painter->drawRect(-1, -1, this->width + 1, this->height + 1);
|
||||
painter->drawRect(x() - 3, y() - 3, this->width + 5, this->height + 5);
|
||||
painter->drawRect(x() - 1, y() - 1, this->width + 1, this->height + 1);
|
||||
}
|
||||
void updateLocation(int x, int y);
|
||||
bool *enabled;
|
||||
|
||||
Reference in New Issue
Block a user