ScrollRectangleToVisible


#1

I’d like to know the following:
is there’s a possibility to re-scroll dragged nodes into the visible rectangle if ShowNegativeValues in GoView is set to false.
If I drag thos nodes to the upper, to the lower, or to the right I got no problems. Just if I try to drag them to the left.
Has anyone already figured out a solution for doing this?
Otherwise you have to calculate the bounding rectangle and
make an Own ScrollRectangleToVisible or possibly I just should
override it.


#2

I’m not sure what you are saying. Are you just trying to scroll the view so that some object becomes visible, even though it is at negative coordinate(s)? Also, I don’t understand why you don’t have a problem dragging up (to negative Y values), but you do have a problem dragging left to negative X values.
Could you temporarily set GoView.ShowsNegativeCoordinates to true when you call ScrollRectangleToVisible? Or does that not give you the kind of behavior you want?


#3

I’ve already tried to set it temporarily to true.
But the beahvior is not correct then, because I’ve got a fixed label on the background.


#4

Could you describe more precisely the situation you are talking about? I don’t understand what behavior you want and what behavior you are getting.


#5

I just wanted to prevent the user from moving some nodes out of the
window while ShowsNegativeCoordinates is set to false.

But I figured out how to do this now.


#6

Oh, OK. The easiest thing to do is to override GoObject.ComputeMove. The LimitedNode example class in the Demo1 sample does this.


#7

That would be only be half it.
I’ve had to figure out a way which prevents the user from moving stuff out of the window.

This is done by just moving the actual selection back to it’s former place. (and it has also to be valid it the user only selects the root node of a tree.)

So I have to recursively calculate the bounding rectangle of the
tree and moving the selection in the rectangle back about -X of the rectangle’s x-coordinate.

example:

user moves bounding rect of tree to -50 (X)
program moves it back to 50 (-X)