Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

pasteboard% generates artifacts when snips are dragged behind each other

Abierto
#216 4 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Área
desktop

Línea de trabajo

Comienza ejecutando la reproducción proporcionada para Racket 8.0 en Windows e inspecciona el dibujo y el manejo del arrastre de pasteboard%, especialmente cómo los snips superpuestos gestionan el contexto de dibujo. Se considera terminado cuando arrastrar el nodo azul posterior sobre el nodo verde no produce artefactos visuales, incluso mientras los nodos se solapan.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

Lenguaje dominante
Racket
Estrellas
68
Forks
83
Merge medio
21 h
PR fusionados (30 d)
1

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de racket/gui

Todos los issues de racket/gui

Issues similares

Más issues de Desktop Dev

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.