Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Overview rectangle width changes (Read 5278 times)
ymoran00
Full Member
***
Offline



Posts: 163
Joined: May 2nd, 2007
Overview rectangle width changes
Jun 17th, 2007 at 6:22am
Print Post  
I've created an Overview with these settings:

setTrackingRectPen(new Pen(4, Color.RED));

I expect the rectangle to have the same size all the time, but it seems to resize itself with the diagram. When the diagram is small, the rectangle is thick. When the diagram is large, the triangle is thin.

This doesn't happen when I zoom in or zoom out. Only when I load different diagrams.

Thanks,
Yoav
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Overview rectangle width changes
Reply #1 - Jun 19th, 2007 at 10:44am
Print Post  
Is this in FitAll mode? In such case the scaling transformation applied to the overview depends on the diagram size, and the rectangle is drawn while that transformation is active. I guess we can move the rectangle-drawing code after the scaling is removed to fix this.

Stoyan
  
Back to top
 
IP Logged
 
ymoran00
Full Member
***
Offline



Posts: 163
Joined: May 2nd, 2007
Re: Overview rectangle width changes
Reply #2 - Jun 19th, 2007 at 11:04am
Print Post  
It doesn't happen in Fit All - but I do change zoom factor in diagram.
I think the rectangle should always have a fixed size - this is how other applications seems to behave (since the rectangle is not part of the graph but part of the Overview widget).
Thanks,
Yoav
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Overview rectangle width changes
Reply #3 - Jun 19th, 2007 at 11:55am
Print Post  
This version keeps the rectangle line width independent of the scaling transformations, and also makes the rectangle follow the mouse without any deviation -

http://mindfusion.org/_temp/JDiagram.jar

I will send you Overview.java with a private message.

Stoyan
  
Back to top
 
IP Logged
 
ymoran00
Full Member
***
Offline



Posts: 163
Joined: May 2nd, 2007
Re: Overview rectangle width changes
Reply #4 - Jun 19th, 2007 at 12:53pm
Print Post  
Thanks - it seems to be solving many issues.
The rectangle is now smoother.
An odd thing happens - it seems that the rectangle sometimes exits the Overview - suddenly the edge vanishes. It seems that this happens only to the left edge.
Do you know what may be the reason?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Overview rectangle width changes
Reply #5 - Jun 19th, 2007 at 1:13pm
Print Post  
That probably happens because lines drawn with a wider pen are centered around the exact line coordinates, so some part of a line might lie outside the view when drawing at x=0. Pens in .NET have a property that allows drawing inner/centered/outer lines around closed shapes, but we couldn't find a similar property for Java Stroke objects.

Stoyan
  
Back to top
 
IP Logged
 
ymoran00
Full Member
***
Offline



Posts: 163
Joined: May 2nd, 2007
Re: Overview rectangle width changes
Reply #6 - Jun 19th, 2007 at 1:13pm
Print Post  
I''l add to the previous question:
May this be a parameter that I provide? Can a user be causing the rectangle to exceed the overview (by changing bounds or stuff like that)?
Thanks,
Yoav
  
Back to top
 
IP Logged
 
ymoran00
Full Member
***
Offline



Posts: 163
Joined: May 2nd, 2007
Re: Overview rectangle width changes
Reply #7 - Jun 19th, 2007 at 1:15pm
Print Post  
I just saw you replied me.
The thing is that I'm using a width=1 pen.
Can it still be the problem, although it's the smallest thicjness possible?
Thanks,
Yoav
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Overview rectangle width changes
Reply #8 - Jun 19th, 2007 at 1:27pm
Print Post  
It could still be a problem, since 1 point is larger than a pixel. You might try setting the width to 0 - in that case JDiagram should always make the line exactly 1 pixel wide, though I am not sure if it won't be lost again because of some rounding errors. If that doesn't help, we could draw a rectangle that's a pen.Width / 2 smaller that the original, to make sure the lines are drawn entirely inside the tracking rectangle independently of their size.

Stoyan
  
Back to top
 
IP Logged
 
ymoran00
Full Member
***
Offline



Posts: 163
Joined: May 2nd, 2007
Re: Overview rectangle width changes
Reply #9 - Jun 19th, 2007 at 1:39pm
Print Post  
I've set the pen to 0 - it still happens sometimes.
I'm trying to find the scenario bu I can't.
I clear the flowchart, repaint it and rerun Anneal layout on it. After doing it a few times - suddenly the rectangle is out of bounds. Dunno why.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint