Skip to content

Instantly share code, notes, and snippets.

@AbstractBeliefs
Created May 25, 2018 20:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AbstractBeliefs/af2a4dd2d0a1fa41115ef391ce3d87b7 to your computer and use it in GitHub Desktop.
Save AbstractBeliefs/af2a4dd2d0a1fa41115ef391ce3d87b7 to your computer and use it in GitHub Desktop.
diff --git a/screenlayout/snap.py b/screenlayout/snap.py
index 4ae3d25..c596b59 100644
--- a/screenlayout/snap.py
+++ b/screenlayout/snap.py
@@ -34,6 +34,9 @@ class Snap(object):
self.horizontal.add(i[0].top-size.height)
self.horizontal.add(i[0].top+i[1].height-size.height)
+ self.vertical.add((i[0].left + i[1].width/2)-size.width/2)
+ self.horizontal.add((i[0].top + i[1].height/2)-size.height/2)
+
def suggest(self, position):
vertical = [x for x in self.vertical if abs(x-position[0])<self.tolerance]
horizontal = [y for y in self.horizontal if abs(y-position[1])<self.tolerance]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment