processing / processing/processing4
Improve PApplet draw method's documentation or behavior
まだ誰も着手していません。
- 主要言語
- Java
- スター
- 494
- フォーク
- 183
- 平均マージ
- 4時間 39分
- マージ済み PR(30日)
- 3
説明
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
- Subclass PApplet.
- Override the draw method in the subclass.
- 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.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
PApplet.draw メソッドから始め、draw が super.draw を呼び出すとイベント処理が停止する、issue に記載されたサブクラスのケースを再現します。意図された結果が、より明確な警告なのか動作の変更なのかを判断し、選択した結果を 3 段階の再現手順に対して検証します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- java
- 領域
- api
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100