Documentation for Tool and View event handling.

This commit is contained in:
Jonathan Puckey 2012-02-02 11:45:02 +01:00
parent 1e0f779ea5
commit 772174cedc
2 changed files with 118 additions and 0 deletions

View file

@ -392,4 +392,66 @@ var Tool = this.Tool = PaperScopeItem.extend(Callback, /** @lends Tool# */{
// Return if a callback was called or not.
return called;
}
/**
* {@grouptitle Event Handling}
*
* Attach an event handler to the tool.
*
* @name Tool#attach
* @function
* @param {String('mousedown', 'mouseup', 'mousedrag', 'mousemove',
* 'keydown', 'keyup')} type the event type
* @param {Function} function The function to be called when the event
* occurs
*/
/**
* Attach one or more event handlers to the tool.
*
* @name Tool#attach^2
* @function
* @param {Object} param An object literal containing one or more of the
* following properties: {@code mousedown, mouseup, mousedrag, mousemove,
* keydown, keyup}.
*/
/**
* Detach an event handler from the tool.
*
* @name Tool#detach
* @function
* @param {String('mousedown', 'mouseup', 'mousedrag', 'mousemove',
* 'keydown', 'keyup')} type the event type
* @param {Function} function The function to be detached
*/
/**
* Detach one or more event handlers from the tool.
*
* @name Tool#detach^2
* @function
* @param {Object} param An object literal containing one or more of the
* following properties: {@code mousedown, mouseup, mousedrag, mousemove,
* keydown, keyup}
*/
/**
* Fire an event on the tool.
*
* @name Tool#fire
* @function
* @param {String('mousedown', 'mouseup', 'mousedrag', 'mousemove',
* 'keydown', 'keyup')} type the event type
* @param {Object} event An object literal containing properties describing
* the event.
*/
/**
* Check if the tool has one or more event handlers of the specified type.
*
* @name Tool#responds
* @function
* @param {String('mousedown', 'mouseup', 'mousedrag', 'mousemove',
* 'keydown', 'keyup')} type the event type
* @return {Boolean} {@true if the tool has one or more event handlers of
* the specified type}
*/
});

View file

@ -395,6 +395,62 @@ var View = this.View = Base.extend(Callback, /** @lends View# */{
* @property
* @type Function
*/
/**
* {@grouptitle Event Handling}
*
* Attach an event handler to the view.
*
* @name View#attach
* @function
* @param {String('frame', 'resize')} type the event type
* @param {Function} function The function to be called when the event
* occurs
*/
/**
* Attach one or more event handlers to the view.
*
* @name View#attach^2
* @function
* @param {Object} param An object literal containing one or more of the
* following properties: {@code frame, resize}.
*/
/**
* Detach an event handler from the view.
*
* @name View#detach
* @function
* @param {String('frame', 'resize')} type the event type
* @param {Function} function The function to be detached
*/
/**
* Detach one or more event handlers from the view.
*
* @name View#detach^2
* @function
* @param {Object} param An object literal containing one or more of the
* following properties: {@code frame, resize}
*/
/**
* Fire an event on the view.
*
* @name View#fire
* @function
* @param {String('frame', 'resize')} type the event type
* @param {Object} event An object literal containing properties describing
* the event.
*/
/**
* Check if the view has one or more event handlers of the specified type.
*
* @name View#responds
* @function
* @param {String('frame', 'resize')} type the event type
* @return {Boolean} {@true if the view has one or more event handlers of
* the specified type}
*/
}, {
statics: {
_views: [],