diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b8b9a95..fd132b19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -74,6 +74,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Fixed +- Fixed issue where setting the width/height of a ScreenElement was incorrectly scaled when supplied with a scale in the ctor - Fixed issue where onRemove would sometimes not be called - Fixed issue where pointer containment WAS NOT being uses on collision shape geometry, only their bounds - Fixed issue where overriding built in uniforms and graphics no longer worked as v0.30.x diff --git a/sandbox/src/game.ts b/sandbox/src/game.ts index b0874317..f2e00bd6 100644 --- a/sandbox/src/game.ts +++ b/sandbox/src/game.ts @@ -45,7 +45,7 @@ var game = new ex.Engine({ width: 800, height: 600, canvasElementId: 'game', - suppressPlayButton: true, + // suppressPlayButton: true, pointerScope: ex.PointerScope.Canvas, displayMode: ex.DisplayMode.FitScreenAndFill, snapToPixel: false, @@ -204,6 +204,17 @@ cards2.draw(game.graphicsContext, 0, 0); jump.volume = 0.3; +var screenBox = new ex.ScreenElement({ + pos: ex.vec(50, 50), + width: 64, + height: 64, + scale: ex.vec(2, 2), + color: ex.Color.Gray +}); +game.add(screenBox); +console.log('width', screenBox.width); +console.log('height', screenBox.height); + var svgExternal = new ex.ImageSource('../images/arrows.svg'); var svg = (tags: TemplateStringsArray) => tags[0]; diff --git a/src/engine/ScreenElement.ts b/src/engine/ScreenElement.ts index 3f29e74b..4f82d8b4 100644 --- a/src/engine/ScreenElement.ts +++ b/src/engine/ScreenElement.ts @@ -31,7 +31,7 @@ export class ScreenElement extends Actor { this.pointer.useGraphicsBounds = true; this.pointer.useColliderShape = false; if (!config?.collider && config?.width > 0 && config?.height > 0) { - this.collider.useBoxCollider(this.width, this.height, this.anchor); + this.collider.useBoxCollider(config.width, config.height, this.anchor); } }