drawing coming soon

This commit is contained in:
2023-09-06 19:49:24 -04:00
parent aaa3044cfd
commit ca6b6b9ab1
2 changed files with 16 additions and 4 deletions

View File

@@ -48,10 +48,8 @@
lastEpoch: currentEpoch,
messagesSent: 0
};
console.debug('MessagesLeft() resetting epoch for room', roomId);
return userMessageLimit;
} else {
console.debug('MessagesLeft() returning messages left for room', roomId);
return userMessageLimit - $rateLimitStore[roomId].messagesSent;
}
}

View File

@@ -9,9 +9,8 @@
// Resize function
function resizeCanvas() {
const parent = canvas.parentElement;
console.log(parent);
const parentWidth = parent!.clientWidth;
const parentHeight = parent!.clientHeight;
const parentHeight = parent!.clientHeight - 150;
console.log(parentWidth, parentHeight);
let height, width;
@@ -25,6 +24,7 @@
canvas.width = width;
canvas.height = height;
console.log(canvas.height, canvas.width);
}
onMount(() => {
@@ -32,6 +32,20 @@
ctx = canvas.getContext('2d')!;
resizeCanvas();
window.addEventListener('resize', resizeCanvas);
canvas.addEventListener('click', function (event) {
const rect = canvas.getBoundingClientRect();
const x = event.clientX - rect.left;
const y = event.clientY - rect.top;
});
ctx.font = '30px Arial'; // Set font size and type
ctx.textAlign = 'center'; // Horizontal alignment
ctx.textBaseline = 'middle'; // Vertical alignment
const centerX = canvas.width / 2;
const centerY = canvas.height / 2;
ctx.fillStyle = '#fa5f5f'; // Text color
ctx.fillText('Drawing Coming soon', centerX, centerY); // Draw text
});
</script>