Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Support for high density monitors with devicePixelRatio

オープン
#306 コメント 0 件 リアクション 0 件 担当者 1 名 GitHub で見る

@Absulit がすでに取り組んでいます。

2026年6月2日 から。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
65/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
静か
技術スタック
javascript

調査の方向性

この issue は、高密度モニター向けの canvas のサイズ変更に関するものです。おそらく canvas 管理モジュールにあるコードスニペット内の ResizeObserver の使用箇所を確認してください。まず canvas が初期化およびサイズ変更されている場所を見つけ、次に示されているように devicePixelRatio のサポートを統合します。High-DPI ディスプレイでライブラリを実行し、canvas のレンダリングが鮮明であることを確認してテストします。

索引モデルが issue の本文から書いたものです。

説明

enhancement

This is related to #299

Required for high density monitors and the HTML in Canvas to not look blurry, it needs to support the device pixel ratio


const observer = new ResizeObserver(this.#resizeCanvasToFitWindow);

const supportsDevicePixelContentBox =
    typeof ResizeObserverEntry !== 'undefined' &&
    'devicePixelContentBoxSize' in ResizeObserverEntry.prototype;
const options = supportsDevicePixelContentBox ? { box: 'device-pixel-content-box', signal } : { signal };
observer.observe(this.#canvas, options);



#resizeCanvasToFitWindow = (entries) => {
    // there are some calls of this function that do not have entries
    // because of this, clientWidth and clientHeight values are used
    const entry = entries?.[0];

    this.#screenResized = true;
    if (this.#fitWindow) {
        const width = entry?.contentRect?.width || this.#canvas.clientWidth;
        const height = entry?.contentRect?.height || this.#canvas.clientHeight;
        const dpc = entry?.devicePixelContentBoxSize;
        this.#canvas.width = dpc ? dpc[0].inlineSize : Math.round(width * window.devicePixelRatio);
        this.#canvas.height = dpc ? dpc[0].blockSize : Math.round(height * window.devicePixelRatio);
        this.#setScreenSize();
        this.#frame()
    }
}
主要言語
JavaScript
スター
56
フォーク
5
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Absulit/points のほかの issue

Absulit/points の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。