Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name scale properties on Sprites to things that make sense (#2021)
* incomplete scale fix * fix a bunch of tests * fix more tests * typo * fix the one broken test and speed up .scale setter * fix docstrings * Fix examples * typing go brrr * Remove overly strict Point annotation * Fix misuse of Point annotation which should be Point2 * Annotate HitBox scale __init__ arguments as Point2 * Annotate BasicSprite scale return as Point2 * Fix set_size tests w/ notes on problems with == in pyglet==2.1dev2 * Add temp fix for pyglet 2.1dev2 * Remove Vec2 from test_set_size() * Update BasicSprite.scale and tests for it * Make .scale convert to Vec2 on return * Update scale unit tests to use tuples * Fix formatting to make CI happy * Add optimized validation for BasicSprite.size + tests * Optimize & clean up BasicSprite.scale_x setter * Remove if check around texture since we are guaranteed to have one now * Rename scale_x argument from new_value to new_scale_x * Unpack self._scale into old_scale_* * Remove redundant scale setting for y * Apply new scale to the hitbox first to raise exceptions earlier * Optimize & clean up BasicSprite.scale_y setter * Remove if check around texture since we are guaranteed to have one now * Rename scale_x argument from new_value to new_scale_x * Unpack self._scale into old_scale_* * Remove redundant scale setting for x * Apply new scale to the hitbox first to raise exceptions earlier * Optimize and clean up scale setter * Rename new_value to new_scale * Assign to scale_x and scale_y instead of immediate tuple creation * Add comments about hot code path asking not to DRY it * Add exception checks for unpack * Reorder and reduce use of dot and index acccess * Remove extra line * Revert use of assert in size.setter since digi was right * Clean up rescale_relative_to_point's insides * Significantly redeuce dot and index access in rescale_relative_to_point * Precache re-used quantities * Comments for clarity * Update rescale_relative_to_point's docstring * Use scale instead of removed scale_xy * Convert to more pyglet/Google-style * Unify rescale*_relative_to_point methods * Add vector unpack check logic to rescale_relative_to_point * Update signature annotations * Update docstring * Rename factor argument to scale_by * Delete body of rescale_xy_relative_to_point * Update docstring to point to rescale_relative_to_point with deprecation * Add @warning wrapper to rescale_xy_relative_to_point * Apply auto-formatting * Fix typo * Make Sphinx build * Fix use of Point with Point2 * Add detailed explanation of seemingly strange Vec2 usage --------- Co-authored-by: Darren Eberly <darren@eber.ly> Co-authored-by: Einar Forselv <eforselv@gmail.com> Co-authored-by: pushfoo <36696816+pushfoo@users.noreply.github.com>
- Loading branch information