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:
unsettledgames
2021-07-14 22:20:55 +02:00
parent e4ecc3d607
commit 6c8ec8e7a9
14 changed files with 508 additions and 553 deletions

View File

@ -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();