From 0588ebd01bf823da6ab049d0b8075026fafda9e9 Mon Sep 17 00:00:00 2001 From: David Capello Date: Fri, 4 Feb 2022 17:36:49 -0300 Subject: [PATCH] [lua] Generate onclick event when we reorder/click a Dialog:shades with { mode="sort" } (fix #3081) --- src/app/ui/color_shades.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/app/ui/color_shades.cpp b/src/app/ui/color_shades.cpp index 938de3c68..2ca06fc74 100644 --- a/src/app/ui/color_shades.cpp +++ b/src/app/ui/color_shades.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2019-2020 Igara Studio S.A. +// Copyright (C) 2019-2022 Igara Studio S.A. // Copyright (C) 2018 David Capello // // This program is distributed under the terms of @@ -160,10 +160,12 @@ bool ColorShades::onProcessMessage(ui::Message* msg) break; case ui::kMouseUpMessage: { + auto button = static_cast(msg)->button(); + if (m_click == ClickWholeShade) { setSelected(true); - ClickEvent ev(static_cast(msg)->button()); + ClickEvent ev(button); Click(ev); closeWindow(); @@ -180,9 +182,18 @@ bool ColorShades::onProcessMessage(ui::Message* msg) m_dragIndex = -1; invalidate(); + ClickEvent ev(button); + Click(ev); + // Relayout the context bar if we have removed an entry. - if (m_hotIndex < 0) + // + // TODO it looks like this should be handled in some kind of + // Change() event in the ColorBar + if (m_hotIndex < 0 && + parent() && + parent()->parent()) { parent()->parent()->layout(); + } } if (hasCapture())