Skip to content

Commit

Permalink
Don't reset stamp brush state when pressing Alt
Browse files Browse the repository at this point in the history
This way, Alt can be used to toggle the scrolling direction without
interrupting a Paint or Capture operation.

Also, while drawing lines or circles, pressing Alt no longer resets
the state when a start or mid point was already set.

See https://twitter.com/Lanbobyonson/status/978015338582376448
  • Loading branch information
bjorn committed Mar 27, 2018
1 parent 8d8ffc6 commit 40a3cac
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* macOS: Fixed eye/lock icon display in Layers view
* Re-enabled Space for toggling layer visibility
* Migrate properties set on tile collision layer to the tile (#1912)
* Don't reset stamp brush state when pressing Alt
* Automapping: Apply rules to selected area when there is one
* Windows and Linux: Updated builds to Qt 5.10.1
* Linux: Indicate Tiled can open multiple files at once in desktop file
Expand Down
27 changes: 16 additions & 11 deletions src/tiled/stampbrush.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,25 +170,30 @@ void StampBrush::modifiersChanged(Qt::KeyboardModifiers modifiers)
if (mStamp.isEmpty() && !mIsWangFill)
return;

BrushBehavior brushBehavior = mBrushBehavior;

if (modifiers & Qt::ShiftModifier) {
if (modifiers & Qt::ControlModifier) {
if (mBrushBehavior == LineStartSet) {
mBrushBehavior = CircleMidSet;
} else {
mBrushBehavior = Circle;
if (brushBehavior == LineStartSet) {
brushBehavior = CircleMidSet;
} else if (brushBehavior != CircleMidSet) {
brushBehavior = Circle;
}
} else {
if (mBrushBehavior == CircleMidSet) {
mBrushBehavior = LineStartSet;
} else {
mBrushBehavior = Line;
if (brushBehavior == CircleMidSet) {
brushBehavior = LineStartSet;
} else if (brushBehavior != LineStartSet) {
brushBehavior = Line;
}
}
} else {
mBrushBehavior = Free;
} else if (brushBehavior != Paint && brushBehavior != Capture) {
brushBehavior = Free;
}

updatePreview();
if (mBrushBehavior != brushBehavior) {
mBrushBehavior = brushBehavior;
updatePreview();
}
}

void StampBrush::languageChanged()
Expand Down

0 comments on commit 40a3cac

Please sign in to comment.