Force Units in px to be integers (rounding down)
This commit is contained in:
parent
bde7869f97
commit
8132bb9321
@ -855,6 +855,8 @@ class ColumbusConfigDefined(ColumbusEnv):
|
||||
if type(s) in [int, float]:
|
||||
return s
|
||||
if s.replace('.', '', 1).isdigit():
|
||||
if target == 'px':
|
||||
return int(s)
|
||||
return float(s)
|
||||
num, unit = s[:-2], s[-2:]
|
||||
num = float(num)
|
||||
@ -876,7 +878,7 @@ class ColumbusConfigDefined(ColumbusEnv):
|
||||
if target == 'em':
|
||||
return em
|
||||
elif target == 'px':
|
||||
return em * ({'x': self.width, 'y': self.height}[axis])
|
||||
return int(em * ({'x': self.width, 'y': self.height}[axis]))
|
||||
|
||||
def setup(self):
|
||||
self.agent.pos = self.start_pos
|
||||
|
@ -63,6 +63,11 @@ params:
|
||||
width: 25ry
|
||||
height: 25rx
|
||||
pos: [0.75em, 60px]
|
||||
- type: RectBarrier
|
||||
num: 1
|
||||
width: 2ct
|
||||
height: 3ct
|
||||
pos: [0.75em, 90px]
|
||||
- type: OnceReward
|
||||
reward: 100
|
||||
radius: 3ct
|
||||
|
Loading…
Reference in New Issue
Block a user