Restrict panning to the boundaries of my Network or Equipment component

Article ID: 2158
Last updated: 28 May, 2018
Article ID: 2158
Last updated: 28 May, 2018
Revision: 3
Views: 627
Posted: 11 Mar, 2010
by Dean J.
Updated: 28 May, 2018
by Gargani A.

Question

How to restrict panning to the boundaries of my Network or Equipment component?

Answer

JTGO uses IlvPanInteractor to pan the view. To prevent the mouse dragging from going outside the boundaries of the container, you can override the method IlvPanInteractor.processMouseMotionEvent. For example:

class MyPanInteractor extends ilog.views.interactor.IlvPanInteractor

{

protected void processMouseMotionEvent(java.awt.event.MouseEvent e) {

int dx = 0;

int dy = 0;

if (e.getX() >= 0)

dx = Math.min(0, getManagerView().getWidth() - e.getX());

else

dx = -e.getX();

if (e.getY() >= 0)

dy = Math.min(0, getManagerView().getHeight() - e.getY());

else

dy = -e.getY();

e.translatePoint(dx, dy);

super.processMouseMotionEvent(e);

}

}

For more information on how to customize the buttons on the toolbar, see the following resources in the "How to..." section of the User's Documentation:

How to Add a Custom Toolbar Button

How to Add a Predefined Toolbar Button

This article was:   Helpful | Not helpful
Report an issue
Article ID: 2158
Last updated: 28 May, 2018
Revision: 3
Views: 627
Posted: 11 Mar, 2010 by Dean J.
Updated: 28 May, 2018 by Gargani A.
Also read

Also listed in


Others in this category