Background dragging problem

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 ;
        }
    }

The code looks correct, so I’m not entirely sure what’s going on there… I can’t see any reason that the scrollPosition would change directions if the drag is in the same direction, even briefly.

ye its really strange

If you’d like, I can take a look and see if I can duplicate it/determine the cause. If so, zip up your project and upload it to https://gdev.tv/projectupload and I’ll take a look. This could be a hardware issue, so I can’t make any guarantees until I take a look at the project.

Privacy & Terms