diff --git a/xrandroll/monitor_item.py b/xrandroll/monitor_item.py index 8d2a209..16fba99 100644 --- a/xrandroll/monitor_item.py +++ b/xrandroll/monitor_item.py @@ -76,15 +76,16 @@ class MonitorItem(QGraphicsRectItem, QObject): current_pos = event.screenPos() new_pos = view.mapFromScene(self.orig_pos) + current_pos - click_pos new_pos = view.mapToScene(new_pos) + delta = view.mapToScene(0, 20).y() if not event.modifiers() & Qt.AltModifier: # Check for snaps x = new_pos.x() delta_x = min((abs(x - sx), i) for i, sx in enumerate(snaps_x)) - if delta_x[0] < 50: # snap + if delta_x[0] < delta: # snap new_pos.setX(int(snaps_x[delta_x[1]])) y = new_pos.y() delta_y = min((abs(y - sy), i) for i, sy in enumerate(snaps_y)) - if delta_y[0] < 50: # snap + if delta_y[0] < delta: # snap new_pos.setY(int(snaps_y[delta_y[1]])) self.setPos(new_pos) self.window.show_pos(int(self.pos().x()), int(self.pos().y()))