processing / processing/processing4
Improve PApplet draw method's documentation or behavior
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Java
- Star
- 494
- Fork
- 183
- Merge trung bình
- 4 giờ 39 phút
- Pull request đã merge (30 ngày)
- 3
Mô tả
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.
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu từ phương thức PApplet.draw và tái hiện trường hợp lớp con được mô tả trong issue, trong đó draw gọi super.draw và việc xử lý sự kiện dừng lại. Xác định liệu kết quả mong muốn là một cảnh báo rõ ràng hơn hay một thay đổi về hành vi, sau đó kiểm tra kết quả đã chọn dựa trên quy trình tái hiện gồm ba bước.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- java
- Lĩnh vực
- api
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100