diff --git a/.gitignore b/.gitignore index 0dc1012..4099022 100644 --- a/.gitignore +++ b/.gitignore @@ -349,3 +349,4 @@ MigrationBackup/ # Ionide (cross platform F# VS Code tools) working folder .ionide/ /XamarinForms.VisualDebug.App/dist +/XamarinForms.VisualDebug/XamarinForms.VisualDebug/IPConstant.cs diff --git a/VisualDebug.Models/RenderRepresentation.cs b/VisualDebug.Models/RenderRepresentation.cs index cad429b..0bf908e 100644 --- a/VisualDebug.Models/RenderRepresentation.cs +++ b/VisualDebug.Models/RenderRepresentation.cs @@ -23,11 +23,15 @@ public class RenderRepresentation public RenderThickness Padding { get; set; } + public string HorizontalOptions { get; set; } + + public string VerticalOptions { get; set; } + [Newtonsoft.Json.JsonProperty(DefaultValueHandling = Newtonsoft.Json.DefaultValueHandling.Ignore, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, PropertyName = "children", Required = Newtonsoft.Json.Required.AllowNull)] [System.Runtime.Serialization.DataMember(EmitDefaultValue = false, IsRequired = false, Name = "children")] public List Children { get; set; } - public byte[] ViewPng { get; set; } + public byte[] ViewPng { get; set; } public override string ToString() { diff --git a/XamarinForms.VisualDebug.App/package-lock.json b/XamarinForms.VisualDebug.App/package-lock.json index bb55953..90a0227 100644 --- a/XamarinForms.VisualDebug.App/package-lock.json +++ b/XamarinForms.VisualDebug.App/package-lock.json @@ -1,6 +1,6 @@ { "name": "xamarin-forms.visual-debug.app", - "version": "0.0.0", + "version": "0.0.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/XamarinForms.VisualDebug.App/package.json b/XamarinForms.VisualDebug.App/package.json index 5f98733..a1cf8ac 100644 --- a/XamarinForms.VisualDebug.App/package.json +++ b/XamarinForms.VisualDebug.App/package.json @@ -1,6 +1,6 @@ { "name": "xamarin-forms.visual-debug.app", - "version": "0.0.0", + "version": "0.0.3", "description": "XamarinForms.VisualDebug.App", "main": "app.js", "author": { diff --git a/XamarinForms.VisualDebug.App/renderer/chart.js b/XamarinForms.VisualDebug.App/renderer/chart.js index 0fc432a..cbebd85 100644 --- a/XamarinForms.VisualDebug.App/renderer/chart.js +++ b/XamarinForms.VisualDebug.App/renderer/chart.js @@ -19,7 +19,7 @@ var orgChart = (function () { /* Configuration */ _duration = 750, /* Duration of the animations */ _rectW = 180, /* Width of the rectangle */ - _rectH = 150, /* Height of the rectangle */ + _rectH = 180, /* Height of the rectangle */ _rectSpacing = 120, /* Spacing between the rectangles */ _fixedDepth = 200, /* Height of the line for child nodes */ _mode = "line", /* Choose the values "line" or "diagonal" */ @@ -214,6 +214,36 @@ var orgChart = (function () { return "Padding:" + d.Padding.Left + "," + d.Padding.Top + "," + d.Padding.Right + "," + d.Padding.Bottom; }); + currentYOffset += _labelSize + _labelMargin; + nodeEnter.append("text") + .attr("x", 5) + .attr("y", currentYOffset) + .attr("dy", _labelSize + "px") + .attr("text-anchor", "left") + .style("cursor", function (d) { return (d.children || d._children || d.hasChild) ? "pointer" : "default"; }) + .text(function (d) { + if (d.HorizontalOptions === null || d.HorizontalOptions === undefined) { + return "HorizontalOptions: N/A"; + } + + return "HorizontalOptions:" + d.HorizontalOptions; + }); + + currentYOffset += _labelSize + _labelMargin; + nodeEnter.append("text") + .attr("x", 5) + .attr("y", currentYOffset) + .attr("dy", _labelSize + "px") + .attr("text-anchor", "left") + .style("cursor", function (d) { return (d.children || d._children || d.hasChild) ? "pointer" : "default"; }) + .text(function (d) { + if (d.VerticalOptions === null || d.VerticalOptions === undefined) { + return "VerticalOptions: N/A"; + } + + return "VerticalOptions:" + d.VerticalOptions; + }); + nodeEnter.append("image") .attr("x", _rectW) .attr("y", 0) diff --git a/XamarinForms.VisualDebug.Core/TreeRenderer.cs b/XamarinForms.VisualDebug.Core/TreeRenderer.cs index 50019d6..2dabd69 100644 --- a/XamarinForms.VisualDebug.Core/TreeRenderer.cs +++ b/XamarinForms.VisualDebug.Core/TreeRenderer.cs @@ -96,14 +96,20 @@ private static RenderRepresentation ToRenderRepresentation(VisualElement element } }; - if (element is View repv) + + + if (element is View view) { + rep.HorizontalOptions = LayoutOptionsToString(view.HorizontalOptions); + + rep.VerticalOptions = LayoutOptionsToString(view.VerticalOptions); + rep.Margin = new RenderThickness { - Left = repv.Margin.Left, - Top = repv.Margin.Top, - Right = repv.Margin.Right, - Bottom = repv.Margin.Bottom + Left = view.Margin.Left, + Top = view.Margin.Top, + Right = view.Margin.Right, + Bottom = view.Margin.Bottom }; } @@ -123,6 +129,10 @@ private static RenderRepresentation ToRenderRepresentation(VisualElement element return rep; } - + private static string LayoutOptionsToString(LayoutOptions options) + { + return options.Alignment + (options.Expands ? "AndExpand" : ""); + } + } } diff --git a/XamarinForms.VisualDebug.nuspec b/XamarinForms.VisualDebug.nuspec index 7532b78..950990c 100644 --- a/XamarinForms.VisualDebug.nuspec +++ b/XamarinForms.VisualDebug.nuspec @@ -3,7 +3,7 @@ XamarinForms.VisualDebug XamarinForms.VisualDebug - 0.0.2 + 0.0.3 David Thompson David Thompson https://github.com/Pepsi1x1/XamarinForms.VisualDebug diff --git a/XamarinForms.VisualDebug/XamarinForms.VisualDebug/XamarinForms.VisualDebug.Sample.csproj b/XamarinForms.VisualDebug/XamarinForms.VisualDebug/XamarinForms.VisualDebug.Sample.csproj index fd420c0..3e1a9ee 100644 --- a/XamarinForms.VisualDebug/XamarinForms.VisualDebug/XamarinForms.VisualDebug.Sample.csproj +++ b/XamarinForms.VisualDebug/XamarinForms.VisualDebug/XamarinForms.VisualDebug.Sample.csproj @@ -34,6 +34,14 @@ + + + True + True + IPConstant.tt + + + MSBuild:UpdateDesignTimeXaml