summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeungkeun Lee <sngn.lee@samsung.com>2017-07-04 07:20:24 (GMT)
committerKangho Hur <kangho.hur@samsung.com>2017-07-10 02:11:28 (GMT)
commita0eafa63f4994dee7bbabf1ef916f520a0f68182 (patch)
tree03e0b40a342147bb4fdab7e5d846aab395f1a7ba
parent01496831b6404774f28e38db08e43fef83caf91a (diff)
downloadxamarin-forms-a0eafa63f4994dee7bbabf1ef916f520a0f68182.zip
xamarin-forms-a0eafa63f4994dee7bbabf1ef916f520a0f68182.tar.gz
xamarin-forms-a0eafa63f4994dee7bbabf1ef916f520a0f68182.tar.bz2
Fix Layout issue
- All layouts should update all children position when their position is updated But it was done by EFL box - Some case, before child was added into Box(efl), Layout(Box) was moved. and child who didn't added into Box does not moved - Fixing * Remove overried UpdateLayout method on LayoutRenderer * Moved SetRenderer position after adding the children - Refactoring * Change IVisualElementRenderer interface * UpdateNativeGeometry was Changed to private * UpdateLayout was exposed as IVisualElementRenderer Change-Id: I74bfdab00667bd6fa13cd8d392868af901b98dae
-rw-r--r--Xamarin.Forms.Platform.Tizen/Renderers/IVisualElementRenderer.cs2
-rw-r--r--Xamarin.Forms.Platform.Tizen/Renderers/LayoutRenderer.cs12
-rw-r--r--Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs31
3 files changed, 21 insertions, 24 deletions
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/IVisualElementRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/IVisualElementRenderer.cs
index 4702fd3..0b64549 100644
--- a/Xamarin.Forms.Platform.Tizen/Renderers/IVisualElementRenderer.cs
+++ b/Xamarin.Forms.Platform.Tizen/Renderers/IVisualElementRenderer.cs
@@ -34,6 +34,6 @@ namespace Xamarin.Forms.Platform.Tizen
SizeRequest GetDesiredSize(double widthConstraint, double heightConstraint);
- void UpdateNativeGeometry();
+ void UpdateLayout();
}
}
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/LayoutRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/LayoutRenderer.cs
index 69fd24a..226afbb 100644
--- a/Xamarin.Forms.Platform.Tizen/Renderers/LayoutRenderer.cs
+++ b/Xamarin.Forms.Platform.Tizen/Renderers/LayoutRenderer.cs
@@ -42,18 +42,6 @@ namespace Xamarin.Forms.Platform.Tizen
base.Dispose(disposing);
}
- protected override void UpdateLayout()
- {
- base.UpdateLayout();
- if (!_layoutUpdatedRegistered)
- {
- foreach (var child in Element.LogicalChildren)
- {
- Platform.GetRenderer(child)?.UpdateNativeGeometry();
- }
- }
- }
-
void OnLayoutUpdated(object sender, Native.LayoutEventArgs e)
{
DoLayout(e);
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs
index 4a409f0..0d6b303 100644
--- a/Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs
+++ b/Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs
@@ -188,9 +188,6 @@ namespace Xamarin.Forms.Platform.Tizen
// send notification
OnElementChanged(new ElementChangedEventArgs<TElement>(oldElement, newElement));
- // store renderer for the new element
- Platform.SetRenderer(newElement, this);
-
// add children
var logicalChildren = (newElement as IElementController).LogicalChildren;
foreach (Element child in logicalChildren)
@@ -198,18 +195,15 @@ namespace Xamarin.Forms.Platform.Tizen
AddChild(child);
}
+ // store renderer for the new element
+ Platform.SetRenderer(newElement, this);
+
OnElementReady();
}
- public void UpdateNativeGeometry()
+ void IVisualElementRenderer.UpdateLayout()
{
- var updatedGeometry = new Rectangle(ComputeAbsolutePoint(Element), new Size(Element.Width, Element.Height)).ToPixel();
-
- if (NativeView.Geometry != updatedGeometry)
- {
- NativeView.Geometry = updatedGeometry;
- ApplyTransformation();
- }
+ UpdateLayout();
}
void IVisualElementRenderer.SetElement(VisualElement element)
@@ -288,6 +282,10 @@ namespace Xamarin.Forms.Platform.Tizen
{
Platform.SetRenderer(Element, null);
}
+
+ // Reset Element geometry, to re-calculate when Renderer was re-attached
+ Element.Layout(new Rectangle(0, 0, -1, -1));
+
Element = default(TElement);
}
@@ -438,6 +436,17 @@ namespace Xamarin.Forms.Platform.Tizen
}
}
+ void UpdateNativeGeometry()
+ {
+ var updatedGeometry = new Rectangle(ComputeAbsolutePoint(Element), new Size(Element.Width, Element.Height)).ToPixel();
+
+ if (NativeView.Geometry != updatedGeometry)
+ {
+ NativeView.Geometry = updatedGeometry;
+ ApplyTransformation();
+ }
+ }
+
void NativeViewDeleted(object sender, EventArgs e)
{
Dispose();