-
Notifications
You must be signed in to change notification settings - Fork 848
Add ability to rotate sprites other than 90 degree angles #1162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
TransformUtils.js - added RotateNearestNeighbor.js (duplicate of Rotate.js)
… used as a reference for adding new features. - updated RotateNearestNeighbor.js to have named function ns.RotateNearestNeighbor (but still uses old rotate function) - added `new pskl.tools.transform.RotateNearestNeighbor(),` to src\js\controller\TransformationsController.js - added .icon-tool-rotate-nearest-neighbor to icons.css (copy of rotate) - keeps deleting itself... - fixed, icons.css is autogenerated from the images img/icons . copied rotate images to rotate-nearest-neighbor versions - added to font-icons.css .piskel-icon-rotate-nearest-neighborleft:before { content: "\e603"; } .piskel-icon-rotate-nearest-neighborright:before { content: "\e604"; } - edited RotateNearestNeighbor.js to use RotateNearestNeighbor - added RotateNearestNeighbor.js to src/piskel-script-list.js
The transform "RotateNearestNeighbor" is a clone of rotate. It still uses `ns.TransformUtils.rotate(frame, direction);` to perform the transform.
…; as clone of ns.TransformUtils.rotate(frame, direction);
I pivoted away from "rotation" because debugging was giving me issues. The rotateNearestNeighbor: function in TransformUtils.js now "mirrors" pixels across the vertical plane.
While we are limited to the hardcoded value of var angle = ...; you can set this to any angle and rotate appropriately!
- Updated rotateNearestNeighbor in TransformUtils.js to accept an angle argument - Added a this.angle parameter and a setAngle function to RotateNearestNeighbor.js - use 'alt' to set the angle and it is remebered for future use.
Now it properly interacts with undo and redo
Suggested Squashed Commit Message: Added RotateNearestNeighbor Tool with Full Angle Support
|
Hi @juliandescottes, Sorry to bother you. This is my first PR so I am not entirely sure how to proceed and saw you were an active contributor. I submitted this pull request about 2 months ago and I wanted to check if there's anything I can do to help move it forward. Please let me know if any changes are needed or if there's anything else I can assist with. Thanks for you in advance for your time! |
Open issue 1076 asked for the ability to rotate frames at angles other than 90 degrees.
I implemented the new functionality as a new transform tool RotateNearestNeighbor.js in folder src\js\tools\transform (and touched a few other files).
After some debugging related to undo/redo it seems to be working.