messagesoverlay - Draw incomplete line to fill the text area

master
Martin Boonk 2024-04-04 22:29:56 +02:00
parent 724be3637e
commit 8f8d91e951
1 changed files with 8 additions and 10 deletions

View File

@ -325,9 +325,11 @@ const drawMessage = function(ovr, msg) {
const padding = eventQueue.length > 1 ? (eventQueue.length > 3 ? 7 : 5) : 3; const padding = eventQueue.length > 1 ? (eventQueue.length > 3 ? 7 : 5) : 3;
const yText = 40; const yText = 40;
let yLine = yText + 3; let yLine = yText + 4;
const maxTextHeight = ovr.getHeight() - yLine - padding; ovr.setClipRect(2,2,ovr.getWidth() - 4, ovr.getHeight() - 4);
const maxTextHeight = ovr.getHeight() - yLine - padding + 2;
if (!msg.lines) { if (!msg.lines) {
let bodyFont = settings.fontBig; let bodyFont = settings.fontBig;
@ -368,15 +370,11 @@ const drawMessage = function(ovr, msg) {
let drawnHeight = 0; let drawnHeight = 0;
while(drawnHeight < maxTextHeight) { while(drawnHeight < maxTextHeight && msg.lines.length > currentLine) {
const lineHeight = msg.lineHeights[currentLine]; const lineHeight = msg.lineHeights[currentLine];
if (drawnHeight + lineHeight < maxTextHeight) { ovr.drawString(msg.lines[currentLine], xText, yLine + drawnHeight);
ovr.drawString(msg.lines[currentLine], xText, yLine + drawnHeight); drawnHeight += lineHeight;
drawnHeight += lineHeight; currentLine++;
currentLine++;
} else {
break;
}
} }
if (eventQueue.length > 1){ if (eventQueue.length > 1){