Skip to content

Commit 30cebdc

Browse files
committed
Add LayoutOptions
1 parent 8a7d93d commit 30cebdc

File tree

8 files changed

+64
-11
lines changed

8 files changed

+64
-11
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,3 +349,4 @@ MigrationBackup/
349349
# Ionide (cross platform F# VS Code tools) working folder
350350
.ionide/
351351
/XamarinForms.VisualDebug.App/dist
352+
/XamarinForms.VisualDebug/XamarinForms.VisualDebug/IPConstant.cs

VisualDebug.Models/RenderRepresentation.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,15 @@ public class RenderRepresentation
2323

2424
public RenderThickness Padding { get; set; }
2525

26+
public string HorizontalOptions { get; set; }
27+
28+
public string VerticalOptions { get; set; }
29+
2630
[Newtonsoft.Json.JsonProperty(DefaultValueHandling = Newtonsoft.Json.DefaultValueHandling.Ignore, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, PropertyName = "children", Required = Newtonsoft.Json.Required.AllowNull)]
2731
[System.Runtime.Serialization.DataMember(EmitDefaultValue = false, IsRequired = false, Name = "children")]
2832
public List<RenderRepresentation> Children { get; set; }
2933

30-
public byte[] ViewPng { get; set; }
34+
public byte[] ViewPng { get; set; }
3135

3236
public override string ToString()
3337
{

XamarinForms.VisualDebug.App/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

XamarinForms.VisualDebug.App/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "xamarin-forms.visual-debug.app",
3-
"version": "0.0.0",
3+
"version": "0.0.3",
44
"description": "XamarinForms.VisualDebug.App",
55
"main": "app.js",
66
"author": {

XamarinForms.VisualDebug.App/renderer/chart.js

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ var orgChart = (function () {
1919
/* Configuration */
2020
_duration = 750, /* Duration of the animations */
2121
_rectW = 180, /* Width of the rectangle */
22-
_rectH = 150, /* Height of the rectangle */
22+
_rectH = 180, /* Height of the rectangle */
2323
_rectSpacing = 120, /* Spacing between the rectangles */
2424
_fixedDepth = 200, /* Height of the line for child nodes */
2525
_mode = "line", /* Choose the values "line" or "diagonal" */
@@ -214,6 +214,36 @@ var orgChart = (function () {
214214
return "Padding:" + d.Padding.Left + "," + d.Padding.Top + "," + d.Padding.Right + "," + d.Padding.Bottom;
215215
});
216216

217+
currentYOffset += _labelSize + _labelMargin;
218+
nodeEnter.append("text")
219+
.attr("x", 5)
220+
.attr("y", currentYOffset)
221+
.attr("dy", _labelSize + "px")
222+
.attr("text-anchor", "left")
223+
.style("cursor", function (d) { return (d.children || d._children || d.hasChild) ? "pointer" : "default"; })
224+
.text(function (d) {
225+
if (d.HorizontalOptions === null || d.HorizontalOptions === undefined) {
226+
return "HorizontalOptions: N/A";
227+
}
228+
229+
return "HorizontalOptions:" + d.HorizontalOptions;
230+
});
231+
232+
currentYOffset += _labelSize + _labelMargin;
233+
nodeEnter.append("text")
234+
.attr("x", 5)
235+
.attr("y", currentYOffset)
236+
.attr("dy", _labelSize + "px")
237+
.attr("text-anchor", "left")
238+
.style("cursor", function (d) { return (d.children || d._children || d.hasChild) ? "pointer" : "default"; })
239+
.text(function (d) {
240+
if (d.VerticalOptions === null || d.VerticalOptions === undefined) {
241+
return "VerticalOptions: N/A";
242+
}
243+
244+
return "VerticalOptions:" + d.VerticalOptions;
245+
});
246+
217247
nodeEnter.append("image")
218248
.attr("x", _rectW)
219249
.attr("y", 0)

XamarinForms.VisualDebug.Core/TreeRenderer.cs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,20 @@ private static RenderRepresentation ToRenderRepresentation(VisualElement element
9696
}
9797
};
9898

99-
if (element is View repv)
99+
100+
101+
if (element is View view)
100102
{
103+
rep.HorizontalOptions = LayoutOptionsToString(view.HorizontalOptions);
104+
105+
rep.VerticalOptions = LayoutOptionsToString(view.VerticalOptions);
106+
101107
rep.Margin = new RenderThickness
102108
{
103-
Left = repv.Margin.Left,
104-
Top = repv.Margin.Top,
105-
Right = repv.Margin.Right,
106-
Bottom = repv.Margin.Bottom
109+
Left = view.Margin.Left,
110+
Top = view.Margin.Top,
111+
Right = view.Margin.Right,
112+
Bottom = view.Margin.Bottom
107113
};
108114
}
109115

@@ -123,6 +129,10 @@ private static RenderRepresentation ToRenderRepresentation(VisualElement element
123129
return rep;
124130
}
125131

126-
132+
private static string LayoutOptionsToString(LayoutOptions options)
133+
{
134+
return options.Alignment + (options.Expands ? "AndExpand" : "");
135+
}
136+
127137
}
128138
}

XamarinForms.VisualDebug.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<metadata>
44
<id>XamarinForms.VisualDebug</id>
55
<title>XamarinForms.VisualDebug</title>
6-
<version>0.0.2</version>
6+
<version>0.0.3</version>
77
<authors>David Thompson</authors>
88
<owners>David Thompson</owners>
99
<projectUrl>https://github.com/Pepsi1x1/XamarinForms.VisualDebug</projectUrl>

XamarinForms.VisualDebug/XamarinForms.VisualDebug/XamarinForms.VisualDebug.Sample.csproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@
3434
<Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" />
3535
</ItemGroup>
3636

37+
<ItemGroup>
38+
<Compile Update="IPConstant.cs">
39+
<DesignTime>True</DesignTime>
40+
<AutoGen>True</AutoGen>
41+
<DependentUpon>IPConstant.tt</DependentUpon>
42+
</Compile>
43+
</ItemGroup>
44+
3745
<ItemGroup>
3846
<EmbeddedResource Update="RenderSamples.xaml">
3947
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>

0 commit comments

Comments
 (0)