I am using fabricjs to build an interactive map in html5.
When the DOM loads, I add my mouseover listener to my fabricjs canvas instance by calling: *my_event_setter( true )*.
Then for the sake of testing, I want to remove the listener once I do my first mouseover by calling: *my_event_setter( false )*. That should thus remove the mouseover listener, but it does not.
my_event_setter = function( toggle )
{ var lvo = { 'object:over' : function(e){ mouseover_handler( e ) } } ;
toggle ? my_fabric_canvas.on( lvo ) : my_fabric_canvas.off( lvo ) ;
}
mouseover_handler = function( e )
{ my_event_setter( false ) ;
}
I solved this by using:
The events are in an Array so it makes it easy to handle these.
Bind event with angular js like
Remove event like
bind with on method and remove from off method...:)
This example shows how to remove the mousemove when mouseup is fired: