Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Diagram OnMouseWheel event (Read 9759 times)
henry k
Junior Member
**
Offline


I Love MindFusion!

Posts: 51
Location: Finland
Joined: Apr 4th, 2012
Diagram OnMouseWheel event
May 4th, 2012 at 12:35pm
Print Post  
Hi,

Is there possibility to catch mouseWheel event on diagram?
(in JavaApplet mode)

And yes, this is Zooming function related Smiley

Br. Henry
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Diagram OnMouseWheel event
Reply #1 - May 7th, 2012 at 7:19am
Print Post  
Hi,

This version adds MouseWheelScript:
https://mindfusion.eu/_temp/netdiag_mousewheel.zip

You could handle it like this:
Code
Select All
<ndiag:DiagramView runat="server"
	MouseWheelScript="onMouseWheelMoved"
	...

function onMouseWheelMoved(sender, args)
{
	var applet = <%= diagramView.AppletElement %>;
	var diagramView = applet.getDiagramView();
	var oldZoom = diagramView.getZoomFactor();
	var newZoom = oldZoom - args.getWheelRotation();
	diagramView.setZoomFactor(newZoom);
}
 



Do not name your handler just "onMouseWheel" - this did not work in Internet Explorer for some reason. Perhaps it has a built-in Window.onMouseWheel function which stops the control from calling your custom onMouseWheel. Other names, e.g. onMouseWheelMoved, work fine.

The type of args is the standard Java MouseWheelEvent class.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
henry k
Junior Member
**
Offline


I Love MindFusion!

Posts: 51
Location: Finland
Joined: Apr 4th, 2012
Re: Diagram OnMouseWheel event
Reply #2 - May 7th, 2012 at 7:50am
Print Post  
was unable to find MouseWheelScript propery from DiagramView... and as result onMouseWheelMoved functions was not fired...

Using sampleing of 4.2 NetDiagram:
- MindFusion.Diagramming.dll { 1756KB; Ver.5.8.0.22763; Created 9.3.2012 16:11 (do not know if date is created from of build or unpacking of installer) }
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Diagram OnMouseWheel event
Reply #3 - May 7th, 2012 at 8:19am
Print Post  
Did you overwrite the assemblies referenced by your project with the ones from the zip file?
  
Back to top
 
IP Logged
 
henry k
Junior Member
**
Offline


I Love MindFusion!

Posts: 51
Location: Finland
Joined: Apr 4th, 2012
Re: Diagram OnMouseWheel event
Reply #4 - May 7th, 2012 at 10:15am
Print Post  
Stoyo wrote on May 7th, 2012 at 8:19am:
Did you overwrite the assemblies referenced by your project with the ones from the zip file?



No (Highly doubt it)... as it's the only property missing so far... Smiley
Also I looked at the samples that were installed to Program Files -directory... none of those contained MouseWheel property in <DiagramView /> as nether in <Diagram />.

Br. Henry
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Diagram OnMouseWheel event
Reply #5 - May 7th, 2012 at 11:17am
Print Post  
Please take a look at my first reply again - it contains a link to a zip file. Unzip it and overwrite the dll and jar files used in your project. Only then you will have a MouseWheelScript property.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
henry k
Junior Member
**
Offline


I Love MindFusion!

Posts: 51
Location: Finland
Joined: Apr 4th, 2012
Re: Diagram OnMouseWheel event
Reply #6 - May 7th, 2012 at 12:54pm
Print Post  
Stoyo wrote on May 7th, 2012 at 11:17am:
Please take a look at my first reply again - it contains a link to a zip file. Unzip it and overwrite the dll and jar files used in your project. Only then you will have a MouseWheelScript property.

I hope that helps,
Stoyan


Sorry... monday; should have read that more accurately.
  Embarrassed
  
Back to top
 
IP Logged
 
henry k
Junior Member
**
Offline


I Love MindFusion!

Posts: 51
Location: Finland
Joined: Apr 4th, 2012
Re: Diagram OnMouseWheel event
Reply #7 - May 8th, 2012 at 7:36am
Print Post  
Am I missing something. [getZoomFactor()] returns error: property or method doesn't exist.
Is some other property or element required for this?

btw... the event is fired. Smiley

Br. Henry
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Diagram OnMouseWheel event
Reply #8 - May 8th, 2012 at 2:38pm
Print Post  
What object are you calling getZoomFactor() on?
  
Back to top
 
IP Logged
 
henry k
Junior Member
**
Offline


I Love MindFusion!

Posts: 51
Location: Finland
Joined: Apr 4th, 2012
Re: Diagram OnMouseWheel event
Reply #9 - May 9th, 2012 at 4:41am
Print Post  
You're right. Once again, eyes open Embarrassed

Thank you Smiley
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint