so as you mentioned I'updated code,
then Left Arrow Key and Up Arrow Key started to working properly (which is i can close up to 5 pixels, then those are not overlap)
// left arrow handler
diagram.CommandBindings.Add(
new CommandBinding(Diagram.NavigateLeft, (sender, args) =>
{
foreach (var node in diagram.Selection.Nodes)
{
var rect = node.Bounds;
rect.X = rect.Left - 10;
if (node != null && node.Bounds.Left - 10 >= diagram.Bounds.Left && (FindOverlaps(node, rect, 2).Count == 0))
{
node.Move(node.Bounds.Left - 10, node.Bounds.Top);
}
}
}));
// up arrow handler
diagram.CommandBindings.Add(
new CommandBinding(Diagram.NavigateUp, (sender, args) =>
{
foreach (var node in diagram.Selection.Nodes)
{
var rect = node.Bounds;
rect.Y = rect.Top - 10;
if (node != null && node.Bounds.Top - 10 >= diagram.Bounds.Top && (FindOverlaps(node, rect, 2).Count == 0))
{
node.Move(node.Bounds.Left, node.Bounds.Top - 10);
}
}
}));
Left Arrow Key Operation with proper distance Up Arrow Key Operation with proper distance but Right arrow key and Bottom Arrow key not working like Left Arrow Key and Up Arrow Key , which is can't close up to 5 pixels they are locating with different spaces
// right arrow handler
diagram.CommandBindings.Add(
new CommandBinding(Diagram.NavigateRight, (sender, args) =>
{
foreach (var node in diagram.Selection.Nodes)
{
var rect = node.Bounds;
rect.X = rect.Right + 10;
if (node != null && node.Bounds.Right + 10 <= diagram.Bounds.Right && (FindOverlaps(node, rect, 2).Count == 0))
{
node.Move(node.Bounds.Left + 10, node.Bounds.Top);
}
}
}));
// down arrow handler
diagram.CommandBindings.Add(
new CommandBinding(Diagram.NavigateDown, (sender, args) =>
{
foreach (var node in diagram.Selection.Nodes)
{
var rect = node.Bounds;
rect.Y = rect.Bottom + 10;
if (node != null && node.Bounds.Bottom + 10 <= diagram.Bounds.Bottom && (FindOverlaps(node, rect, 2).Count == 0))
{
node.Move(node.Bounds.Left, node.Bounds.Top + 10);
}
}
}));
Bottom Arrow Key Operation with wide distance Right Arrow Key Operation with wide distance How can I reduce more spaces in right and down arrow handlers like up and left handlers