Merge pull request #810 from huderlem/huderlem/event-pan-conflict
Some checks failed
Build Porymap / build-linux (, 5.14.2) (push) Has been cancelled
Build Porymap / build-linux (, 6.8.*) (push) Has been cancelled
Build Porymap / build-linux (minimal, 5.14.2) (push) Has been cancelled
Build Porymap / build-macos (macos-15-intel) (push) Has been cancelled
Build Porymap / build-macos (macos-latest) (push) Has been cancelled
Build Porymap / build-static-windows (push) Has been cancelled

Don't drag events when panning with middle-mouse click
This commit is contained in:
GriffinR
2026-10-06 20:30:44 -04:00
committed by GitHub

View File

@@ -4,6 +4,8 @@
#include "mapruler.h"
#include "metatile.h"
#include <QApplication>
EventPixmapItem::EventPixmapItem(Event *event)
: QGraphicsPixmapItem(event->getPixmap()),
m_basePixmap(pixmap()),
@@ -75,6 +77,11 @@ void EventPixmapItem::updatePixelPosition() {
void EventPixmapItem::mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent) {
if (m_active)
return;
if (QApplication::mouseButtons() & Qt::MiddleButton) {
// Let the view handle the event so that it can pan instead of dragging this item.
mouseEvent->ignore();
return;
}
m_active = true;
m_lastPos = Metatile::coordFromPixmapCoord(mouseEvent->scenePos());