Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Zoom on Diagram View. (Read 3246 times)
SandeepGowda
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 50
Joined: Jan 6th, 2009
Zoom on Diagram View.
Mar 18th, 2009 at 1:23pm
Print Post  
hi,
Do we have flexibility of Zoom on Ctrl+Right Mouse Button

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Zoom on Diagram View.
Reply #1 - Mar 18th, 2009 at 2:55pm
Print Post  
Hi,

What exactly do you need to do with zoom upon Ctrl+Right Mouse Button?

Stoyan
  
Back to top
 
IP Logged
 
SandeepGowda
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 50
Joined: Jan 6th, 2009
Re: Zoom on Diagram View.
Reply #2 - Mar 18th, 2009 at 3:00pm
Print Post  
Diagram view holding Shape Nodes linked eachother

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Zoom on Diagram View.
Reply #3 - Mar 18th, 2009 at 3:15pm
Print Post  
Ok, that's what the diagram view usually holds. But what do you need to happen with ZoomFactor when the user clicks Ctrl + Right Mouse Button?
  
Back to top
 
IP Logged
 
SandeepGowda
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 50
Joined: Jan 6th, 2009
Re: Zoom on Diagram View.
Reply #4 - Mar 19th, 2009 at 8:52am
Print Post  
hi,
i am handling the ZOOM on scroll of mouse, can we handle the same using CTrl+Right mouse Key?

/**
* Method Handles the Mouse Scroll on Diagram View.
*/
public void mouseWheelMoved(MouseWheelEvent evt) {

Point2D scrollPos = new Point2D.Float(m_mainDiagramView.getScrollX(),
m_mainDiagramView.getScrollY());
Point scrollPosDev = m_mainDiagramView.docToDevice(scrollPos);
Point mousePosDev = evt.getPoint();
Point2D mouseDocPos = m_mainDiagramView.deviceToDoc(mousePosDev);

Point mouseOffset = new Point(mousePosDev.x + scrollPosDev.x,
mousePosDev.y + scrollPosDev.y);

float oldZoom = m_mainDiagramView.getZoomFactor();
float newZoom = oldZoom + (float) evt.getWheelRotation();
m_mainDiagramView.setZoomFactor(newZoom);

Point2D mouseOffsetDoc = m_mainDiagramView.deviceToDoc(mouseOffset);
float sx = (float) (mouseDocPos.getX() - mouseOffsetDoc.getX());
float sy = (float) (mouseDocPos.getY() - mouseOffsetDoc.getY());
m_mainDiagramView.scrollTo(sx, sy);

}
regards
sandeep
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Zoom on Diagram View.
Reply #5 - Mar 19th, 2009 at 1:13pm
Print Post  
Hi,

You want to use Ctrl + dragging with right mouse button to zoom? You could do that by handling the Swing's mouseDragged event and instead of adding a factor of the getWheelRotation() value, add a factor of the distance mouse moved from its initial position.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint