Skip to content

Commit

Permalink
Fixed unnecessary scrollbar in X dimension for dithering selector dro…
Browse files Browse the repository at this point in the history
…pdown.

Added offset to dithering selector dropdown width to avoid X dimension scrollbar obscuring the bottom of the dropdown. This also removes the need for a vertical scrollbar for the generic number of dithering options.
Related to Issue aseprite#4001
  • Loading branch information
ChikenUni authored and dacap committed Nov 8, 2023
1 parent 9885b89 commit 1c3224a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/app/ui/dithering_selector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,11 @@ DitheringSelector::DitheringSelector(Type type)
void DitheringSelector::onInitTheme(ui::InitThemeEvent& ev)
{
ComboBox::onInitTheme(ev);
if (getItem(0))
setSizeHint(getItem(0)->sizeHint());
if (getItem(0)){
gfx::Size selectorSz = getItem(0)->sizeHint();
selectorSz.w += 8 * guiscale(); // Added offset to prevent unnecessary scrollbar in X dimension
setSizeHint(selectorSz);
}
}

void DitheringSelector::setSelectedItemByName(const std::string& name)
Expand Down Expand Up @@ -264,7 +267,9 @@ void DitheringSelector::regenerate(int selectedItemIndex)
}
selectedItemIndex = std::clamp(selectedItemIndex, 0, std::max(0, getItemCount()-1));
setSelectedItemIndex(selectedItemIndex);
setSizeHint(getItem(selectedItemIndex)->sizeHint());
gfx::Size selectorSz = getItem(selectedItemIndex)->sizeHint();
selectorSz.w += 8 * guiscale(); // Added offset to prevent unnecessary scrollbar in X dimension
setSizeHint(selectorSz);
}

render::DitheringAlgorithm DitheringSelector::ditheringAlgorithm()
Expand Down

0 comments on commit 1c3224a

Please sign in to comment.