<script>
let canvas = document.createElement("canvas");
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
document.body.appendChild(canvas);
let context = canvas.getContext("2d");
canvas.addEventListener("mousedown", function (e) {
this.isMouseDown = true;
context.moveTo(e.pageX, e.pageY);
});
canvas.addEventListener("mousemove", function (e) {
if (this.isMouseDown) {
context.lineTo(e.pageX, e.pageY);
context.stroke();
}
});
canvas.addEventListener("mouseup", function (e) {
this.isMouseDown = false;
});
</script>