Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Trying to handle when a the mouse hovers over a shape (Read 2228 times)
twojtylak
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 9
Joined: Jan 9th, 2019
Trying to handle when a the mouse hovers over a shape
Jan 15th, 2019 at 2:51pm
Print Post  
I am trying to detect when the user hovers over a shape, but I can't seem to figure out how to raise the MouseMove event. I have seen a couple posts saying I should use it, but none say how to implement it.

The documentation says the MouseMove event exists on the BehaviorBase, but when going to the BehaviorBase class and looking at the methods, the MouseMove doesn't exist there. Neither is showing any way to handle events. I mean, the Diagram Class explicitly states it has an addEventListener function.

Am I missing something? Can somebody point me in the right direction?
  
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: Trying to handle when a the mouse hovers over a shape
Reply #1 - Jan 15th, 2019 at 3:22pm
Print Post  
Hi,

You can try handling the nodePointed event. It's raised when the user hovers over a DiagramNode (the event is raised 800ms after the user has stopped moving the pointer over the node).

Code (Javascript)
Select All
diagram.addEventListener(MindFusion.Diagramming.Events.nodePointed, function (eve, args)
{
    console.log(`${args.getNode().getText()} was pointed.`);
}); 



Regards,
Lyubo
  
Back to top
 
IP Logged
 
twojtylak
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 9
Joined: Jan 9th, 2019
Re: Trying to handle when a the mouse hovers over a shape
Reply #2 - Jan 15th, 2019 at 3:26pm
Print Post  
I tried nodePointed, but i need the event raised immediately.
  
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: Trying to handle when a the mouse hovers over a shape
Reply #3 - Jan 16th, 2019 at 9:12am
Print Post  
Hi,

You can overwrite the startHoverTimer method and omit the timeout. Try the following to raise the event immediately:

Code (Javascript)
Select All
MindFusion.Diagramming.Diagram.prototype.startHoverTimer = function (mousePosition)
{
    this.onHover(mousePosition);
}; 



Regards,
Lyubo
  
Back to top
 
IP Logged
 
twojtylak
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 9
Joined: Jan 9th, 2019
Re: Trying to handle when a the mouse hovers over a shape
Reply #4 - Jan 16th, 2019 at 3:06pm
Print Post  
You're seriously the best! That worked! Thank you!
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint