Skip to content

Commit

Permalink
Escape key now also cancels extending the polyline
Browse files Browse the repository at this point in the history
  • Loading branch information
ketanhwr committed Aug 6, 2017
1 parent b5f824e commit f4c2cd8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/tiled/editpolygontool.cpp
Expand Up @@ -39,6 +39,7 @@
#include <QApplication>
#include <QGraphicsItem>
#include <QGraphicsView>
#include <QKeyEvent>
#include <QMenu>
#include <QPainter>
#include <QPalette>
Expand Down Expand Up @@ -183,6 +184,20 @@ void EditPolygonTool::deactivate(MapScene *scene)
AbstractObjectTool::deactivate(scene);
}

void EditPolygonTool::keyPressed(QKeyEvent *event)
{
switch (event->key()) {
case Qt::Key_Escape:
if (mMode == Extending) {
cancelAddingNode();
return;
}
break;
}

AbstractObjectTool::keyPressed(event);
}

void EditPolygonTool::mouseEntered()
{
}
Expand Down
1 change: 1 addition & 0 deletions src/tiled/editpolygontool.h
Expand Up @@ -48,6 +48,7 @@ class EditPolygonTool : public AbstractObjectTool
void activate(MapScene *scene) override;
void deactivate(MapScene *scene) override;

void keyPressed(QKeyEvent *event) override;
void mouseEntered() override;
void mouseMoved(const QPointF &pos,
Qt::KeyboardModifiers modifiers) override;
Expand Down

0 comments on commit f4c2cd8

Please sign in to comment.