Selecting a pen color leaves Example drawing in eraser mode
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 78/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- javascript
- Ambito
- frontend
Direzione di ricerca
Inizia con il gestore del pulsante del colore e il gestore del puntatore in web/example-board.js, poi confrontane il comportamento con selectPen() in web/interview.js. Aggiungi o aggiorna il test di regressione in example-board.test.js per coprire il passaggio da Eraser a un colore della penna e la selezione esplicita di Eraser. Il lavoro è completo quando il colore selezionato disegna un tratto di penna con la larghezza prevista, gli stati della barra degli strumenti corrispondono allo strumento attivo ed Eraser continua a produrre tratti di gomma.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem and motivation
In the coding interview's Example drawing panel, selecting a pen color after using the eraser does not switch back to the pen. The color button becomes selected, but subsequent strokes still erase existing content. A candidate trying to annotate a diagram in another color can therefore erase it instead.
The color buttons have labels such as Pen Red, which suggest that selecting one activates that pen. The full whiteboard already follows this behavior, so the two drawing surfaces respond differently to the same action.
Steps to reproduce
- Select Editor mode and enable Example drawing in the lobby.
- Start an interview and enter the live coding phase.
- Expand Example drawing and draw a black line.
- Select Eraser.
- Select the red pen color.
- Draw across the black line.
Expected:
Selecting the red pen color activates the pen, and the next stroke draws a red line.
Actual:
The red color is selected, but Eraser remains active and the next stroke erases the black line.
Initial analysis
In web/example-board.js, the color-button handler updates color and the color buttons' aria-pressed states, but leaves tool unchanged. The pointer handler later passes that unchanged tool to model.begin(), so the board continues producing eraser strokes.
The full whiteboard handles this through selectPen() in web/interview.js, which sets both the color and board.tool = "pen" before updating the toolbar. Applying the same interaction rule to Example drawing would make the selected color and the active drawing tool agree.
Proposed implementation
Keep the change within the Example drawing toolbar. Selecting a color should activate the pen and update both the pen/eraser buttons and the color buttons to reflect the resulting state. Eraser behavior should remain available through its explicit control.
Add a regression test that selects Eraser, selects a pen color, and draws a stroke. Assert that the stroke uses the selected color and pen width, that Pen is active, and that Eraser is inactive. Also verify that explicitly selecting Eraser still produces an eraser stroke.
Verification so far
At checkout revision fd7c23c, a module-level reproduction using the actual mountExampleBoard() implementation with simulated DOM and canvas objects produced a white, width-24 eraser stroke after selecting Eraser and then Pen Red. The red color button and Eraser both remained pressed.
The existing example-board.test.js suite passed all eight tests. The interaction above has not yet been manually verified in a real browser; the steps listed above are the browser verification procedure.
- Lingua principale
- Rust
- Stelle
- 177
- Fork
- 100
- Merge medio
- 1g 8h
- PR unite (30g)
- 168
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di sysprog21/codetrial
-
Python tests lose every result when the solution returns inf or NaNForse già presa @shensyuan l’ha presa 1 giorno fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
sysprog21/codetrial#419 · 3 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Allow deselecting a chosen problem card by clicking it againForse già presa @woohsin l’ha presa 1 giorno fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
sysprog21/codetrial#392 · 4 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Audio output can be confirmed without playing a test soundForse già presa @ChenYingHan1121 l’ha presa 3 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
sysprog21/codetrial#359 · 5 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Add a Copy code button to the final reportForse già presa @yansawu l’ha presa 4 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
sysprog21/codetrial#318 · 5 commenti · 2 reazioni · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di sysprog21/codetrial
Issue simili
-
state:triage-needed
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
bug P2
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
pedrovgs/UseCaseCoverage#23 ·
-
area: library data-loss tier: p0 type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
llm translation
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno