hello i have a problem when i drag in the background the scroll work but its jittery
when i logged the value of the scroll position i noticed thats when i drag its value increase but in some frames betwwen it decreases and then increase again
private void ProcessNodeDragging()
{
if(Event.current.type == EventType.MouseDown && currentNode == null)
{
currentNode = GetCurrentNode();
if(currentNode != null)
positionOffset = currentNode.rect.position - Event.current.mousePosition;
else
{
isDraggingCanvas = true;
scrollOffset = Event.current.mousePosition + scrolPosition;
}
}
else if (Event.current.type == EventType.MouseDrag && currentNode != null)
{
Undo.RecordObject(SelecteDialogue,"Dragging node");
currentNode.rect.position = Event.current.mousePosition + positionOffset;
GUI.changed = true ;
}
else if (Event.current.type == EventType.MouseDrag && isDraggingCanvas == true)
{
scrolPosition = (scrollOffset - Event.current.mousePosition);
Debug.Log($" scroll is {scrolPosition}");
GUI.changed = true ;
}
else if (Event.current.type == EventType.MouseUp && isDraggingCanvas == true)
{
isDraggingCanvas = false ;
}
else if(Event.current.type == EventType.MouseUp && currentNode != null)
{
currentNode = null ;
}
}