How to do a multi selectable grid of 8x8 tiles? #19248
Replies: 1 comment
-
Custom selection logic is what I'd do. Track pointer events in a top layer that contains all tiles. Map the rectangle formed by the start and current/end locations to a 2D range of tiles. Then mark those tiles as selected or create a semitransparent overlay around them. I do the latter so that I can animate a selection border, but you can achieve similar with individually selected tiles with a lot more work. Virtual layers are worth the code as you're going to be writing a lot of UX code to tweak things to fit expectations for a graphical editor anyways.
Any slicing of input images is out-of-scope for Avalonia. It's up to you to properly manage a cache. In most cases, this is impossible as images are stored with compression and you must decompress the entire thing. In cases where you're reading raw bitmap data, this is possible, but will be a large performance hurdle. I would cache entire scanlines instead of trying to only read what's on screen unless you have images that can be tens of thousands of pixels wide. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Question.
How do I...
Beta Was this translation helpful? Give feedback.
All reactions