Fix alternating through random colors when picking from the same ColorButton

This commit is contained in:
David Capello 2021-05-18 14:58:29 -03:00
parent 414165f078
commit fe1d96ed0e
2 changed files with 12 additions and 2 deletions

View File

@ -159,7 +159,12 @@ bool ColorButton::onProcessMessage(Message* msg)
gfx::Point screenPos = nativeWindow->pointToScreen(mousePos);
Widget* picked = manager()->pickFromScreenPos(screenPos);
IColorSource* colorSource = (picked != this ? dynamic_cast<IColorSource*>(picked): nullptr);
if (picked == this) {
// Do nothing
break;
}
IColorSource* colorSource = dynamic_cast<IColorSource*>(picked);
if (colorSource) {
nativeWindow = picked->display()->nativeWindow();
mousePos = nativeWindow->pointFromScreen(screenPos);

View File

@ -96,7 +96,12 @@ bool TileButton::onProcessMessage(Message* msg)
// Pick a tile from a ITileSource
Widget* picked = window()->pick(mousePos);
ITileSource* tileSource = (picked != this ? dynamic_cast<ITileSource*>(picked): nullptr);
if (picked == this) {
// Do nothing
break;
}
ITileSource* tileSource = dynamic_cast<ITileSource*>(picked);
// If there is no tile source in this window, try to get the
// tile from other display, i.e. and editor in other native