mirror of
https://github.com/lospec/pixel-editor.git
synced 2023-08-10 21:12:51 +03:00
Refactored History into an IIFE
Divided History states and actual History management, refactored all occurrences of history-related functions to use the new version.
This commit is contained in:
@ -41,7 +41,7 @@ const ColorModule = (() => {
|
||||
newColor.a = 255;
|
||||
|
||||
//save undo state
|
||||
new HistoryStateEditColor(hexElementValue.toLowerCase(), Color.rgbToHex(oldColor));
|
||||
new HistoryStates.EditColor(hexElementValue.toLowerCase(), Color.rgbToHex(oldColor));
|
||||
|
||||
//get the currently selected color
|
||||
const currentlyEditedColor = document.getElementsByClassName('jscolor-active')[0];
|
||||
@ -138,7 +138,7 @@ const ColorModule = (() => {
|
||||
currentLayer.context.fillStyle = '#' + newColor;
|
||||
|
||||
//add history state
|
||||
new HistoryStateAddColor(addedColor.firstElementChild.jscolor.toString());
|
||||
new HistoryStates.AddColor(addedColor.firstElementChild.jscolor.toString());
|
||||
|
||||
//show color picker
|
||||
addedColor.firstElementChild.jscolor.show();
|
||||
|
Reference in New Issue
Block a user