From 7ec9326ce00d08f9d957981f2edff6df26f24a28 Mon Sep 17 00:00:00 2001 From: jinlin <jinlin> Date: 星期四, 26 九月 2024 13:25:02 +0800 Subject: [PATCH] 修改 --- web/public/SVGOrigin/Method-Draw-master/method-draw/src/history.js | 46 +++++++++++++++++++++++----------------------- 1 files changed, 23 insertions(+), 23 deletions(-) diff --git a/web/public/SVGOrigin/Method-Draw-master/method-draw/src/history.js b/web/public/SVGOrigin/Method-Draw-master/method-draw/src/history.js index c5b520e..08f1d09 100644 --- a/web/public/SVGOrigin/Method-Draw-master/method-draw/src/history.js +++ b/web/public/SVGOrigin/Method-Draw-master/method-draw/src/history.js @@ -101,7 +101,7 @@ if (handler) { handler.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY, this); } - + this.elem = this.oldParent.insertBefore(this.elem, this.oldNextSibling); if (handler) { @@ -139,12 +139,12 @@ // Function: svgedit.history.InsertElementCommand.apply // Re-Inserts the new element -svgedit.history.InsertElementCommand.prototype.apply = function(handler) { +svgedit.history.InsertElementCommand.prototype.apply = function(handler) { if (handler) { handler.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY, this); } - this.elem = this.parent.insertBefore(this.elem, this.nextSibling); + this.elem = this.parent.insertBefore(this.elem, this.nextSibling); if (handler) { handler.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_APPLY, this); @@ -201,7 +201,7 @@ // Function: RemoveElementCommand.apply // Re-removes the new element -svgedit.history.RemoveElementCommand.prototype.apply = function(handler) { +svgedit.history.RemoveElementCommand.prototype.apply = function(handler) { if (handler) { handler.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY, this); } @@ -217,7 +217,7 @@ // Function: RemoveElementCommand.unapply // Re-adds the new element -svgedit.history.RemoveElementCommand.prototype.unapply = function(handler) { +svgedit.history.RemoveElementCommand.prototype.unapply = function(handler) { if (handler) { handler.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY, this); } @@ -243,7 +243,7 @@ // Class: svgedit.history.ChangeElementCommand // implements svgedit.history.HistoryCommand -// History command to make a change to an element. +// History command to make a change to an element. // Usually an attribute change, but can also be textcontent. // // Parameters: @@ -471,7 +471,7 @@ this.undoChangeStackPointer = -1; this.undoableChangeStack = []; }; - + // Function: svgedit.history.UndoManager.resetUndoStack // Resets the undo stack, effectively clearing the undo/redo history svgedit.history.UndoManager.prototype.resetUndoStack = function() { @@ -480,30 +480,30 @@ }; // Function: svgedit.history.UndoManager.getUndoStackSize -// Returns: +// Returns: // Integer with the current size of the undo history stack svgedit.history.UndoManager.prototype.getUndoStackSize = function() { return this.undoStackPointer; }; // Function: svgedit.history.UndoManager.getRedoStackSize -// Returns: +// Returns: // Integer with the current size of the redo history stack svgedit.history.UndoManager.prototype.getRedoStackSize = function() { return this.undoStack.length - this.undoStackPointer; }; // Function: svgedit.history.UndoManager.getNextUndoCommandText -// Returns: +// Returns: // String associated with the next undo command -svgedit.history.UndoManager.prototype.getNextUndoCommandText = function() { +svgedit.history.UndoManager.prototype.getNextUndoCommandText = function() { return this.undoStackPointer > 0 ? this.undoStack[this.undoStackPointer-1].getText() : ""; }; // Function: svgedit.history.UndoManager.getNextRedoCommandText -// Returns: +// Returns: // String associated with the next redo command -svgedit.history.UndoManager.prototype.getNextRedoCommandText = function() { +svgedit.history.UndoManager.prototype.getNextRedoCommandText = function() { return this.undoStackPointer < this.undoStack.length ? this.undoStack[this.undoStackPointer].getText() : ""; }; @@ -516,7 +516,7 @@ } }; -// Function: svgedit.history.UndoManager.redo +// Function: svgedit.history.UndoManager.redo // Performs a redo step svgedit.history.UndoManager.prototype.redo = function() { if (this.undoStackPointer < this.undoStack.length && this.undoStack.length > 0) { @@ -524,18 +524,18 @@ cmd.apply(this.handler_); } }; - + // Function: svgedit.history.UndoManager.addCommandToHistory // Adds a command object to the undo history stack // -// Parameters: +// Parameters: // cmd - The command object to add svgedit.history.UndoManager.prototype.addCommandToHistory = function(cmd) { // FIXME: we MUST compress consecutive text changes to the same element // (right now each keystroke is saved as a separate command that includes the // entire text contents of the text element) // TODO: consider limiting the history that we store here (need to do some slicing) - + // if our stack pointer is not at the end, then we have to remove // all commands after the pointer and insert the new command if (this.undoStackPointer < this.undoStack.length && this.undoStack.length > 0) { @@ -547,13 +547,13 @@ // Function: svgedit.history.UndoManager.beginUndoableChange -// This function tells the canvas to remember the old values of the -// attrName attribute for each element sent in. The elements and values -// are stored on a stack, so the next call to finishUndoableChange() will +// This function tells the canvas to remember the old values of the +// attrName attribute for each element sent in. The elements and values +// are stored on a stack, so the next call to finishUndoableChange() will // pop the elements and old values off the stack, gets the current values // from the DOM and uses all of these to construct the undo-able command. // -// Parameters: +// Parameters: // attrName - The name of the attribute being changed // elems - Array of DOM elements being changed svgedit.history.UndoManager.prototype.beginUndoableChange = function(attrName, elems) { @@ -576,7 +576,7 @@ // change since beginUndoableChange was called. The command can then // be added to the command history // -// Returns: +// Returns: // Batch command object with resulting changes svgedit.history.UndoManager.prototype.finishUndoableChange = function() { var p = this.undoChangeStackPointer--; @@ -598,4 +598,4 @@ }; -})(); \ No newline at end of file +})(); -- Gitblit v1.9.1