Nokia Maps API Reference

Contents

Class nokia.maps.dom.DataTransfer

Class Summary

This class is a browser-independent implementation of the HTML 5 interface DataTransfer. The class extends the capabilities stipulated in the HTML 5 specification by allowing native JavaScript objects as values. If there is native support and the value is a string, then the data is copied into the native data transfer object.

new nokia.maps.dom.DataTransfer ([nativeDataTransfer])
Method Summary
addElement (element) This method offers an alternative way of specifying how the user agent is to render the drag feedback.
allows (dropEffect) This method checks if the supplied drop effect is allowed or not.
clearData (format) : nokia.maps.dom.DataTransfer This method removes the data of the specified format.
getData (format) This method retrieves the data specified by the caller.
hasData (format) This method checks if data matching the format specified by the caller exists.
setData (format, data) This method adds the data specified by the caller.
setDragImage (image, [left, [top]]) This method sets the element to be used to generate the drag feedback.
Field Summary
String cursor This property defines the CSS cursor to be shown during non-lift dragging; the default value is "pointer".
String dropEffect This property names the currently selected operation type.
String effectAllowed This property names allowed operations.
Object[] files This property contains references to the files that are being dragged, if any.
Boolean lift This property can only be modified within a dragstart event, it indicates if a drag operation lifts the target or not.
Object ndt This property holds a reference to a native data transfer object, if available.
Boolean realTime This property determines if all the drag-events are to be processed in real time or if thresholds are to be applied to prevent too many events and therefore an overall performance drop.
String[] types This property holds an array of strings with the formats that were set in the dragstart event.
Constructor Detail

This method initializes a new instance of DataTransfer

new nokia.maps.dom.DataTransfer([nativeDataTransfer])
Parameters:
{Object} [nativeDataTransfer]: The reference to a native data transfer object (requires browser support for native drag and drop)
Method Detail
addElement (element)
This method offers an alternative way of specifying how the user agent is to render the drag feedback. It adds an element to the DataTransfer object.
Parameters:
{node} element The element to add as drag feedback for the user
allows (dropEffect)
This method checks if the supplied drop effect is allowed or not.

This is a proprietary member and not part of the implementation of W3C interface specifications.

Parameters:
{String} dropEffect The drop effect to check: copy, move or link
Returns:
A {Boolean} value, true if the effect is allowed, false otherwise
clearData (format) : nokia.maps.dom.DataTransfer
This method removes the data of the specified format. It removes all data if the argument is omitted.
Parameters:
{String} format The format for which the data should be removed.
Returns:
{nokia.maps.dom.DataTransfer} The data transfer object itself (this).
getData (format)
This method retrieves the data specified by the caller. If there is no matching data, an empty string is returned.
Parameters:
{String} format The format of the data to return
Returns:
An {Object} containing the data
hasData (format)
This method checks if data matching the format specified by the caller exists.
Parameters:
{String} format The format of the data to check for
Returns:
A {Boolean} value, true if the data in the given format is available; false otherwise.
setData (format, data)
This method adds the data specified by the caller.
Parameters:
{String} format The format of the data
{Object} data The data
Returns:
An instance of {nokia.maps.dom.DataTransfer} representing the data transfer object itself (this)
setDragImage (image, [left, [top]])
This method sets the element to be used to generate the drag feedback. The element can be any element; if it is an img, then the user agent should use the element's image (at its intrinsic size) to generate the feedback, otherwise the user agent should base the feedback on the given element (but the exact mechanism for doing so is not specified).
Examples:
		// If "imageNode" is a DOM image with a size of 50 pixel, 
		// then this would attach this image to the cursor, 
		// align it 25 pixel to top-left
		event.dataTransfer.setDragImage( imageNode, -25, -25 );
Parameters:
{node} image The feedback element to be used as drag feedback
{Object} [left]: 0 The horizontal pixel offset of the left border of the image relative to the cursor, a positive number moves the image to the right of the cursor, a negative number moves the image left to the cursor
{Object} [top]: 0 The vertical pixel offset of the top border of the image relative to the cursor, a positive number moves the image to the bottom of the cursor, a negative number moves the image top to the cursor
Field Detail
String cursor
This property defines the CSS cursor to be shown during non-lift dragging; the default value is "pointer".
String dropEffect
This property names the currently selected operation type. To succeed, the operation must be allowed by the attribute effectAllowed.

The value of the property can be set to change the selected operation. The possible values are none, copy, link, and move.

String effectAllowed
This property names allowed operations.

The value of the property can be set to modify the list of allowed operations. The possible values are none, copy, copyLink, copyMove, link, linkMove, move, all, and uninitialized.

Object[] files
This property contains references to the files that are being dragged, if any.
Boolean lift
This property can only be modified within a dragstart event, it indicates if a drag operation lifts the target or not.

If an object is dragged, but not lifted, no dragenter, dragover, dragleave or drop events are dispatched. Dragging without lift occurs, for example, when the slider or the scale bar is moved, or when the map is panned. It means that something is dragged within a limited area and cannot leave that area -- for example, the thumb shift of a zoom slider cannot leave the zoom slider, therefore the zoom slider handles the movement of the thumb shift, and consequently updates the slider within the drag event, without notifying any other element in the Web site or outside the browser window.

In dragging without lift, the cursor is not defined by the dropEffect, but by the cursor property.

Object ndt
This property holds a reference to a native data transfer object, if available.
Boolean realTime
This property determines if all the drag-events are to be processed in real time or if thresholds are to be applied to prevent too many events and therefore an overall performance drop. The property has the best effect if set directly within the dragstart event, otherwise it will only be partially "near-time".

Note: This property has no effect in native drag and drop and we recommended that you avoid real-time drag and drop operations if possible.

String[] types
This property holds an array of strings with the formats that were set in the dragstart event. In addition, if any files are being dragged, one of the types is the string "Files".
Documentation generated on Thu Feb 09 2012 12:59:01 GMT+0100 (CET).