From 9b0f406ee1d9ca12319c09746e3967f1f3fa840b Mon Sep 17 00:00:00 2001 From: Adeel Kazmi Date: Thu, 23 Jan 2020 17:28:44 +0000 Subject: [PATCH] Only change the resize policy to fixed if we haven't set the resize policy before Change-Id: I0322a8b50a22a5f5b2dcf13da763f66ee6ae979a --- dali/internal/event/actors/actor-impl.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/dali/internal/event/actors/actor-impl.cpp b/dali/internal/event/actors/actor-impl.cpp index 23c7977..ed576d1 100644 --- a/dali/internal/event/actors/actor-impl.cpp +++ b/dali/internal/event/actors/actor-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -4638,8 +4638,19 @@ void Actor::SetPreferredSize( const Vector2& size ) { EnsureRelayoutData(); - SetResizePolicy( ResizePolicy::FIXED, Dimension::WIDTH ); - SetResizePolicy( ResizePolicy::FIXED, Dimension::HEIGHT ); + // If valid width or height, then set the resize policy to FIXED + // A 0 width or height may also be required so if the resize policy has not been changed, i.e. is still set to DEFAULT, + // then change to FIXED as well + + if( size.width > 0.0f || GetResizePolicy( Dimension::WIDTH ) == ResizePolicy::DEFAULT ) + { + SetResizePolicy( ResizePolicy::FIXED, Dimension::WIDTH ); + } + + if( size.height > 0.0f || GetResizePolicy( Dimension::HEIGHT ) == ResizePolicy::DEFAULT ) + { + SetResizePolicy( ResizePolicy::FIXED, Dimension::HEIGHT ); + } mRelayoutData->preferredSize = size; -- 2.7.4