Skip to content

Commit

Permalink
Fixed #45, #44, #40, #38
Browse files Browse the repository at this point in the history
  • Loading branch information
unsettledgames committed Dec 11, 2021
1 parent a238fb1 commit 1bac62b
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 31 deletions.
12 changes: 0 additions & 12 deletions js/History.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
/** BUG:
* - Create a new pixel
* - Open a png file
* - Draw with the pencil
* - Hit CTRL+Z
* - RESULT: undo doesn't work, the app can't find the current layer
*
* - RELATED: when opening an LPE file, the app draws on a layer that is below the one in which the
* file is loaded. This is because the data is loaded on new layers, but the first one
* isn't removed and sometimes it could have the same ID of a recently added layer.
*/

/** How the history works
* - undoStates stores the states that can be undone
* - redoStates stores the states that can be redone
Expand Down
2 changes: 1 addition & 1 deletion js/LayerList.js
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ const LayerList = (() => {
Layer.layerOptions.style.top = "0";
Layer.layerOptions.style.marginTop = "" + (event.clientY - 25) + "px";

getLayerByID(selectedId).selectLayer();
getLayerByID(selectedId).selectLayer(false);
}
}

Expand Down
3 changes: 3 additions & 0 deletions js/PaletteBlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ const PaletteBlock = (() => {
currentSelection.startCoords = getColourCoordinates(index);
currentSelection.endCoords = getColourCoordinates(index);
}
else if (mouseEvent.which == 1) {
endRampSelection(mouseEvent);
}
}

/** Updates the outline for the current selection.
Expand Down
2 changes: 1 addition & 1 deletion js/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const Settings = (() => {
enableDynamicCursorOutline: true, //unused - performance
enableBrushPreview: true, //unused - performance
enableEyedropperPreview: true, //unused - performance
numberOfHistoryStates: 20,
numberOfHistoryStates: 256,
maxColorsOnImportedImage: 128,
pixelGridColour: '#000000'
};
Expand Down
27 changes: 10 additions & 17 deletions js/layers/Layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,23 +186,16 @@ class Layer {
this.canvas.style.top = otherLayer.canvas.style.top;
}

selectLayer(layer) {
if (layer == null) {
// Deselecting the old layer
currFile.currentLayer.deselectLayer();

// Selecting the current layer
this.isSelected = true;
this.menuEntry.classList.add("selected-layer");
currFile.currentLayer = LayerList.getLayerByName(this.menuEntry.getElementsByTagName("p")[0].innerHTML);
}
else {
currFile.currentLayer.deselectLayer();

layer.isSelected = true;
layer.menuEntry.classList.add("selected-layer");
currFile.currentLayer = layer;
}
selectLayer(hideOptions = true) {
if (hideOptions)
LayerList.closeOptionsMenu();
// Deselecting the old layer
currFile.currentLayer.deselectLayer();

// Selecting the current layer
this.isSelected = true;
this.menuEntry.classList.add("selected-layer");
currFile.currentLayer = this;
}

toggleLock() {
Expand Down

0 comments on commit 1bac62b

Please sign in to comment.