mirror of
https://github.com/lospec/pixel-editor.git
synced 2023-08-10 21:12:51 +03:00
made pixel grid switch on by default for basic mode, and off for advanced mode
This commit is contained in:
parent
c51cb0d68b
commit
562b9ad074
@ -30,6 +30,9 @@ function switchMode(mustConfirm = true) {
|
|||||||
document.querySelector('#sp-quickstart-container .mode-switcher').classList.add('advanced-mode');
|
document.querySelector('#sp-quickstart-container .mode-switcher').classList.add('advanced-mode');
|
||||||
|
|
||||||
pixelEditorMode = 'Advanced';
|
pixelEditorMode = 'Advanced';
|
||||||
|
|
||||||
|
//turn pixel grid off
|
||||||
|
togglePixelGrid('off');
|
||||||
}
|
}
|
||||||
//switch to basic mode
|
//switch to basic mode
|
||||||
else {
|
else {
|
||||||
@ -64,6 +67,7 @@ function switchMode(mustConfirm = true) {
|
|||||||
document.querySelector('#sp-quickstart-container .mode-switcher').classList.remove('advanced-mode');
|
document.querySelector('#sp-quickstart-container .mode-switcher').classList.remove('advanced-mode');
|
||||||
|
|
||||||
pixelEditorMode = 'Basic';
|
pixelEditorMode = 'Basic';
|
||||||
|
togglePixelGrid('on');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
let pixelGridColor = "#000000";
|
let pixelGridColor = "#000000";
|
||||||
// Distance between one line and another in HTML pixels
|
// Distance between one line and another in HTML pixels
|
||||||
let lineDistance = 12;
|
let lineDistance = 12;
|
||||||
// The grid is not visible at the beginning
|
// The grid is visible by default
|
||||||
let pixelGridVisible = false;
|
let pixelGridVisible = true;
|
||||||
// Saving the canvas containing the pixel grid
|
// Saving the canvas containing the pixel grid
|
||||||
pixelGridCanvas = document.getElementById("pixel-grid");
|
pixelGridCanvas = document.getElementById("pixel-grid");
|
||||||
|
|
||||||
@ -11,12 +11,15 @@ pixelGridCanvas = document.getElementById("pixel-grid");
|
|||||||
* (triggered by the show pixel grid button in the top menu)
|
* (triggered by the show pixel grid button in the top menu)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function togglePixelGrid(event) {
|
function togglePixelGrid(newState) {
|
||||||
|
console.log('toggling pixel grid', newState)
|
||||||
// Getting the button because I have to change its text
|
// Getting the button because I have to change its text
|
||||||
let button = document.getElementById("toggle-pixelgrid-button");
|
let button = document.getElementById("toggle-pixelgrid-button");
|
||||||
|
|
||||||
// Toggling the state
|
//Set the state based on the passed newState variable, otherwise just toggle it
|
||||||
pixelGridVisible = !pixelGridVisible;
|
if (newState == 'on') pixelGridVisible = true;
|
||||||
|
else if (newState == 'off') pixelGridVisible = false;
|
||||||
|
else pixelGridVisible = !pixelGridVisible;
|
||||||
|
|
||||||
// If it was visible, I hide it
|
// If it was visible, I hide it
|
||||||
if (pixelGridVisible) {
|
if (pixelGridVisible) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user