erase button

main
km0 2 years ago
parent 43a4e2142b
commit a933d2116f

@ -25,11 +25,20 @@
enable-background="new 0 0 500 500" enable-background="new 0 0 500 500"
xml:space="preserve" xml:space="preserve"
></svg> ></svg>
<button id="submit">Send</button> <button id="submit">Spiedisci</button>
<button id="erase">Cancella</button>
</div> </div>
<script> <script>
const theme = document.querySelector("#theme"); const theme = document.querySelector("#theme");
const erase = document.querySelector("#erase");
const deletePath = () => {
for (const path of document.querySelectorAll("#svgElement path")) {
path.remove();
}
};
erase.addEventListener("click", () => deletePath());
const socket = new ReconnectingWebSocket(location.origin.replace(/^http/, "ws")); const socket = new ReconnectingWebSocket(location.origin.replace(/^http/, "ws"));
@ -53,10 +62,7 @@
); );
if (paths == "") return; if (paths == "") return;
socket.send(JSON.stringify({ type: "drawings", paths: paths })); socket.send(JSON.stringify({ type: "drawings", paths: paths }));
deletePath();
for (const path of document.querySelectorAll("#svgElement path")) {
path.remove();
}
}); });
</script> </script>
</body> </body>

@ -12,9 +12,9 @@ button {
display: block; display: block;
background-color: white; background-color: white;
border: 2px solid currentColor; border: 2px solid currentColor;
padding: 16px 32px; padding: 8px 24px;
border-radius: 32px; border-radius: 24px;
font-size: 32px; font-size: 24px;
margin-top: 16px; margin-top: 16px;
} }

Loading…
Cancel
Save