Started project opening

Fixed a bug in the flatten visible undo, created an array to store the colours in the current palette, implemented project saving.
This commit is contained in:
unsettledgames
2020-06-27 13:29:28 +02:00
parent 0b5bb3ab1a
commit 2868363bb7
10 changed files with 140 additions and 89 deletions

View File

@@ -25,20 +25,15 @@ function HistoryStateFlattenVisible(flattened) {
saveHistoryState(this);
}
function HistoryStateFlattenTwoVisibles(belowImageData, beforeAbove, layerIndex, aboveLayer, belowLayer) {
function HistoryStateFlattenTwoVisibles(belowImageData, afterAbove, layerIndex, aboveLayer, belowLayer) {
this.aboveLayer = aboveLayer;
this.belowLayer = belowLayer;
this.belowImageData = belowImageData;
this.undo = function() {
// SCEMOOOO DEVI METTERCI PURE I PIXELSSSS
console.log(afterAbove.menuEntry);
canvasView.append(aboveLayer.canvas);
if (beforeAbove != null) {
layerList.insertBefore(aboveLayer.menuEntry, beforeAbove.menuEntry);
}
else {
layerList.prepend(aboveLayer.menuEntry);
}
layerList.insertBefore(aboveLayer.menuEntry, afterAbove);
belowLayer.context.clearRect(0, 0, belowLayer.canvasSize[0], belowLayer.canvasSize[1]);
belowLayer.context.putImageData(this.belowImageData, 0, 0);