Skip to content

Commit

Permalink
pos: Remove obsolete from_any method
Browse files Browse the repository at this point in the history
  • Loading branch information
mal committed Jan 29, 2024
1 parent cba2c29 commit c15f39c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
4 changes: 2 additions & 2 deletions renpy/atl.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ def interpolate(t, a, b, typ):

if typ in (position_or_none, position):
if renpy.config.mixed_position:
a = position.from_any(a)
b = position.from_any(b)
a = position(a)
b = position(b)
return a + t * (b - a)
else:
typ = type(b)
Expand Down
14 changes: 7 additions & 7 deletions renpy/display/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,10 +324,10 @@ def get_anchor_polar_vector(self):
and the first element of each tuple is in x and the second in y.
They represent the vector from the anchoraround point to the final anchor point.
"""
xanchoraround = position.from_any(self.xanchoraround)
yanchoraround = position.from_any(self.yanchoraround)
xanchor = position.from_any(first_not_none(self.xanchor, self.inherited_xanchor, 0))
yanchor = position.from_any(first_not_none(self.yanchor, self.inherited_yanchor, 0))
xanchoraround = position(self.xanchoraround)
yanchoraround = position(self.yanchoraround)
xanchor = position(first_not_none(self.xanchor, self.inherited_xanchor, 0))
yanchor = position(first_not_none(self.yanchor, self.inherited_yanchor, 0))

absolute_vector = (xanchor.absolute-xanchoraround.absolute, yanchor.absolute-yanchoraround.absolute)
relative_vector = (xanchor.relative-xanchoraround.relative, yanchor.relative-yanchoraround.relative)
Expand Down Expand Up @@ -401,7 +401,7 @@ def set_anchorradius(self, anchorradius):
and set xanchor and yanchor such that the anchorangle stays the same,
and the anchorradius (as explained above) is the given one.
"""
anchorradius = position.from_any(anchorradius)
anchorradius = position(anchorradius)

polar_vectors = self.get_anchor_polar_vector()
anchorangle = self.get_anchorangle(polar_vectors)
Expand Down Expand Up @@ -429,8 +429,8 @@ def set_anchor_from_anchorangle_and_anchorradius(self,
relative_anchorradius,
):

xanchoraround = position.from_any(self.xanchoraround)
yanchoraround = position.from_any(self.yanchoraround)
xanchoraround = position(self.xanchoraround)
yanchoraround = position(self.yanchoraround)

absolute_anchorangle = absolute_anchorangle * math.pi / 180
relative_anchorangle = relative_anchorangle * math.pi / 180
Expand Down
4 changes: 1 addition & 3 deletions renpy/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,6 @@ def __new__(cls, absolute=0, relative=None):

return self

from_any = classmethod(__new__)

def __add__(self, other):
if isinstance(other, position):
return position(self.absolute + other.absolute,
Expand Down Expand Up @@ -312,4 +310,4 @@ def mesh(x):
def position_or_none(x):
if x is None:
return None
return position.from_any(x)
return position(x)

0 comments on commit c15f39c

Please sign in to comment.