Skip to content

Commit

Permalink
fixed cursor alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
levimhuillet committed Sep 26, 2024
1 parent 77fa729 commit 42733a5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Assets/Project/Scripts/UI/AbstractDraggable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ protected virtual void SetDefaultCursor() {
protected virtual void SetGrabCursor() {
GameConsts consts = FindObjectOfType<GameConsts>();

Cursor.SetCursor(consts.GrabCursor, Vector2.zero, CursorMode.Auto);
Cursor.SetCursor(consts.GrabCursor, new Vector2(11, 2), CursorMode.Auto);
}

protected virtual void SetLiftPos(bool lifted) {
Expand Down
10 changes: 6 additions & 4 deletions Assets/Project/Scripts/UI/PlayerNotations/NotationSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ private void Update()
{
if (Input.GetMouseButtonDown(1)) {
// On right click, find the overlapping interactive object

m_CurrPointerData = new PointerEventData(EventSystem.current);
m_CurrPointerData.position = Input.mousePosition;


List<RaycastResult> results = new List<RaycastResult>();
//EventSystem.current.RaycastAll(m_CurrPointerData, results);
m_Raycaster.Raycast(m_CurrPointerData, results);

if (results.Count > 0) {
Expand All @@ -40,7 +42,7 @@ private void Update()
if (currObj.GetComponent<PlayerNotation>())
{
Debug.Log("[Notation] Opening existing notation " + results[0].gameObject.name);
OpenExistingNote();
ClickExistingNote(currObj.GetComponent<PlayerNotation>());
}
// else create new note
else
Expand All @@ -55,9 +57,9 @@ private void Update()

#region Helpers

private void OpenExistingNote()
private void ClickExistingNote(PlayerNotation notation)
{

notation.Click();
}

private void CreateNewNote(Transform currObj, Vector3 clickPos)
Expand Down
5 changes: 5 additions & 0 deletions Assets/Project/Scripts/UI/PlayerNotations/PlayerNotation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ public void Init()
m_DeleteButton.onClick.AddListener(OnDeleteClicked);
}

public void Click()
{
OnMainClicked();
}

#region Handlers

private void OnMainClicked()
Expand Down

0 comments on commit 42733a5

Please sign in to comment.