Closed kevinfoley closed 5 years ago
I addressed 1, but I decided not to touch 2. I was actually finding that the width could actually be a bit larger without throwing an error when setting viewPort. I'm not sure why, but it doesn't really matter because Stage 3D won't let you create a texture that large anyway.
StageTextTextEditor contains the following code to constrain the viewPortX coordinate.
There is similar code to constrain the y-coordinate.
The problem with this code occurs if the
viewPortWidth
is extremely wide. Say that theviewPortX
is 0 and theviewPortWidth
is 20,000. The first condition evaluates to true (0 + 20000 > 8191), so the viewPortX gets changed to -20000. This is less than the minimum position, but because of theelse
, the second condition doesn't get evaluated, so the viewPortX remains less than the minimum.I see two issues:
You should probably remove the "else" from the second condition so that it will detect if the viewPortX gets set too low by the first condition.
You may wish to throw a specific error if
viewPortWidth > MAX_VIEW_PORT_POSITION - MIN_VIEW_PORT_POSITION