From c37096208436058f9a198d5124dedb5f6aca2164 Mon Sep 17 00:00:00 2001 From: SangHyeon Jade Lee Date: Fri, 17 Sep 2021 01:49:27 -0700 Subject: [PATCH] [NUI] apply scaling factor to point size (#3594) --- .../public/BaseComponents/TextEditorBindableProperty.cs | 16 ++++++++++++++++ .../public/BaseComponents/TextFieldBindableProperty.cs | 16 ++++++++++++++++ .../public/BaseComponents/TextLabelBindableProperty.cs | 8 ++++++++ 3 files changed, 40 insertions(+) diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextEditorBindableProperty.cs b/src/Tizen.NUI/src/public/BaseComponents/TextEditorBindableProperty.cs index e400fe5..2ded6c4 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextEditorBindableProperty.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextEditorBindableProperty.cs @@ -101,6 +101,10 @@ namespace Tizen.NUI.BaseComponents var textEditor = (TextEditor)bindable; if (newValue != null) { + if (GraphicsTypeManager.Instance.ScalingFactor != 0.0f) + { + newValue = (float)newValue * GraphicsTypeManager.Instance.ScalingFactor; + } Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)textEditor.SwigCPtr, TextEditor.Property.PointSize, new Tizen.NUI.PropertyValue((float)newValue)); } }), @@ -109,6 +113,10 @@ namespace Tizen.NUI.BaseComponents var textEditor = (TextEditor)bindable; float temp = 0.0f; Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)textEditor.SwigCPtr, TextEditor.Property.PointSize).Get(out temp); + if (GraphicsTypeManager.Instance.ScalingFactor != 0.0f) + { + temp = (float)temp / GraphicsTypeManager.Instance.ScalingFactor; + } return temp; })); /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. @@ -513,6 +521,10 @@ namespace Tizen.NUI.BaseComponents var textEditor = (TextEditor)bindable; if (newValue != null) { + if (GraphicsTypeManager.Instance.ScalingFactor != 0.0f) + { + newValue = (float)newValue * GraphicsTypeManager.Instance.ScalingFactor; + } Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)textEditor.SwigCPtr, TextEditor.Property.InputPointSize, new Tizen.NUI.PropertyValue((float)newValue)); } }), @@ -521,6 +533,10 @@ namespace Tizen.NUI.BaseComponents var textEditor = (TextEditor)bindable; float temp = 0.0f; Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)textEditor.SwigCPtr, TextEditor.Property.InputPointSize).Get(out temp); + if (GraphicsTypeManager.Instance.ScalingFactor != 0.0f) + { + temp = (float)temp / GraphicsTypeManager.Instance.ScalingFactor; + } return temp; })); /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextFieldBindableProperty.cs b/src/Tizen.NUI/src/public/BaseComponents/TextFieldBindableProperty.cs index 8d7cef6..9ba8fd2 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextFieldBindableProperty.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextFieldBindableProperty.cs @@ -169,6 +169,10 @@ namespace Tizen.NUI.BaseComponents var textField = (TextField)bindable; if (newValue != null) { + if (GraphicsTypeManager.Instance.ScalingFactor != 0.0f) + { + newValue = (float)newValue * GraphicsTypeManager.Instance.ScalingFactor; + } Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)textField.SwigCPtr, TextField.Property.PointSize, new Tizen.NUI.PropertyValue((float)newValue)); } }), @@ -177,6 +181,10 @@ namespace Tizen.NUI.BaseComponents var textField = (TextField)bindable; float temp = 0.0f; Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)textField.SwigCPtr, TextField.Property.PointSize).Get(out temp); + if (GraphicsTypeManager.Instance.ScalingFactor != 0.0f) + { + temp = (float)temp / GraphicsTypeManager.Instance.ScalingFactor; + } return temp; })); /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. @@ -721,6 +729,10 @@ namespace Tizen.NUI.BaseComponents var textField = (TextField)bindable; if (newValue != null) { + if (GraphicsTypeManager.Instance.ScalingFactor != 0.0f) + { + newValue = (float)newValue * GraphicsTypeManager.Instance.ScalingFactor; + } Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)textField.SwigCPtr, TextField.Property.InputPointSize, new Tizen.NUI.PropertyValue((float)newValue)); } }), @@ -729,6 +741,10 @@ namespace Tizen.NUI.BaseComponents var textField = (TextField)bindable; float temp = 0.0f; Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)textField.SwigCPtr, TextField.Property.InputPointSize).Get(out temp); + if (GraphicsTypeManager.Instance.ScalingFactor != 0.0f) + { + temp = (float)temp / GraphicsTypeManager.Instance.ScalingFactor; + } return temp; })); /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextLabelBindableProperty.cs b/src/Tizen.NUI/src/public/BaseComponents/TextLabelBindableProperty.cs index 433469b..511f3cf 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextLabelBindableProperty.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextLabelBindableProperty.cs @@ -136,6 +136,10 @@ namespace Tizen.NUI.BaseComponents var textLabel = (TextLabel)bindable; float temp = 0.0f; Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)textLabel.SwigCPtr, TextLabel.Property.PointSize).Get(out temp); + if (GraphicsTypeManager.Instance.ScalingFactor != 0.0f) + { + temp = (float)temp / GraphicsTypeManager.Instance.ScalingFactor; + } return temp; })); /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. @@ -769,6 +773,10 @@ namespace Tizen.NUI.BaseComponents { if (value != null) { + if (GraphicsTypeManager.Instance.ScalingFactor != 0.0f) + { + value = value * GraphicsTypeManager.Instance.ScalingFactor; + } Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)SwigCPtr, TextLabel.Property.PointSize, new Tizen.NUI.PropertyValue((float)value)); RequestLayout(); } -- 2.7.4