Skip to content

Commit

Permalink
v1.3.2: Fixed issue with resizing and moving mirrored selections and …
Browse files Browse the repository at this point in the history
…disallowed moving with arrow keys while making a selection
  • Loading branch information
Locercus committed Oct 8, 2015
1 parent ff6c45a commit 5130304
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.3.1
v1.3.2
53 changes: 28 additions & 25 deletions cli/selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ def mousePressEvent(self, event):

self.pressMode = self.getPositionPressMode(x, y)

# Creating
if self.pressMode == PressMode.Creating:
self.selPos = (x, y, 0, 0)
self.selDims = (0, 0, 0, 0)
Expand Down Expand Up @@ -159,6 +158,9 @@ def mouseReleaseEvent(self, event):
self.leftPressed = False
self.pressMode = None

# Fix mirrored selections
self.selPos = self.selDims

self.updateCursor()

def mouseMoveEvent(self, event):
Expand Down Expand Up @@ -259,41 +261,42 @@ def keyPressEvent(self, event):
self.capture(dx, dy, dw, dh)

elif key in [Qt.Key_Left, Qt.Key_Up, Qt.Key_Right, Qt.Key_Down]:
diffx = 0
diffy = 0
if self.pressMode is None:
diffx = 0
diffy = 0

if key == Qt.Key_Left:
diffx = -1
if key == Qt.Key_Left:
diffx = -1

elif key == Qt.Key_Up:
diffy = -1
elif key == Qt.Key_Up:
diffy = -1

elif key == Qt.Key_Right:
diffx = 1
elif key == Qt.Key_Right:
diffx = 1

elif key == Qt.Key_Down:
diffy = 1
elif key == Qt.Key_Down:
diffy = 1


if event.modifiers() & Qt.ShiftModifier:
diffx *= 4
diffy *= 4
if event.modifiers() & Qt.ShiftModifier:
diffx *= 4
diffy *= 4


x += diffx
dx += diffx
x += diffx
dx += diffx

y += diffy
dy += diffy
y += diffy
dy += diffy

self.selPos = (x, y, w, h)
self.selDims = (dx, dy, dw, dh)
self.selPos = (x, y, w, h)
self.selDims = (dx, dy, dw, dh)

self.selection.setRect(dx, dy, dw, dh)
self.coverLeft.setRect(0, 0, x, th)
self.coverRight.setRect(x + w, 0, tw, th)
self.coverTop.setRect(x, 0, w, y)
self.coverBottom.setRect(x, y + h, w, th - y - h)
self.selection.setRect(dx, dy, dw, dh)
self.coverLeft.setRect(0, 0, x, th)
self.coverRight.setRect(x + w, 0, tw, th)
self.coverTop.setRect(x, 0, w, y)
self.coverBottom.setRect(x, y + h, w, th - y - h)



Expand Down

0 comments on commit 5130304

Please sign in to comment.