Skip to content

Commit 94fafbc

Browse files
committed
fix(SDK): fix BufferedGroup width calculation
1 parent 800d6f8 commit 94fafbc

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

engine/modules/entities/src/main/resources/view/entity-module/BufferedGroup.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ export class BufferedGroup extends ContainerBasedEntity {
1414

1515
postUpdate () {
1616
if (this.needsRender) {
17-
const bufferBoundsWidth = this.buffer.getBounds().width
18-
const bufferBoundsHeight = this.buffer.getBounds().height
19-
if (this.gameTexture == null || this.gameTexture.width < bufferBoundsWidth || this.gameTexture.height < bufferBoundsHeight) {
20-
const width = Math.min(Math.max(bufferBoundsWidth, 512), 4096)
21-
const height = Math.min(Math.max(bufferBoundsHeight, 512), 4096)
17+
const bufferBounds = this.buffer.getBounds()
18+
const positiveWidth = Math.max(0, bufferBounds.x + bufferBounds.width)
19+
const positiveHeight = Math.max(0, bufferBounds.y + bufferBounds.height)
20+
21+
if (this.gameTexture == null || this.gameTexture.width < positiveWidth || this.gameTexture.height < positiveHeight) {
22+
const width = Math.min(Math.max(positiveWidth, 512), 4096)
23+
const height = Math.min(Math.max(positiveHeight, 512), 4096)
2224
this.gameTexture = PIXI.RenderTexture.create(width, height)
2325
flagForDestructionOnReinit(this.gameTexture)
2426
this.graphics.texture = this.gameTexture

playground/misc/misc-3-release-notes.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
The CodinGame SDK is regularly updated and improved. This document lets you know what changed in the latest releases.
44

5+
## 4.4.2
6+
7+
### 🐞 Bug fix
8+
9+
- Fixed `BufferedGroup` width calculation when no children occupy coordinates 0,0
10+
511
## 4.4.1
612

713
### 🐞 Bug fix

0 commit comments

Comments
 (0)