diff options
author | Seungkeun Lee <sngn.lee@samsung.com> | 2017-04-19 16:30:53 +0900 |
---|---|---|
committer | Kangho Hur <kangho.hur@samsung.com> | 2017-07-10 11:11:23 +0900 |
commit | c5dbe6845d6b73e489d46c1c891109723129062f (patch) | |
tree | 795cdfe5adf6c9f25dd9e928b7993d058e099194 | |
parent | 25c871f9a1b508156852524bc8dfef8d38528e93 (diff) | |
download | xamarin-forms-c5dbe6845d6b73e489d46c1c891109723129062f.tar.gz xamarin-forms-c5dbe6845d6b73e489d46c1c891109723129062f.tar.bz2 xamarin-forms-c5dbe6845d6b73e489d46c1c891109723129062f.zip |
Optimize Moved event handler
- Only enable Moved event handler when enabled transformation feature
Change-Id: I2fe9f1c041290af1bde5783a47fcb0bc7ac13bd0
-rw-r--r-- | Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs index 37e2a036..a103abf7 100644 --- a/Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs +++ b/Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs @@ -45,6 +45,7 @@ namespace Xamarin.Forms.Platform.Tizen HashSet<string> _batchedProperties = new HashSet<string>(); int _layoutCallback = 0; + bool _movedCallbackEnabled = false; /// <summary> /// Default constructor. @@ -426,7 +427,10 @@ namespace Xamarin.Forms.Platform.Tizen { if (NativeView != null) { - NativeView.Moved -= OnMoved; + if (_movedCallbackEnabled) + { + NativeView.Moved -= OnMoved; + } NativeView.Deleted -= NativeViewDeleted; } @@ -442,7 +446,10 @@ namespace Xamarin.Forms.Platform.Tizen if (NativeView != null) { NativeView.Deleted += NativeViewDeleted; - NativeView.Moved += OnMoved; + if (_movedCallbackEnabled) + { + NativeView.Moved += OnMoved; + } } widget = NativeView as Widget; @@ -1002,6 +1009,19 @@ namespace Xamarin.Forms.Platform.Tizen if (changed) { NativeView.EvasMap = map; + if (!_movedCallbackEnabled) + { + _movedCallbackEnabled = true; + NativeView.Moved += OnMoved; + } + } + else + { + if (_movedCallbackEnabled) + { + _movedCallbackEnabled = false; + NativeView.Moved -= OnMoved; + } } } EFocusDirection ConvertToNativeFocusDirection(string direction) { |