Simplify some straight paths logic
This commit is contained in:
parent
5f5087df05
commit
de2246e2fd
2 changed files with 6 additions and 13 deletions
|
@ -36,7 +36,6 @@ public:
|
||||||
bool right_click;
|
bool right_click;
|
||||||
int paint_tile_initial_x;
|
int paint_tile_initial_x;
|
||||||
int paint_tile_initial_y;
|
int paint_tile_initial_y;
|
||||||
bool straightPathMode;
|
|
||||||
bool prevStraightPathState;
|
bool prevStraightPathState;
|
||||||
int straight_path_initial_x;
|
int straight_path_initial_x;
|
||||||
int straight_path_initial_y;
|
int straight_path_initial_y;
|
||||||
|
|
|
@ -17,16 +17,12 @@ void MapPixmapItem::paint(QGraphicsSceneMouseEvent *event) {
|
||||||
// Set straight paths on/off and snap to the dominant axis when on
|
// Set straight paths on/off and snap to the dominant axis when on
|
||||||
bool straightPathsEnabled = event->modifiers() & Qt::ControlModifier;
|
bool straightPathsEnabled = event->modifiers() & Qt::ControlModifier;
|
||||||
if (this->settings->straightPathsEnabled || straightPathsEnabled) {
|
if (this->settings->straightPathsEnabled || straightPathsEnabled) {
|
||||||
this->straightPathMode = true;
|
|
||||||
} else {
|
|
||||||
this->straightPathMode = false;
|
|
||||||
this->prevStraightPathState = false;
|
|
||||||
this->lockedAxis = MapPixmapItem::Axis::None;
|
|
||||||
}
|
|
||||||
if (this->straightPathMode) {
|
|
||||||
this->lockNondominantAxis(event);
|
this->lockNondominantAxis(event);
|
||||||
x = this->adjustCoord(x, MapPixmapItem::Axis::X);
|
x = this->adjustCoord(x, MapPixmapItem::Axis::X);
|
||||||
y = this->adjustCoord(y, MapPixmapItem::Axis::Y);
|
y = this->adjustCoord(y, MapPixmapItem::Axis::Y);
|
||||||
|
} else {
|
||||||
|
this->prevStraightPathState = false;
|
||||||
|
this->lockedAxis = MapPixmapItem::Axis::None;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Paint onto the map.
|
// Paint onto the map.
|
||||||
|
@ -61,14 +57,12 @@ void MapPixmapItem::shift(QGraphicsSceneMouseEvent *event) {
|
||||||
// Set straight paths on/off and snap to the dominant axis when on
|
// Set straight paths on/off and snap to the dominant axis when on
|
||||||
bool straightPathsEnabled = event->modifiers() & Qt::ControlModifier;
|
bool straightPathsEnabled = event->modifiers() & Qt::ControlModifier;
|
||||||
if (this->settings->straightPathsEnabled || straightPathsEnabled) {
|
if (this->settings->straightPathsEnabled || straightPathsEnabled) {
|
||||||
this->straightPathMode = true;
|
|
||||||
} else {
|
|
||||||
this->straightPathMode = false;
|
|
||||||
}
|
|
||||||
if (this->straightPathMode) {
|
|
||||||
this->lockNondominantAxis(event);
|
this->lockNondominantAxis(event);
|
||||||
x = this->adjustCoord(x, MapPixmapItem::Axis::X);
|
x = this->adjustCoord(x, MapPixmapItem::Axis::X);
|
||||||
y = this->adjustCoord(y, MapPixmapItem::Axis::Y);
|
y = this->adjustCoord(y, MapPixmapItem::Axis::Y);
|
||||||
|
} else {
|
||||||
|
this->prevStraightPathState = false;
|
||||||
|
this->lockedAxis = MapPixmapItem::Axis::None;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event->type() == QEvent::GraphicsSceneMousePress) {
|
if (event->type() == QEvent::GraphicsSceneMousePress) {
|
||||||
|
|
Loading…
Reference in a new issue