Draft: chat bubbles and some smaller UI improvements #1

Merged
om merged 4 commits from a2/chatcontrol-live-demo:asbjørn-additions into master 2022-08-17 16:30:59 +00:00
Showing only changes of commit f66a4d56ac - Show all commits

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: 8 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB