slightly prettier chat bubbles

This commit is contained in:
AsbjornOlling 2022-08-17 15:32:50 +02:00
parent 4054d6ac48
commit f66a4d56ac

View file

@ -22,7 +22,7 @@ const svgns = "http://www.w3.org/2000/svg";
const width = 300; const width = 300;
const height = 500; const height = 500;
const line_height = 5; const line_height = 6;
const max_visible_lines = 10; const max_visible_lines = 10;
const messages_y_offset = 20; const messages_y_offset = 20;
const typing_speed = 70; const typing_speed = 70;
@ -98,7 +98,7 @@ function ChatMessage(message_text, is_myself) {
container.appendChild(text); container.appendChild(text);
// make chat bubble // make chat bubble
const padding = 7; const padding = 6;
const textbox = text.getBBox(); const textbox = text.getBBox();
const y_percent = Math.round(((textbox.y - padding) / height) * 100); const y_percent = Math.round(((textbox.y - padding) / height) * 100);
const bubble = document.createElementNS(svgns, 'rect'); const bubble = document.createElementNS(svgns, 'rect');

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB