From 17d1f877c3a9f87e5d27511d3eacdb589a7fba56 Mon Sep 17 00:00:00 2001 From: weizhenye Date: Mon, 10 Jun 2024 20:28:38 +0800 Subject: [PATCH] refactor: adjust this to store --- .github/workflows/ci.yml | 2 +- src/renderer/dom.js | 2 +- src/renderer/renderer.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6956356..7ed9f16 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: with: node-version: 22 - name: Install Dependencies - run: npm i + run: npm i && npx playwright install - name: Build run: npm run build - name: Test diff --git a/src/renderer/dom.js b/src/renderer/dom.js index ae60408..bf0bde3 100644 --- a/src/renderer/dom.js +++ b/src/renderer/dom.js @@ -58,7 +58,7 @@ export function createDialogue(dialogue, store) { cssText += tag.b ? `font-weight:${tag.b === 1 ? 'bold' : tag.b};` : ''; cssText += tag.i ? 'font-style:italic;' : ''; cssText += (tag.u || tag.s) ? `text-decoration:${tag.u ? 'underline' : ''} ${tag.s ? 'line-through' : ''};` : ''; - cssText += tag.fsp ? `letter-spacing:${this.scale * tag.fsp}px;` : ''; + cssText += tag.fsp ? `letter-spacing:${store.scale * tag.fsp}px;` : ''; // TODO: (tag.q === 0) and (tag.q === 3) are not implemented yet, // for now just handle it as (tag.q === 1) if (tag.q === 1 || tag.q === 0 || tag.q === 3) { diff --git a/src/renderer/renderer.js b/src/renderer/renderer.js index b6329b7..e2277a2 100644 --- a/src/renderer/renderer.js +++ b/src/renderer/renderer.js @@ -10,7 +10,7 @@ export function renderer(dialogue, store) { // Apply max width to the $div, to make sure it line breaks // properly before measuring it: - const mw = this.width - this.scale * (dialogue.margin.left + dialogue.margin.right); + const mw = store.width - store.scale * (dialogue.margin.left + dialogue.margin.right); $div.style.cssText = `max-width:${mw}px`; store.box.append($div);