From a507d54721445b44cfea7fb032a68d996bf17f09 Mon Sep 17 00:00:00 2001 From: Adeel Kazmi Date: Thu, 27 Dec 2018 15:03:44 +0000 Subject: [PATCH 1/1] (ToggleButton) Fix weird artefacts when toggling the button We were not respecting whether the visual was enabled/disabled. Change-Id: I3619c1d10a9b4e281588b86d4b7556940bbdf739 --- .../internal/controls/buttons/toggle-button-impl.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/dali-toolkit/internal/controls/buttons/toggle-button-impl.cpp b/dali-toolkit/internal/controls/buttons/toggle-button-impl.cpp index 0ecae06..ccc515d 100755 --- a/dali-toolkit/internal/controls/buttons/toggle-button-impl.cpp +++ b/dali-toolkit/internal/controls/buttons/toggle-button-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -305,8 +305,17 @@ const std::vector& ToggleButton::GetToggleTooltips() const void ToggleButton::PrepareVisual(Property::Index index, Toolkit::Visual::Base& visual) { - DevelControl::RegisterVisual( *this, index, visual, true ); - DevelControl::EnableVisual( *this, index, false ); + bool enabled = false; // Disabled by default + + // Unregister the visual with the given index if registered previously + if( DevelControl::GetVisual( *this, index ) ) + { + // Check whether it was enabled to ensure we do the same with the new visual we're registering + enabled = DevelControl::IsVisualEnabled( *this, index ); + DevelControl::UnregisterVisual( *this, index ); + } + + DevelControl::RegisterVisual( *this, index, visual, enabled ); } void ToggleButton::RelayoutVisual( Property::Index index, const Vector2& size ) -- 2.7.4