Node dragged out of the jgoview frame


#1

Hi, I have a problem with the jgoview. there are bunch of nodes conncected with links in the jgoview. The funny thing is that when I drag a node, to the edge of the jgoview frame. it seems that the node can go into the edge of the frame, half of the node is hidden out side of the frame edge. How can I fix this behavior?
myJgoview extends jgoview, which method should I overwrite, or which feature should I just set true or false?
Thanks a lot.
LI


#2

Are you saying that you never want any nodes to be clipped in half by the view? That is, it’s OK for a node to be completely inside or completely outside the view, but not part way?
If that’s what you are looking for, then there are several ways of achieving that. It depends on what you want. What do you want to have happen when the user scrolls the view?


#3

Of course, the user can scroll the view freely, when scrolling, Some node are out the the view frame.
My problem is the , when user drag the nodes, the node can go into the edge of the frame. like the following. half of the node get into the edge of the fame, can not been seen by the user, when it is dragged against the edge.
Thanx.
----------------------|
half node) & nbsp; |
|


#4

Are you talking about being able to drag nodes towards the left and towards the top, and not being able to scroll there?
If so, you just need to call JGoView.setIncludingNegativeCoords(true).


#5

Sorry I did not explain my problem clearly, let me try again. There are scroll bars in my jgoview, but I’d like for users not to be able to drag nodes outside the viewable area of the view. Ofcourse when nodes are dragged past the viewable area they can be seen using the horizontal and vertical scroll bars, but I’d like to prevent users from doing this. In some windows applications when an object is dragged and held against the edge of a viewable area for given period of time the area automatically begins to scroll. Is such a thing possible in JGO? And if not is there any way to simply limit dragging to the viewable region of the view, meaning nodes can’t be dragged outside the viewable region.


#6

JGoView does support autoscrolling; it’s controlled by the AutoscrollInsets property. Perhaps you could make the insets wider.
Alternatively (or perhaps additionally) you could override JGoView.moveSelection. I’d probably first call the super method and then check the positions of all of the objects in the selection to see if anything is in an undesirable position. If so, I’d fix it up somehow–butting up all the objects against the side of the view is certainly one possibility that you seem to find acceptable, but other policies are also possible.