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

pasteboard% generates artifacts when snips are dragged behind each other

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

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
領域
desktop

調査の方向性

まず、提供されている Racket 8.0 Windows 再現手順を実行し、pasteboard% の描画とドラッグ処理を調査します。特に、重なり合う snip が描画コンテキストをどのように管理しているかを確認します。青い背面のノードを緑のノード上でドラッグしても、ノードが重なっている間を含め、視覚的なアーティファクトが発生しなければ完了です。

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

説明

I am using Racket 8.0 on Windows 10. Run the following code.

#lang racket/gui

(struct dc-state (smoothing pen brush font))

(define (capture-dc-state dc)
  (dc-state (send dc get-smoothing)
            (send dc get-pen)
            (send dc get-brush)
            (send dc get-font)))

(define (restore-dc-state dc dc-state)
  (send dc set-smoothing (dc-state-smoothing dc-state))
  (send dc set-pen (dc-state-pen dc-state))
  (send dc set-brush (dc-state-brush dc-state))
  (send dc set-font (dc-state-font dc-state)))

(define node-snip-class
  (make-object
      (class snip-class%
        (super-new)
        (send this set-classname "node-snip"))))

(send (get-the-snip-class-list) add node-snip-class)

(define (set-extent-others others)
  (for/list ([other others])
    (when other (set-box! other 0.0))))

(define node%
  (class snip%
    (init-field size color)
    (super-new)
    (send this set-snipclass node-snip-class)

    (define/override (get-extent dc x y width height . others)
      (when width (set-box! width size))
      (when height (set-box! height size))
      (set-extent-others others))

    (define/override (draw dc x y . other)
      (let ([dc-state (capture-dc-state dc)])
        (send dc set-smoothing 'smoothed)
        (send dc set-pen "Black" 3 'solid)
        (send dc set-brush color 'solid)
        (send dc draw-rounded-rectangle x y size size 7)
        (restore-dc-state dc dc-state)))
    ))

(define diagram (new pasteboard%))

(define frame (new frame%
                   [label "Diagram"]
                   [width 500]
                   [height 500]))

(define canvas (new editor-canvas%
                    [parent frame]
                    [style '(no-hscroll no-vscroll)]
                    [horizontal-inset 0]
                    [vertical-inset 0]
                    [editor diagram]))

(send diagram insert (new node% [size 50] [color "Pale Green"]) 100 100)

(send diagram insert (new node% [size 50] [color "Pale Turquoise"]) 200 200)

(send frame show #t)

Note that the dc state is captured and restored in the draw override. Drag the green node over the blue one and note that no artifacts occur.

image

Now drag the blue node, which is behind the green node, and note that artifacts appear, potentially from the smoothing property not being correctly handled by the pasteboard%. Although, I'm not sure where exactly the artifacts are coming from at the moment. Notice that the artifacts only occur while the blue node is being dragged behind the green node and that they stop after the blue node "clears" the green node.

image

主要言語
Racket
スター
68
フォーク
83
平均マージ
12日 5時間
マージ済み PR(30日)
3

環境構築

はじめの一歩

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

racket/gui のほかの issue

racket/gui の issue をすべて見る

似ている issue

Desktop Dev の issue をもっと見る

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

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