From 7b18eaecf1351e680284a2e649c706d864663d99 Mon Sep 17 00:00:00 2001 From: Josh Tynjala Date: Wed, 24 Jul 2024 15:31:35 -0700 Subject: [PATCH] AnchorLayout: if no items are processed in the loop, consider it a circular reference (closes #184) An exception was already thrown, but now it is more specific --- src/feathers/layout/AnchorLayout.hx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/feathers/layout/AnchorLayout.hx b/src/feathers/layout/AnchorLayout.hx index 4ad08907..68717a86 100644 --- a/src/feathers/layout/AnchorLayout.hx +++ b/src/feathers/layout/AnchorLayout.hx @@ -188,7 +188,9 @@ class AnchorLayout extends EventDispatcher implements ILayout { doneItems.push(item); } if (oldDoneCount == doneItems.length) { - throw new IllegalOperationError("AnchorLayout failed."); + // if no additional items were processed, + // it's probably a circular reference + throw new IllegalOperationError("relativeTo circular reference detected"); } } var viewPortWidth = 0.0; @@ -368,7 +370,9 @@ class AnchorLayout extends EventDispatcher implements ILayout { doneItems.push(item); } if (!needsAnotherPass && oldDoneCount == doneItems.length) { - throw new IllegalOperationError("AnchorLayout failed."); + // if no additional items were processed, + // it's probably a circular reference + throw new IllegalOperationError("relativeTo circular reference detected"); } } if (needsAnotherPass) {