Big Sister Web Application Framework
Functions | Variables
SwafDrag.js File Reference

Functions

function SwafDrag ()
 Drag&Drop implementation.
function swaf_dragger_drag (e)
 helper function - registered as mousemove event handler
function swaf_dragger_startDrag (e)
 helper function - registered as mousedown event handler or rather called by pageMouseDown()
function swaf_dragger_endDrag (e)
 helper function - registered as mouseup event handler
function swaf_makedraggable ()
 helper function - initializes the swaf_dragger as soon as the document has been loaded
new SwafOnload (swaf_makedraggable)
 Wraps a function to be called on document load.

Variables

var swaf_dragger = new SwafDrag()
 The current drag&drop handler (SwafDrag).

Function Documentation

function swaf_dragger_drag (   e)

helper function - registered as mousemove event handler

References swaf_dragger.

Referenced by SwafDrag().

function swaf_dragger_endDrag (   e)

helper function - registered as mouseup event handler

References swaf_dragger.

Referenced by SwafDrag().

function swaf_dragger_startDrag (   e)

helper function - registered as mousedown event handler or rather called by pageMouseDown()

References swaf_dragger.

Referenced by pageMousedown().

function swaf_makedraggable ( )

helper function - initializes the swaf_dragger as soon as the document has been loaded

References swaf_dragger.

function SwafDrag ( )

Drag&Drop implementation.

Allows dragging of elements that are embedded within a block element with an id starting with the string "dragme". The block element must be position/relative or position/absolute in order to be draggable.

SYNOPSIS

<div id="dragme_123" style="position:relative">
<input type="hidden" name="dragsrc" value="someidentifier">
some text
</div>

The style object of the currently dragged object, null if no element is currently dragged

Pointer to the currently dragged object.

Pointer to the element that was clicked in order to start the drag.

true if browser is IE-ish

The saved horizontal position the dragged object originally had

The saved vertical position the dragged object originally had

The time when the current drag started

True if the last mouseup event was related with a drag&drop action

True if between the last startDrag() and endDrag() a drag() call occured.

Register event handlers

Starts dragging the currently clicked object. This is thought to be used as a mousedown event handler.

After startDrag() the currently dragged object is moved via this method. This is supposed to be used as a mousemove handler.

Terminates the current drag action. This is supposed to be used as a mouseup handler.

Restores the position of the element that was most recently dragged.

Returns true if the latest mouseup action was related with a drag (or rather a drop). In order for an action to be considered as a drag&drop, an element marked for dragging (id = "dragme...") must have been clicked, it must have been moved and the whole action must have endured at least 300ms.

boolean

References swaf_dragger_drag(), and swaf_dragger_endDrag().

new SwafOnload ( onloadCallback  )

Wraps a function to be called on document load.

Handles the browser dependent ways of "onload" functionality.

SYNOPSIS

function callme() {
alert( "document has been loaded" );
}
new SwafOnload( callme );

Registers object as one that has to be called on load.

Invoked by SwafOnload_call() after the document has been loaded. Usually this calls the callback function registered via the constructor.

callback function

References swaf_onload, SwafOnload(), and SwafOnload_call().

Variable Documentation

var swaf_dragger = new SwafDrag()

The current drag&drop handler (SwafDrag).

It does not make too much sense to have more than one drag&drop handler with only one single mouse :-). Therefore one SwafDrag instance is setup by default and can be accessed via this global variable.

Referenced by showContextMenu(), swaf_dragger_drag(), swaf_dragger_endDrag(), swaf_dragger_startDrag(), and swaf_makedraggable().