`Controller.paddingOverride` default prevents Glow filter from calculating framebuffer padding
Maintainer thường phản hồi trong vòng 3 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 48/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript
- Lĩnh vực
- game-dev
Hướng nghiên cứu
Bắt đầu với phần khởi tạo paddingOverride trong src/filters/Controller.js và so sánh với Glow.getPadding() trong src/filters/Glow.js. Sử dụng bản tái hiện tối thiểu với một sprite trong suốt để xác minh rằng padding của Glow được tính từ khoảng cách theo mặc định, trong khi setPaddingOverride() vẫn cho phép ghi đè rõ ràng. Được xem là hoàn tất khi glow mở rộng vượt ra ngoài các cạnh của sprite mà không bị cắt.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Version
- Phaser Version: 4.0.0 RC6
- Operating system: Linux
- Browser: Chrome 133
Description
The Controller base class initializes paddingOverride to new Rectangle() (Controller.js:67), which is a zero-valued but truthy object.
The Glow filter overrides getPadding() and checks if (this.paddingOverride) before falling through to its own distance-based padding calculation (Glow.js:218). Since paddingOverride is always truthy, the Glow's distance * scale calculation never executes, and the framebuffer gets zero extra padding.
Expected: Glow extends beyond the sprite outline by distance pixels, following the alpha edges of the opaque pixels.
Actual: Glow is confined within the sprite's rectangular bounds and abruptly cuts off at the frame edges. The effect looks like a square gradient that stops at the sprite frame boundary.
Example Test Code
// Minimal reproduction
const config = {
type: Phaser.AUTO,
width: 400,
height: 300,
backgroundColor: '#2d2d2d',
scene: {
preload: function () {
// Use any sprite with transparency (non-rectangular shape)
this.load.image('star', 'https://labs.phaser.io/assets/sprites/star.png');
},
create: function () {
const sprite = this.add.sprite(200, 150, 'star');
sprite.enableFilters();
const glow = sprite.filters.internal.addGlow(0xffff00, 4, 0, 1, false, 10, 16);
// BUG: glow is clipped to sprite's rectangular bounds
// WORKAROUND: uncomment the next line to fix it
// glow.setPaddingOverride(null);
}
}
};
new Phaser.Game(config);
Additional Information
Root cause: Controller.js:67 sets this.paddingOverride = new Rectangle(). This zero-valued Rectangle is always truthy, so when Glow.getPadding() checks if (this.paddingOverride), it always takes the override path and returns zero padding instead of calculating distance * scale.
Workaround:
glow.setPaddingOverride(null);
Suggested fix: In Controller.js:67, change:
this.paddingOverride = new Rectangle();
to:
this.paddingOverride = null;
This lets filters with custom getPadding() implementations (Glow, Blur) fall through to their own padding logic by default. setPaddingOverride() can still be called explicitly when an override is desired.
This likely affects any filter that overrides getPadding() with a truthy check on paddingOverride.
- Ngôn ngữ chính
- JavaScript
- Star
- 40.7k
- Fork
- 7.2k
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc 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.
Issue khác của phaserjs/phaser
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 80/100
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
Maintainer thường phản hồi trong vòng 3 ngày
-
Type definition for TilemapLayer.getTileAt is wrongCó thể đã có người làm @hkbughk đã nhận 34 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 3 ngày
-
Shader.preDestroy leaks its ShaderQuad's vertex buffer and VAO on every create/destroy cycle (4.2.1)Có thể đã có người làm @k1epg01ng129-eng đã nhận 32 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
Maintainer thường phản hồi trong vòng 3 ngày
-
Black opaque background on transparent Phaser.Text textures in Phaser 4.2.1 on older iOS WebGLCó thể đã có người làm @SamuelMalmfors đã nhận 14 ngày trước. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
phaserjs/phaser#7392 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
Tất cả issue của phaserjs/phaser
Issue tương tự
-
enhancement ready
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
DCGM/semant-demo#708 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
agents area: runtime automation chore cli consistency dependencies developer-experience difficulty: easy documentation enhancement good first issue help wanted hygiene json-output priority: P3 starters tests
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Client codegen: an import repeated in an impl file is emitted twice, and the browser rejects the moduleCó thể đã có người làm @MalithaPrabhashana đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
jaseci-labs/jac#10756 ·
Maintainer thường phản hồi trong vòng 1 ngày