Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Mouse to JDiagram co-ordinates (Read 2381 times)
tronied
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 17
Joined: May 7th, 2008
Mouse to JDiagram co-ordinates
Dec 19th, 2008 at 10:34am
Print Post  
I am using JDiagram v1, mainly because the majority of the coding was done before v2 was released. Anyway, I have come accross an issue which I can't seem to find the answer. Basically, I have a right click menu which allows the user to add a box to the diagram. I want the box to appear where the user had right-clicked, but it seems to be harder to do than I first thought. Because JDiagram has a zoom factor, the co-ordinates used for the createBox(float, float, float, float) do not match the Point mousePos returned by FlowChart.getMousePosition().

I have tried various things like dividing the mouse position by the zoom factor rounding up and multiplying by a certain number. It works, but then as soon as you change screen DPI (not resolution), the whole thing falls appart. Any idea on how I can convert the mouse position into the JDiagram co-ordinate system it uses?

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Mouse to JDiagram co-ordinates
Reply #1 - Dec 19th, 2008 at 11:16am
Print Post  
There's the public Point2D.Float deviceToDoc(Point devPoint) method. It should be available in v1 as well, from what I can see in the docs.

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


I love YaBB 1G - SP1!

Posts: 17
Joined: May 7th, 2008
Re: Mouse to JDiagram co-ordinates
Reply #2 - Dec 19th, 2008 at 12:01pm
Print Post  
That did the job, thanks.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint