tuikit/core/coords.py
changeset 94 e50dae408fe9
parent 91 de80e140b0ec
child 97 0c2e0c09ba5c
--- a/tuikit/core/coords.py	Thu Mar 27 08:03:51 2014 +0100
+++ b/tuikit/core/coords.py	Fri Mar 28 10:44:29 2014 +0100
@@ -16,6 +16,13 @@
     def __repr__(self):
         return 'Point(x={0.x},y={0.y})'.format(self)
 
+    def move(self, relx, rely):
+        self.x += relx
+        self.y += rely
+
+    def moved(self, relx, rely):
+        return Point(self.x + relx, self.y + rely)
+
     def update(self, *args, **kwargs):
         """Update point.
 
@@ -129,6 +136,10 @@
         return (self.x <= x < self.x + self.w
             and self.y <= y < self.y + self.h)
 
+    def moved(self, relx, rely):
+        """Return new Rect with same size, moved by `relx`, `rely`."""
+        return Rect(self.x + relx, self.y + rely, self.w, self.h)
+
     def intersect(self, other):
         x1 = max(self.x, other.x)
         y1 = max(self.y, other.y)