-
-
Notifications
You must be signed in to change notification settings - Fork 292
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
Added ability to rotate and flip the brush when painting in tilemap. #8973
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
Just a few minor issues I'd like to see addressed, but overall this is a great addition to the editor, the code is readable and well-documented, and it's great to see it covered by tests as well!
Top marks! ❤️
editor/src/clj/editor/tile_map.clj
Outdated
:v-flip new-vflip | ||
:rotate90 new-rotate90}))) | ||
reordered-tiles (vec (flatten (for [y (range height)] | ||
(reverse (subvec flipped-tiles (* y width) (* (inc y) width))))))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reverse
uses a general algorithm that creates a new, reversed list from any input sequence. It works, but is kind of inefficient. Since flipped-tiles
is a vector
, you can use rseq
instead, which achieves the same result using a lightweight wrapper. It only works on "trivially reversible" sequences such as vectors, though.
@matgis Thank you for your feedback! All the improvements were addressed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice! LGTM!
…8973) * one tile implementation * add vertical flip * Add functionality for a multi tile-brush rotation * use brash as function argument * add tests * make keymaps as in Tiled * Review fixes * fix typo
Now it's possible to flip and to rotate the brush when editing tile map using the following hotkeys:
X
- flip the brush horizontallyY
- flip the brush verticallyZ
- rotate the brush 90° clockwiseFix #3296
PR checklist
Example of a well written PR description:
### Technical changes
Technical changes:
Technical notes: