mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-14 04:19:12 +00:00
Fix PaletteView::setColumns() to set a correct number of columns for small palettes
If we have a palette with few colors (e.g. just one row of colors), we would like to setup a columns number equal to the whole available PaletteView width. This is because when we drag colors, we can drop them in position that are outside the current palette size.
This commit is contained in:
parent
b7122b0ab3
commit
60a3da7b7c
@ -80,8 +80,6 @@ PaletteView::PaletteView(bool editable, PaletteViewStyle style, PaletteViewDeleg
|
||||
void PaletteView::setColumns(int columns)
|
||||
{
|
||||
int old_columns = m_columns;
|
||||
|
||||
ASSERT(columns >= 1 && columns <= currentPalette()->size());
|
||||
m_columns = columns;
|
||||
|
||||
if (m_columns != old_columns) {
|
||||
@ -529,7 +527,7 @@ void PaletteView::onResize(ui::ResizeEvent& ev)
|
||||
int columns =
|
||||
(view->getViewportBounds().w-this->childSpacing()*2)
|
||||
/ (m_boxsize+this->childSpacing());
|
||||
setColumns(MID(1, columns, currentPalette()->size()));
|
||||
setColumns(MAX(1, columns));
|
||||
}
|
||||
m_isUpdatingColumns = false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user