Several things are changed to fix columns and rows calculation in de Export Sprite Sheet Dialog.
- onSizeChange() Conditions were added to consider padding and sprite sheet type in columns and rows calculation.
- onSheetTypeChange() Condition was added to consider best_fit mode, and consequent columns and rows calculation.
- On ExportSpriteSheetWindow creation, unnecessary conditions and onSizeChange execution were removed. Because, we need update columns, rows, fitWith and fitHeight according the current sprite data (done in onColumnsChange()), instead of the saved params.
- best_fit() function: type sprite sheet argument was added to fix columns and rows calculation when Columns type sprite sheet is selected in best fit mode.
- best_fit() function: it was simplified by removing the “for” iterations since they were unnecessary. We found a simpler way to do that.
- best_fit() function: it have no longer gfx::Region and gfx::Rect variables, because, the calculation is simpler now.
- MID macros were replaced by base::clamp() function.
This is a common solution in the DocApi wrapper that takes cares of
the duplicated cels that we're copying with copyCel() and that are
linked in the source, so then it maps the links into the destination.
Solving this in DocApi we fixed the problem on the timeline
drag-and-drop (doc_range_ops), copy/paste clipboard ranges, and merged
the code in NewFrame to duplicate (linked) cels.
We've also added 3 variants of Duplicate Cels with this change:
- Duplicate Cels: Copies the whole cel block without linking to
previous cels.
- Duplicate Linked Cels: Copies the whole cel block linking all cels to
previous cels.
- Duplicate Cels w/Layer Mode: Depending on the layer mode (continuous
or not) the cels will be linked or not (this is how "duplicate
linked cels" was working before, and was added just in case for
backward compatibility).
Fixes: http://steamcommunity.com/app/431730/discussions/1/142261352649813598/
The threshold of 50% was chosen to select layers that are more visible
than others (whatever is the order of layers in the stack) but it
might not be working as expected (e.g. if both composed layers has
alpha < 128 it will select no layer at all). Maybe in the we could
choose a higher threshold than 1, but let's see how it works for
users.
Before this fix, with Contour Tool activated (Pixel Perfect = OFF), if
we did click while we were moving the mouse inside the same pixel, it
wasn't drawn.
Related to: https://community.aseprite.org/t/3509