Skip to content

Commit

Permalink
Don't allow selection of media widgets if not on the active layer (ic…
Browse files Browse the repository at this point in the history
…osa-foundation#606)

Don't allow selection of media widgets if they aren't on the active layer
  • Loading branch information
andybak authored Dec 20, 2023
1 parent f093fb2 commit 291763f
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Assets/Scripts/SketchControlsScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2353,10 +2353,16 @@ GrabWidgetData GetBestWidget(List<GrabWidgetData> candidates,
GrabWidgetData best = null;
for (int i = 0; i < candidates.Count; ++i)
{
if (candidates[i].m_NearController &&
(best == null || candidates[i].m_ControllerScore > best.m_ControllerScore))
var candidate = candidates[i];
if (!candidate.m_NearController) continue;

// For media widgets - only select from the active layer
if (candidate.m_WidgetScript is MediaWidget
&& candidate.m_WidgetScript.Canvas != App.Scene.ActiveCanvas) continue;

if (best == null || candidate.m_ControllerScore > best.m_ControllerScore)
{
best = candidates[i];
best = candidate;
}
}
return best;
Expand Down

0 comments on commit 291763f

Please sign in to comment.