fix: use percentages for chat position so it scales with image
This commit is contained in:
@@ -152,11 +152,14 @@ async function main() {
|
||||
|
||||
const pageTitle = (await page.title()).replace(/[<>]/g, '');
|
||||
|
||||
const chatBlocks = slots.map(s => `
|
||||
<div class="q-chat" style="top:${s.top}px" data-cid="${s.id}">
|
||||
const chatBlocks = slots.map(s => {
|
||||
const topPct = (s.top / pageHeight * 100).toFixed(4);
|
||||
return `
|
||||
<div class="q-chat" style="top:${topPct}%" data-cid="${s.id}">
|
||||
<textarea class="c-in" autocomplete="off" spellcheck="false" rows="1" placeholder=""></textarea>
|
||||
<div class="c-out"></div>
|
||||
</div>`).join('');
|
||||
</div>`;
|
||||
}).join('');
|
||||
|
||||
const wrapperHtml = `<!DOCTYPE html>
|
||||
<html lang="ru">
|
||||
@@ -170,8 +173,8 @@ async function main() {
|
||||
.q-wrap img.bg { display:block; width:100%; height:auto; }
|
||||
.q-chat {
|
||||
position: absolute;
|
||||
left: 250px;
|
||||
width: 520px;
|
||||
left: 15.6%;
|
||||
width: 32.5%;
|
||||
z-index: 10;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user