public void resetInterval ( Localizable localizable ) { final int intervalHorizontalOld = intervalHorizontal ; final int intervalVerticalOld = intervalVertical ; final double oldX = getX ( ) ; final double oldY = getY ( ) ; setIntervals ( 0 , 0 ) ; offset . setLocation ( 0.0 , 0.0 ) ; setLocation ( localizable . getX ( ) , localizable . getY ( ) ) ; final double newX = getX ( ) ; final double newY = getY ( ) ; moveLocation ( 1.0 , oldX - newX , oldY - newY ) ; moveLocation ( 1.0 , newX - oldX , newY - oldY ) ; setIntervals ( intervalHorizontalOld , intervalVerticalOld ) ; offset . setLocation ( 0.0 , 0.0 ) ; }
Reset the camera interval to 0 by adapting its position . This will ensure camera centers its view to the localizable .