Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) Overview problem on successive zoomouts (Read 9546 times)
nsandhu
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 16
Joined: Aug 22nd, 2011
Overview problem on successive zoomouts
Aug 22nd, 2011 at 7:23pm
Print Post  
I am seeing a problem where on successive clicks of a zoomout the overview resets the box to the bottom of the overview diagram losing the area on which it was focused

My zoomout code is quite simply

....
_zoomFactor /= 2;




diagramView.setZoomFactor(_zoomFactor);
....

where _zoomFactor is a class level variable
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Overview problem on successive zoomouts
Reply #1 - Aug 22nd, 2011 at 8:54pm
Print Post  
If you mean the bottom-right of the view disappears, it happens because setZoomFactor zooms at the top-left point (the current scroll position). If you'd like to zoom at the center or the bottom-right, you could use the zoomToRect method instead, where you calculate an appropriate rectangle from the currently visible part of the diagram. You can find the visible rectangle in diagram coordinate by calling view.deviceToDoc(view.getVisibleRect()).

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
nsandhu
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 16
Joined: Aug 22nd, 2011
Re: Overview problem on successive zoomouts
Reply #2 - Aug 22nd, 2011 at 9:20pm
Print Post  
Not just the bottom right, the overview's rectangle for diagram view shifts to a completely different location. Most of the time, this is the bottom of the overview but sometimes it shifts towards the top of the overview as well

In other words, the zoomout is working as expected but occasionally and consistently it jumps around.
  
Back to top
 
IP Logged
 
nsandhu
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 16
Joined: Aug 22nd, 2011
Re: Overview problem on successive zoomouts
Reply #3 - Aug 22nd, 2011 at 9:36pm
Print Post  
I tried the zoomToFit and it works better, however there is a brief flash of a rectangle on the Overview panel that is of a different size before the rectangle is reset to the size requested.

I still have a problem of losing the x,y location of the rectangle, i think when the width or height exceed the extent of the diagram. If you have a workaround for that, it would be helpful. Thanks
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Overview problem on successive zoomouts
Reply #4 - Aug 23rd, 2011 at 7:48am
Print Post  
The rectangle position always corresponds to the current scroll position of the DiagramView from what I can see. Do you mean you get the tracking rectangle showing a different part of the diagram than what's currently shown in the view?

Regarding the flashing rectangle, it might happen because zoomToRect changes both scroll position and zoom level, so the rectangle is updated twice. Try enclosing zoomToRect between Overview.suspendRepaint and resumeRepaint calls to repaint the overview only once.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
nsandhu
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 16
Joined: Aug 22nd, 2011
Re: Overview problem on successive zoomouts
Reply #5 - Aug 25th, 2011 at 9:15pm
Print Post  
Zoom works now however the flashing rectangle problem on the overview is still there despite using suspendRepaint and resumeRepaint

Code
Select All
overview.suspendRepaint();




Rectangle2D.Float rect = diagramView.deviceToDoc(diagramView.getVisibleRect());




rect.setRect(rect.x-rect.width/2, rect.y-rect.height/2, rect.width*2, rect.height*2);




diagramView.zoomToFit(rect);




overview.resumeRepaint(); 

  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Overview problem on successive zoomouts
Reply #6 - Aug 26th, 2011 at 7:18am
Print Post  
Could you email to support@mindfusion.eu a test project that shows the flashing rectangle?
  
Back to top
 
IP Logged
 
nsandhu
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 16
Joined: Aug 22nd, 2011
Re: Overview problem on successive zoomouts
Reply #7 - Aug 26th, 2011 at 9:00pm
Print Post  
I sent in a sample problem. Please let me know how I can be notified when its fixed. Thanks
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Overview problem on successive zoomouts
Reply #8 - Aug 27th, 2011 at 7:33am
Print Post  
Sorry, we haven't received anything. Could you email it again to support@mindfusion.eu and add cc to me (from the mailto: icon on the left).
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Overview problem on successive zoomouts
Reply #9 - Aug 29th, 2011 at 7:56pm
Print Post  
Thanks for the sample project; we can see the problem now. Our developer investigated, and found that when the overview and DiagramView are in the same frame, Swing calls events in this order:

repaint overview -> zoomed DiagramView size set -> repaint overview

It seems the events are raised asynchronously after zoomToFit completes, so calling suspendRepaint does not help. Since the tracking rectangle shows the ratio between the full size of the zoomed DiagramView and its visible area, the paint events from before and after the size change show different rectangles and you get the flickering effect.

If the overview is in a different frame as in our test app, its paintComponent method does not get called before the view is actually resized so I only saw the end result without flickering.

We'll try to modify our code to use the Diagram size and zoom level instead of the DiagramView's current size to avoid that problem.

Stoyan
  
Back to top
 
IP Logged
 
nsandhu
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 16
Joined: Aug 22nd, 2011
Re: Overview problem on successive zoomouts
Reply #10 - Aug 29th, 2011 at 11:20pm
Print Post  
That makes sense. Thanks for getting to this so quickly.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Overview problem on successive zoomouts
Reply #11 - Aug 30th, 2011 at 6:11pm
Print Post  
This version should avoid repainting the rectangle twice from zoomToFit:
https://mindfusion.eu/_temp/jdiag_ovw.zip

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
nsandhu
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 16
Joined: Aug 22nd, 2011
Re: Overview problem on successive zoomouts
Reply #12 - Sep 1st, 2011 at 4:12pm
Print Post  
Thanks, i have verified that it takes care of the main problem.

However there is still a problem with a jumping or slightly shifting rectangle.

Occasionally and not always, when a point on the overview is clicked, the rectangle jumps to that point and then shifts slightly and redraws, causing a draw , then slight shift and redraw.

The same test that I sent shows this problem.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint