Skip to content
This repository has been archived by the owner on Aug 11, 2024. It is now read-only.

Commit

Permalink
Fix/cursor modifier (#449)
Browse files Browse the repository at this point in the history
* check to see if the cursor modifier is active and enabled before passing back a valid value

* updated sdk checkout

* also made sure our focus lock checks if the synced target is still valid

* updated sdk checkout

* updated sdk checkout
  • Loading branch information
StephenHodgson authored Feb 7, 2020
1 parent f3d0f0c commit 626ec39
Showing 1 changed file with 68 additions and 2 deletions.
70 changes: 68 additions & 2 deletions Services/InputSystem/GenericPointer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,83 @@ public virtual IMixedRealityInputSource InputSourceParent
/// <inheritdoc />
public IMixedRealityCursor BaseCursor { get; set; }

private ICursorModifier cursorModifier = null;

/// <inheritdoc />
public ICursorModifier CursorModifier { get; set; }
public ICursorModifier CursorModifier
{
get
{
if (cursorModifier != null &&
cursorModifier.HostTransform != null &&
!cursorModifier.HostTransform.gameObject.activeInHierarchy)
{
cursorModifier = null;
}

return cursorModifier;
}
set => cursorModifier = value;
}

/// <inheritdoc />
public IMixedRealityTeleportHotSpot TeleportHotSpot { get; set; }

/// <inheritdoc />
public bool IsInteractionEnabled { get; set; }


private bool isFocusLocked = false;

/// <inheritdoc />
public bool IsFocusLocked { get; set; }
public bool IsFocusLocked
{
get
{
if (isFocusLocked &&
syncedTarget == null)
{
isFocusLocked = false;
}

if (syncedTarget != null)
{
if (syncedTarget.activeInHierarchy)
{
isFocusLocked = true;
}
else
{
isFocusLocked = false;
syncedTarget = null;
}
}

return isFocusLocked;
}
set
{
if (value && syncedTarget == null)
{
if (Result.CurrentPointerTarget != null)
{
syncedTarget = Result.CurrentPointerTarget;
}
else
{
Debug.LogWarning("No Sync Target to lock onto!");
return;
}
}

if (!value && syncedTarget != null)
{
syncedTarget = null;
}

isFocusLocked = value;
}
}

/// <inheritdoc />
public GameObject SyncedTarget
Expand Down

0 comments on commit 626ec39

Please sign in to comment.