diff --git a/MatterControlLib/CustomWidgets/TreeView/TreeNode.cs b/MatterControlLib/CustomWidgets/TreeView/TreeNode.cs
index fa25e390e..3ddccecd5 100644
--- a/MatterControlLib/CustomWidgets/TreeView/TreeNode.cs
+++ b/MatterControlLib/CustomWidgets/TreeView/TreeNode.cs
@@ -506,8 +506,8 @@ namespace MatterHackers.MatterControl.CustomWidgets
public TreeExpandWidget(ThemeConfig theme)
{
- arrowRight = AggContext.StaticData.LoadIcon("fa-angle-right_12.png", theme.InvertIcons);
- arrowDown = AggContext.StaticData.LoadIcon("fa-angle-down_12.png", theme.InvertIcons);
+ arrowRight = AggContext.StaticData.LoadIcon("fa-angle-right_12.png", 12, 12, theme.InvertIcons);
+ arrowDown = AggContext.StaticData.LoadIcon("fa-angle-down_12.png", 12, 12, theme.InvertIcons);
placeholder = new ImageBuffer(16, 16);
this.Margin = new BorderDouble(right: 4);
diff --git a/MatterControlLib/PartPreviewWindow/PlatingHelper.cs b/MatterControlLib/PartPreviewWindow/PlatingHelper.cs
index 19c573c59..201c8d624 100644
--- a/MatterControlLib/PartPreviewWindow/PlatingHelper.cs
+++ b/MatterControlLib/PartPreviewWindow/PlatingHelper.cs
@@ -169,6 +169,11 @@ namespace MatterHackers.MatterControl
/// The objects to hit test against
public static void MoveToOpenPosition(IObject3D itemToMove, IEnumerable itemsToAvoid)
{
+ if (itemToMove == null)
+ {
+ return;
+ }
+
// find a place to put it that doesn't hit anything
var currentBounds = itemToMove.GetAxisAlignedBoundingBox();
var itemToMoveBounds = new AxisAlignedBoundingBox(currentBounds.MinXYZ, currentBounds.MaxXYZ);
@@ -178,32 +183,16 @@ namespace MatterHackers.MatterControl
itemToMoveBounds.MaxXYZ += new Vector3(2, 2, 0);
var transform = Matrix4X4.Identity;
- int currentSize = 1;
bool partPlaced = false;
- while (!partPlaced && itemToMove != null)
+ while (!partPlaced)
{
- int xStep = 0;
- int yStep;
- // check far right edge
- for (yStep = 0; yStep < currentSize; yStep++)
+ int distance = 0;
+ while (!partPlaced)
{
- partPlaced = CheckPosition(itemsToAvoid, itemToMove, itemToMoveBounds, yStep, xStep, ref transform);
-
- if (partPlaced)
+ for (int i = 0; i <= distance; i++)
{
- break;
- }
- }
-
- if (!partPlaced)
- {
- yStep = currentSize;
- // check top edge
- for (xStep = 0; xStep < currentSize; xStep++)
- {
- partPlaced = CheckPosition(itemsToAvoid, itemToMove, itemToMoveBounds, yStep, xStep, ref transform);
-
+ partPlaced = CheckPosition(itemsToAvoid, itemToMove, itemToMoveBounds, i, distance, ref transform);
if (partPlaced)
{
break;
@@ -212,13 +201,18 @@ namespace MatterHackers.MatterControl
if (!partPlaced)
{
- xStep = currentSize;
- // check top right point
- partPlaced = CheckPosition(itemsToAvoid, itemToMove, itemToMoveBounds, yStep, xStep, ref transform);
+ for (int i = 0; i <= distance; i++)
+ {
+ partPlaced = CheckPosition(itemsToAvoid, itemToMove, itemToMoveBounds, distance, i, ref transform);
+ if (partPlaced)
+ {
+ break;
+ }
+ }
}
- }
- currentSize++;
+ distance++;
+ }
}
itemToMove.Matrix *= transform;
diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp
index 2cb100544..a92de4a65 160000
--- a/Submodules/agg-sharp
+++ b/Submodules/agg-sharp
@@ -1 +1 @@
-Subproject commit 2cb100544bc6d6ae35086cc2a3592272d7323f12
+Subproject commit a92de4a6564997977e9a61c4780ce221898c9615