You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PointToScreen() doesn't take into account of the spacing/padding and it is always shifted whenever parent DynamicLayout has padding or spacing.
Code that Demonstrates the Problem
[Paste your code here]
```C#
var form = new Eto.Forms.Form();
var targetButton = new Button { Text = "target button" }
var layout = new DynamicLayout();
layout.BeginVertical(new Padding(12, 12, 0, 0));
layout.AddRow(new Button {Text="Testing" });
layout.AddRow(new Button {Text="Testing2" });
layout.EndBeginVertical(new Padding(34, 14, 16, 2), spacing: new Size(12, 6));
layout.AddRow(targetButton);
layout.AddRow(new Button { Text = "Testing" });
Rhino.RhinoApp.WriteLine($"{parentControl.PointFromScreen(targetButton.PointToScreen(new PointF(0, 0)))}");
// the point printed is wrong. it doesn't take into account of the spacing
/// <summary>
/// PointToScreen doesn't respect the spacing set in parent DynamicLayout. An eto bug.
/// </summary>
/// <param name="parentControl"></param>
/// <returns></returns>
private PointF FindTrueTopLeftPointInControl(Control parentControl)
{
var yOffset = 0f;
var xOffset = 0f;
if (Parent is DynamicLayout dl)
{
foreach (var rows in dl.Rows)
foreach (DynamicTable row in rows)
for (int i = 1; i < row.Rows.Count; i++)
if (row.Rows[i][0] is DynamicControl dc)
if (dc.Control is CustomButton cb)
if (cb == this)
{
yOffset = row.Spacing.Value.Height / 2f;
break;
}
if (parentControl is Popup popup && popup.HasShadow)
{
yOffset += Settings.Instance.General.ShadowPadding;
xOffset = Settings.Instance.General.ShadowPadding;
}
}
return parentControl.PointFromScreen(PointToScreen(new PointF(-xOffset, -yOffset)));
}
<!-- Please specify the version of Eto and all platforms this can be reproduced in -->
## Specifications
- Version:
- Platform(s): Rhino 7 in Windows 11
- Operating System(s): E.g. Windows 11
The text was updated successfully, but these errors were encountered:
Expected Behavior
PointToScreen should produce accurate result.
Actual Behavior
PointToScreen() doesn't take into account of the spacing/padding and it is always shifted whenever parent DynamicLayout has padding or spacing.
Code that Demonstrates the Problem
The text was updated successfully, but these errors were encountered: