Add ability to rotate sprites other than 90 degree angles#1162
Open
enykwest wants to merge 13 commits intopiskelapp:masterfrom
Open
Add ability to rotate sprites other than 90 degree angles#1162enykwest wants to merge 13 commits intopiskelapp:masterfrom
enykwest wants to merge 13 commits intopiskelapp:masterfrom
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
Author
|
Suggested Squashed Commit Message: Added RotateNearestNeighbor Tool with Full Angle Support
|
Author
|
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.