Fixed bug where poi selection triggered by the reticule would not work when the detailspanel was between crosshair and poi
This commit is contained in:
@@ -28,7 +28,7 @@ namespace RothenburgAR.UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DoRaycast(Vector2 screenPoint)
|
public void DoRaycast(Vector2 screenPoint, bool denyBlockedHits = true)
|
||||||
{
|
{
|
||||||
RaycastHit hitInfo = new RaycastHit();
|
RaycastHit hitInfo = new RaycastHit();
|
||||||
Ray ray = Camera.main.ScreenPointToRay(screenPoint);
|
Ray ray = Camera.main.ScreenPointToRay(screenPoint);
|
||||||
@@ -39,11 +39,11 @@ namespace RothenburgAR.UI
|
|||||||
GameObject go = hitInfo.transform.gameObject;
|
GameObject go = hitInfo.transform.gameObject;
|
||||||
var bb = go.GetComponent<PoiRaycastReceiverBehaviour>();
|
var bb = go.GetComponent<PoiRaycastReceiverBehaviour>();
|
||||||
if (bb == null) return;
|
if (bb == null) return;
|
||||||
if (AbortBecauseDetailsPanelHit(screenPoint)) return;
|
if (denyBlockedHits && DenyBlockedHits(screenPoint)) return;
|
||||||
bb.OnClick.Invoke();
|
bb.OnClick.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool AbortBecauseDetailsPanelHit(Vector2 screenPoint)
|
private bool DenyBlockedHits(Vector2 screenPoint)
|
||||||
{
|
{
|
||||||
if (!UIManager.Instance.IsARViewVisible) return true;
|
if (!UIManager.Instance.IsARViewVisible) return true;
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ namespace RothenburgAR.UI
|
|||||||
public void ActivateCrosshairs()
|
public void ActivateCrosshairs()
|
||||||
{
|
{
|
||||||
Vector2 center = new Vector2(Camera.main.pixelWidth / 2, Camera.main.pixelHeight / 2);
|
Vector2 center = new Vector2(Camera.main.pixelWidth / 2, Camera.main.pixelHeight / 2);
|
||||||
DoRaycast(center);
|
DoRaycast(center, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Vector2> GatherScreenPoints()
|
private List<Vector2> GatherScreenPoints()
|
||||||
|
|||||||
Reference in New Issue
Block a user