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 067afdb187 - Show all commits

View file

@ -73,7 +73,7 @@ function ChatMessage(message_text, is_myself) {
/// Render the chat message on the screen /// Render the chat message on the screen
this.draw = function() { this.draw = function() {
let text = document.createElementNS(svgns, 'text'); let text = document.createElementNS(svgns, 'text');
let x = (is_myself)?10 :50; let x = 100 + (is_myself ? 10 : 50);
text.setAttribute('x', `${x}%`); text.setAttribute('x', `${x}%`);
lines.forEach(function(line) { lines.forEach(function(line) {
@ -133,9 +133,11 @@ function swipe_viewport() {
let coords = svg.getAttribute('viewBox').split(' '); let coords = svg.getAttribute('viewBox').split(' ');
let x = parseInt(coords.shift()); let x = parseInt(coords.shift());
if(x == 0) { if(x == 0) {
// moving from messages to contacts
var step = 5; var step = 5;
var end = width; var end = width;
} else { } else {
// moving from contacts to messages
var step = -5; var step = -5;
var end = 0; var end = 0;
} }
@ -246,23 +248,23 @@ async function dialog_kaereste() {
]]> ]]>
</script> </script>
<!-- [left] contact name view --> <!-- [right] contact name view -->
<rect x="0" y="0" width="100%" height="10%" fill="yellow" /> <rect x="100%" y="0" width="100%" height="10%" fill="yellow" />
<polyline points="0,20 20,0 20,40" fill="blue" onclick="swipe_viewport()" /> <polyline points="300,20 320,0 320,40" fill="blue" onclick="swipe_viewport()" /> <!-- XXX: these polyline points depend on the svg width -->
<text x="50" y="30" id="contact_indicator">loading...</text> <text x="125%" y="30" id="contact_indicator">loading...</text>
<!-- [left] messages view --> <!-- [right] messages view -->
<rect x="0" y="10%" width="100%" height="90%" style="stroke: green; stroke-width: 10px" fill="blue" /> <rect x="100%" y="10%" width="100%" height="90%" style="stroke: green; stroke-width: 10px" fill="blue" />
<rect id="messages_background" x="5%" y="15%" z="2" width="90%" height="85%" fill="pink" /> <rect id="messages_background" x="105%" y="15%" z="2" width="90%" height="85%" fill="pink" />
<g id="messages"></g> <g id="messages"></g>
<!-- [right] contact list --> <!-- [left] contact list -->
<rect x="100%" y="0" width="100%" height="10%" fill="yellow" /> <rect x="0" y="0" width="100%" height="10%" fill="yellow" />
<text x="120%" y="30">Dine kontakter</text> <text x="20%" y="30">Dine kontakter</text>
<rect x="100%" y="10%" width="100%" height="100%" style="stroke: green; stroke-width: 10px" fill="aqua" /> <rect x="0" y="10%" width="100%" height="100%" style="stroke: green; stroke-width: 10px" fill="aqua" />
<text x="105%" y="15%" onclick="start_chat('Ven')">Ven</text> <text x="5%" y="15%" onclick="start_chat('Ven')">Ven</text>
<text x="105%" y="20%" onclick="start_chat('Mor')">Mor</text> <text x="5%" y="20%" onclick="start_chat('Mor')">Mor</text>
<text x="105%" y="25%" onclick="start_chat('Kæreste')">Kæreste&#10084;</text> <text x="5%" y="25%" onclick="start_chat('Kæreste')">Kæreste&#10084;</text>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 8 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB