Skip to content

Commit

Permalink
Fix mouse cursor getting stuck in dragging mode when UI is hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Lewin committed Aug 5, 2024
1 parent 264649b commit 5a2f438
Showing 1 changed file with 23 additions and 17 deletions.
40 changes: 23 additions & 17 deletions src/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,22 +335,7 @@ export function update(inputs, uiIsHidden)
}


// Set mouse cursor
if(g_mouseOverObject)
{
if(g_mouseOverZone === 'translation')
{
g_vectorCanvas.style.cursor = g_dragging? 'grabbing' : 'grab';
}
else if(g_mouseOverZone === 'rotation')
{
g_vectorCanvas.style.cursor = 'url("./data/rotate.svg") 16 16, pointer';
}
}
else
{
g_vectorCanvas.style.cursor = 'auto';
}




Expand Down Expand Up @@ -417,8 +402,29 @@ export function update(inputs, uiIsHidden)
}
}
}
else
{
g_mouseOverObject = undefined;
g_grabbedObject = undefined;
g_dragging = false;
}


// Set mouse cursor
if(g_mouseOverObject)
{
if(g_mouseOverZone === 'translation')
{
g_vectorCanvas.style.cursor = g_dragging? 'grabbing' : 'grab';
}
else if(g_mouseOverZone === 'rotation')
{
g_vectorCanvas.style.cursor = 'url("./data/rotate.svg") 16 16, pointer';
}
}
else
{
g_vectorCanvas.style.cursor = 'auto';
}

if(inputs.isMouseDown)
{
Expand Down

0 comments on commit 5a2f438

Please sign in to comment.