Some JSDoc work on history.js
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2734 eee81c28-f429-11dd-99c0-75d572ba1ddd
This commit is contained in:
@@ -30,10 +30,9 @@ svgedit.history.HistoryEventTypes = {
|
|||||||
var removedElements = {};
|
var removedElements = {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface: svgedit.history.HistoryCommand
|
|
||||||
* An interface that all command objects must implement.
|
* An interface that all command objects must implement.
|
||||||
*
|
* @typedef svgedit.history.HistoryCommand
|
||||||
* interface svgedit.history.HistoryCommand {
|
* @type {object}
|
||||||
* void apply(svgedit.history.HistoryEventHandler);
|
* void apply(svgedit.history.HistoryEventHandler);
|
||||||
* void unapply(svgedit.history.HistoryEventHandler);
|
* void unapply(svgedit.history.HistoryEventHandler);
|
||||||
* Element[] elements();
|
* Element[] elements();
|
||||||
@@ -53,15 +52,15 @@ var removedElements = {};
|
|||||||
* command is an object fulfilling the HistoryCommand interface.
|
* command is an object fulfilling the HistoryCommand interface.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Class: svgedit.history.MoveElementCommand
|
/**
|
||||||
// implements svgedit.history.HistoryCommand
|
* @class svgedit.history.MoveElementCommand
|
||||||
// History command for an element that had its DOM position changed
|
* @implements svgedit.history.HistoryCommand
|
||||||
//
|
* History command for an element that had its DOM position changed
|
||||||
// Parameters:
|
* @param {Element} elem - The DOM element that was moved
|
||||||
// elem - The DOM element that was moved
|
* @param {Element} oldNextSibling - The element's next sibling before it was moved
|
||||||
// oldNextSibling - The element's next sibling before it was moved
|
* @param {Element} oldParent - The element's parent before it was moved
|
||||||
// oldParent - The element's parent before it was moved
|
* @param {string} [text] - An optional string visible to user related to this change
|
||||||
// text - An optional string visible to user related to this change
|
*/
|
||||||
svgedit.history.MoveElementCommand = function(elem, oldNextSibling, oldParent, text) {
|
svgedit.history.MoveElementCommand = function(elem, oldNextSibling, oldParent, text) {
|
||||||
this.elem = elem;
|
this.elem = elem;
|
||||||
this.text = text ? ("Move " + elem.tagName + " to " + text) : ("Move " + elem.tagName);
|
this.text = text ? ("Move " + elem.tagName + " to " + text) : ("Move " + elem.tagName);
|
||||||
@@ -73,13 +72,14 @@ svgedit.history.MoveElementCommand = function(elem, oldNextSibling, oldParent, t
|
|||||||
svgedit.history.MoveElementCommand.type = function() { return 'svgedit.history.MoveElementCommand'; };
|
svgedit.history.MoveElementCommand.type = function() { return 'svgedit.history.MoveElementCommand'; };
|
||||||
svgedit.history.MoveElementCommand.prototype.type = svgedit.history.MoveElementCommand.type;
|
svgedit.history.MoveElementCommand.prototype.type = svgedit.history.MoveElementCommand.type;
|
||||||
|
|
||||||
// Function: svgedit.history.MoveElementCommand.getText
|
|
||||||
svgedit.history.MoveElementCommand.prototype.getText = function() {
|
svgedit.history.MoveElementCommand.prototype.getText = function() {
|
||||||
return this.text;
|
return this.text;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Function: svgedit.history.MoveElementCommand.apply
|
/**
|
||||||
// Re-positions the element
|
* Re-positions the element
|
||||||
|
* @param {handleHistoryEvent: function}
|
||||||
|
*/
|
||||||
svgedit.history.MoveElementCommand.prototype.apply = function(handler) {
|
svgedit.history.MoveElementCommand.prototype.apply = function(handler) {
|
||||||
// TODO(codedread): Refactor this common event code into a base HistoryCommand class.
|
// TODO(codedread): Refactor this common event code into a base HistoryCommand class.
|
||||||
if (handler) {
|
if (handler) {
|
||||||
@@ -93,8 +93,10 @@ svgedit.history.MoveElementCommand.prototype.apply = function(handler) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Function: svgedit.history.MoveElementCommand.unapply
|
/**
|
||||||
// Positions the element back to its original location
|
* Positions the element back to its original location
|
||||||
|
* @param {handleHistoryEvent: function}
|
||||||
|
*/
|
||||||
svgedit.history.MoveElementCommand.prototype.unapply = function(handler) {
|
svgedit.history.MoveElementCommand.prototype.unapply = function(handler) {
|
||||||
if (handler) {
|
if (handler) {
|
||||||
handler.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY, this);
|
handler.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY, this);
|
||||||
|
|||||||
Reference in New Issue
Block a user