mirror of
https://github.com/lospec/pixel-editor.git
synced 2023-08-10 21:12:51 +03:00
Binded closeDialogue to esc
In that way the user can exit a dialogue without using the button and the mouse
This commit is contained in:
parent
8433b6018a
commit
8abe1f04bb
@ -8,6 +8,8 @@ const Dialogue = (() => {
|
|||||||
const popUpContainer = document.getElementById("pop-up-container");
|
const popUpContainer = document.getElementById("pop-up-container");
|
||||||
const cancelButtons = popUpContainer.getElementsByClassName('close-button');
|
const cancelButtons = popUpContainer.getElementsByClassName('close-button');
|
||||||
|
|
||||||
|
Events.onCustom("esc-pressed", closeDialogue);
|
||||||
|
|
||||||
// Add click handlers for all cancel buttons
|
// Add click handlers for all cancel buttons
|
||||||
for (var i = 0; i < cancelButtons.length; i++) {
|
for (var i = 0; i < cancelButtons.length; i++) {
|
||||||
cancelButtons[i].addEventListener('click', function () {
|
cancelButtons[i].addEventListener('click', function () {
|
||||||
|
@ -75,13 +75,12 @@ const Input = (() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//if no document has been created yet or there is a dialog box open ignore hotkeys
|
//if no document has been created yet or there is a dialog box open ignore hotkeys
|
||||||
if (!EditorState.documentCreated() || Dialogue.isOpen()) return;
|
if (!EditorState.documentCreated()) return;
|
||||||
|
|
||||||
if (e.key === "Escape") {
|
if (e.key === "Escape") {
|
||||||
console.log("esc");
|
|
||||||
Events.emit("esc-pressed");
|
Events.emit("esc-pressed");
|
||||||
}
|
}
|
||||||
else {
|
else if (!Dialogue.isOpen()){
|
||||||
switch (keyboardEvent.keyCode) {
|
switch (keyboardEvent.keyCode) {
|
||||||
//pencil tool - 1, b
|
//pencil tool - 1, b
|
||||||
case 49: case 66:
|
case 49: case 66:
|
||||||
|
Loading…
Reference in New Issue
Block a user