Avoid mouse position value wrapping

I am trying to get the mouse position to make the camera scroll on the edges. The value is 0 on when the mouse is in the left, and goes up until it reaches the right (1270). But when i go too far to the right, out of the viewport, the value goes back to 0 which makes the camera scroll to the left.
I can’t find a way to fix it and make sure the value doesn’t change when it is out of the view.

In this example, i simply print the values, i use the “Get Mouse Position” node.

You could place a branch up there, check if mouse position is greater than viewport size X and do not scroll if that is True.

Cool. Or maybe the opposite, check and see if the mouse is between value 0 and 1270 and if true continues and if False, it checks repeatedly (ideally without Ticks?) until it is True again…