forked from K0lb3/UnityPy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRectangle.py
More file actions
42 lines (34 loc) · 860 Bytes
/
Rectangle.py
File metadata and controls
42 lines (34 loc) · 860 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
class Rectangle:
height: int
width: int
x: int
y: int
def __init__(self, *args, **kwargs):
if args:
# Rectangle(Point, Size)
if len(args) == 4:
self.x, self.y, self.width, self.height = args
elif kwargs:
self.__dict__.update(kwargs)
def round(self):
return Rectangle(
round(self.x), round(self.y), round(self.width), round(self.height)
)
@property
def left(self):
return self.x
@property
def top(self):
return self.y
@property
def right(self):
return self.x + self.width
@property
def bottom(self):
return self.y + self.height
@property
def size(self):
return self.width, self.height
@property
def location(self):
return self.x, self.y