mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-14 04:19:12 +00:00
Avoid redrawing the whole ContextBar while playing an animation
This commit is contained in:
parent
bcfd06fd1b
commit
45337ccbac
@ -1569,10 +1569,12 @@ public:
|
||||
const doc::SelectedObjects& slices) {
|
||||
if (!slices.empty()) {
|
||||
auto selected = slices.frontAs<doc::Slice>();
|
||||
m_combobox.setValue(selected->name());
|
||||
if (m_combobox.getValue() != selected->name())
|
||||
m_combobox.setValue(selected->name());
|
||||
}
|
||||
else {
|
||||
m_combobox.setValue(std::string());
|
||||
if (!m_combobox.getValue().empty())
|
||||
m_combobox.setValue(std::string());
|
||||
}
|
||||
updateLayout();
|
||||
}
|
||||
@ -1619,10 +1621,14 @@ private:
|
||||
|
||||
void updateLayout() {
|
||||
const bool visible = (m_doc && !m_doc->sprite()->slices().empty());
|
||||
const bool relayout = (visible != m_combobox.isVisible() ||
|
||||
visible != m_action.isVisible());
|
||||
|
||||
m_combobox.setVisible(visible);
|
||||
m_action.setVisible(visible);
|
||||
|
||||
parent()->layout();
|
||||
if (relayout)
|
||||
parent()->layout();
|
||||
}
|
||||
|
||||
void onSelAction(const int item) {
|
||||
@ -1825,11 +1831,8 @@ void ContextBar::onToolSetContiguous()
|
||||
void ContextBar::onActiveSiteChange(const Site& site)
|
||||
{
|
||||
DocObserverWidget<ui::HBox>::onActiveSiteChange(site);
|
||||
if (site.sprite())
|
||||
m_sliceFields->selectSlices(site.sprite(),
|
||||
site.selectedSlices());
|
||||
else
|
||||
m_sliceFields->closeComboBox();
|
||||
if (m_sliceFields->isVisible())
|
||||
updateSliceFields(site);
|
||||
}
|
||||
|
||||
void ContextBar::onDocChange(Doc* doc)
|
||||
@ -1910,6 +1913,15 @@ void ContextBar::onDropPixels(ContextBarObserver::DropAction action)
|
||||
notify_observers(&ContextBarObserver::onDropPixels, action);
|
||||
}
|
||||
|
||||
void ContextBar::updateSliceFields(const Site& site)
|
||||
{
|
||||
if (site.sprite())
|
||||
m_sliceFields->selectSlices(site.sprite(),
|
||||
site.selectedSlices());
|
||||
else
|
||||
m_sliceFields->closeComboBox();
|
||||
}
|
||||
|
||||
void ContextBar::updateForActiveTool()
|
||||
{
|
||||
updateForTool(App::instance()->activeTool());
|
||||
@ -2105,6 +2117,8 @@ void ContextBar::updateForTool(tools::Tool* tool)
|
||||
m_symmetry->updateWithCurrentDocument();
|
||||
|
||||
m_sliceFields->setVisible(isSlice);
|
||||
if (isSlice)
|
||||
updateSliceFields(UIContext::instance()->activeSite());
|
||||
|
||||
// Update ink shades with the current selected palette entries
|
||||
if (updateShade)
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2018-2020 Igara Studio S.A.
|
||||
// Copyright (C) 2018-2021 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
@ -122,6 +122,7 @@ namespace app {
|
||||
void onSymmetryModeChange();
|
||||
void onFgOrBgColorChange(doc::Brush::ImageColor imageColor);
|
||||
void onDropPixels(ContextBarObserver::DropAction action);
|
||||
void updateSliceFields(const Site& site);
|
||||
|
||||
// ActiveToolObserver impl
|
||||
void onActiveToolChange(tools::Tool* tool) override;
|
||||
|
Loading…
x
Reference in New Issue
Block a user