'add another image' button functionality
This commit is contained in:
parent
9383ac76fd
commit
e7641255e5
|
@ -31,7 +31,7 @@ html(lang="en-gb")
|
|||
textarea#output
|
||||
br
|
||||
button#download download
|
||||
button.pagination.prev add another image
|
||||
button.pagination.prev#add add another image
|
||||
button.pagination.start#reset start again
|
||||
script(type="module")
|
||||
include script.js
|
||||
|
|
12
script.js
12
script.js
|
@ -3,6 +3,8 @@ import init, {load_default_game_data, add_tiles} from './pkg/bitsy_tiles.js';
|
|||
async function run() {
|
||||
await init();
|
||||
|
||||
const output = document.getElementById("output");
|
||||
|
||||
// hide all pages except start page
|
||||
for (let page of document.getElementsByClassName('page')) {
|
||||
page.style.display = "none";
|
||||
|
@ -103,6 +105,16 @@ async function run() {
|
|||
importButton.addEventListener("click", addTiles);
|
||||
importButton.addEventListener("touchend", addTiles);
|
||||
|
||||
function addImage() {
|
||||
gameDataInput.value = output.value;
|
||||
output.value = "";
|
||||
}
|
||||
|
||||
const addImageButton = document.getElementById("add");
|
||||
|
||||
addImageButton.addEventListener("click", addImage);
|
||||
addImageButton.addEventListener("touchend", addImage);
|
||||
|
||||
function reset() {
|
||||
gameDataInput.innerHTML = '';
|
||||
preview.removeAttribute("src");
|
||||
|
|
Loading…
Reference in New Issue