nga-js: clearing output now clears the graphical display as well

FossilOrigin-Name: ae5d2c4d411f009c858910bcd786b6d8bb4e55d1171b344c3cc29186229a6d81
This commit is contained in:
crc 2019-11-20 19:36:47 +00:00
parent 63ef78d1d2
commit add2d8ac1c
2 changed files with 4 additions and 2 deletions

View file

@ -452,6 +452,8 @@ function evaluate(s) {
function cls() {
document.getElementById('console').innerHTML = "";
const context = canvas.getContext('2d');
context.clearRect(0, 0, canvas.width, canvas.height);
}
function unu(src) {
@ -497,7 +499,6 @@ function go() {
function saveproject() {
src = document.getElementById("input").value;
console.log('saving ' + src);
localStorage.setItem("Snapshot", src);
}
@ -509,7 +510,6 @@ function loadproject() {
function draw(fb_start) {
var canvas = document.getElementById('canvas');
var ctx = canvas.getContext('2d');
console.log(ctx);
var imgData = ctx.createImageData(300, 300);
var i;
for (i = 0; i < imgData.data.length / 4; i += 1) {

View file

@ -62,3 +62,5 @@
xmp {
margin-left: 0.5em;
}
canvas {
}