processing / processing/processing4

Improve PApplet draw method's documentation or behavior

Ouverte
#789 2 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Langage dominant
Java
Étoiles
494
Forks
183
Merge moyen
4 h 39 min
PR mergées (30 j)
3

Description

Created by: agreyson

Description

A subclass of PApplet that overrides draw and invokes super.draw (which could happen inadvertently if using an IDE such as IntelliJ that auto-completes overridden methods) will not respond to user events (e.g. mouse clicks). Currently, this is a tricky bug to fix unless a developer is savvy enough to hunt down this GitHub repository and read the implementation of the PApplet draw method. There is a print statement in the implementation that might provide a clue, but it's currently commented out. Uncommenting and providing more details in that print statement would be helpful. For example, you could advise the developer to reconsider invoking super.draw, and explain that it will suspend event handling. (That said, perhaps a better solution would be for the PApplet draw method not to assume that it's being invoked because the subclass has not overridden draw.)

Expected Behavior

public void draw() {
// if no draw method, then shut things down
System.out.println("You're either not overriding the draw method or invoking super.draw from your draw method.");
System.out.println("If the latter, are you sure you mean to do this? Invoking super.draw will suspend event handling.");
finished = true;
}

Current Behavior

public void draw() {
// if no draw method, then shut things down
//System.out.println("no draw method, goodbye");
finished = true;
}

Steps to Reproduce

  1. Subclass PApplet.
  2. Override the draw method in the subclass.
  3. Invoke super.draw from the new draw method.

Your Environment

  • Processing version: 4.1.1
  • Operating System and OS version: macOS Ventura 13.1
  • Other information: I'm using IntelliJ, not the Processing application, and I'm subclassing PApplet and adding the Processing library to my program.

Possible Causes / Solutions

As I mentioned above, a clarifying comment would be a decent compromise if assigning true to finished in the PApplet draw method cannot be avoided.

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par la méthode PApplet.draw et reproduisez le cas de sous-classe décrit dans l’issue, où draw appelle super.draw et où le traitement des événements s’arrête. Déterminez si le résultat attendu est un avertissement plus clair ou une modification du comportement, puis vérifiez le résultat choisi à l’aide de la reproduction en trois étapes.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
java
Domaine
api
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.