Nokia Maps API Reference

Contents

Interface nokia.maps.dom.MouseEventTarget

Interface Summary

Each class implementing this interface delcares that it can act as the target for certain events. Each event in this interface (and therefore also within the classes implementing the interface) represents an event of a specific type.

The following example shows event handling for events of the type "click":

// Note that "obj" can be either a DOM node or any other JavaScript object.
var obj = nokia.maps.dom.EventTarget( {} );
obj.addListener("click", function (evt) {
	console.log("This is the '"+evt.type+"' event!");
});

obj.dispatch( new nokia.maps.dom.Event({
	type: "click"
});

The example creates an instant of nokia.maps.dom.EventTarget, adds a listener for "click" events to it, and dispatches a "click" event to all registered listeners (in this case one) - the listeners receive the object that represents the target of the event.

For more information about dispatching events, please refer to the documentation of the nokia.maps.dom.EventTarget.

Method Summary
click (evt) This event is fired after a mousedown/mouseup sequence at the same target has occurred.
dblclick (evt) This event is fired after two click events have been fired within a certain time period.
longpress (evt) This event is fired after a mouse button has been pressed for a certain amount of time without starting a drag.
mousedown (evt) This event is fired if a mouse button has been pressed.
mouseenter (evt) This event is fired if the mouse cursor enters the visible area of a node -- it is fired at the node that the mouse has entered.
mouseleave (evt) This event is fired when the mouse cursor leaves the physical area of a node -- it is fired at the node the mouse has left.
mousemove (evt) This event is fired if the mouse is moved.
mouseout (evt) This event is fired if the mouse cursor leaves the visible area of a node -- the event is fired at the node that the mouse has left.
mouseover (evt) This event is fired when the mouse cursor enters the visible area of a node -- the event is fired at the node that is entered.
mouseup (evt) This event is fired if a mouse button has been released.
mousewheel (evt) This event is fired if the mousewheel is moved.
Events
click(evt)
This event is fired after a mousedown/mouseup sequence at the same target has occurred.
Parameters:
{nokia.maps.dom.MouseEvent} evt An object representing the event
dblclick(evt)
This event is fired after two click events have been fired within a certain time period.
Parameters:
{nokia.maps.dom.MouseEvent} evt An object representing the event
longpress(evt)
This event is fired after a mouse button has been pressed for a certain amount of time without starting a drag.
Parameters:
{nokia.maps.dom.MouseEvent} evt An object representing the event
mousedown(evt)
This event is fired if a mouse button has been pressed.
Parameters:
{nokia.maps.dom.MouseEvent} evt An object representing the event
mouseenter(evt)
This event is fired if the mouse cursor enters the visible area of a node -- it is fired at the node that the mouse has entered.

The difference between the mouseenter and mouseleave events compared to the mouseover and mouseout events is that there can be multiple mouseenter events without even one mouseleave event. This happens, for example, if you have a <div> with the size of 100 x 100 pixels that contains a centered image measuring 50 x 50 pixels. When the mouse cursor enters the outer <div>, the <div> receives a mouseover and a mouseenter event (note that the order is not guaranteed). However, if the mouse cursor now moves over the image, the outer <div> receives a mouseout event, because the mouse is no longer within its visual area, and now the image gets a mouseover event. Additionally, the image receives a mouseenter event, but the outer <div> does not get a mouseleave event, because the mouse has not left the physical area of the outer <div>.

The mouseenter and mouseleave events are very useful, for example, when building tooltips that are to apear below the mouse cursor or when showing overlay information as long as the mouse cursor is above a specific area that contains child nodes.

Parameters:
{nokia.maps.dom.MouseEvent} evt An object representing the event
mouseleave(evt)
This event is fired when the mouse cursor leaves the physical area of a node -- it is fired at the node the mouse has left.

The difference between the mouseenter and mouseleave events compared to the mouseover and mouseout events is that there can be multiple mouseenter events without even one mouseleave event. This happens, for example, if you have a <div> with the size of 100 x 100 pixels that contains a centered image measuring 50 x 50 pixels. When the mouse cursor enters the outer <div>, the <div> receives a mouseover and a mouseenter event (note that the order is not guaranteed). However, if the mouse cursor now moves over the image, the outer <div> receives a mouseout event, because the mouse is no longer within its visual area, and now the image gets a mouseover event. Additionally, the image receives a mouseenter event, but the outer <div> does not get a mouseleave event, because the mouse has not left the physical area of the outer <div>.

The mouseenter and mouseleave events are very useful, for example, when building tooltips that are to apear below the mouse cursor or when showing overlay information as long as the mouse cursor is above a specific area that contains child nodes.

Parameters:
{nokia.maps.dom.MouseEvent} evt An object representing the event
mousemove(evt)
This event is fired if the mouse is moved.
Parameters:
{nokia.maps.dom.MouseEvent} evt An object representing the event
mouseout(evt)
This event is fired if the mouse cursor leaves the visible area of a node -- the event is fired at the node that the mouse has left.
Parameters:
{nokia.maps.dom.MouseEvent} evt An object representing the event
mouseover(evt)
This event is fired when the mouse cursor enters the visible area of a node -- the event is fired at the node that is entered.
Parameters:
{nokia.maps.dom.MouseEvent} evt An object representing the event
mouseup(evt)
This event is fired if a mouse button has been released.
Parameters:
{nokia.maps.dom.MouseEvent} evt An object representing the event
mousewheel(evt)
This event is fired if the mousewheel is moved.
Parameters:
{nokia.maps.dom.WheelEvent} evt An object representing the event
Documentation generated on Wed Jun 27 2012 16:54:20 GMT+0200 (CEST).