Skip to content

Commit 8e4dc1f

Browse files
committed
ScaleManager.getParentBounds now checks if parentNode has an offsetParent before calling getBoundingClientRect on it (thanks @McFarts phaserjs#2134)
1 parent b91de47 commit 8e4dc1f

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ can be controlled per-input mode.
307307
* The ScaleManager no longer creates a Phaser.FlexGrid if the class isn't available (i.e. excluded via a custom build)
308308
* Time.suggestedFps is now defaulted to Time.desiredFps for the first few frames until things have settled down (previously it was `null`) (thanks @noidexe #2130)
309309
* Text with anchor 0.5 and word wrap would have an extra space added to its width calculations, this is now adjusted for (thanks @nickryall #2052 #1990)
310+
* ScaleManager.getParentBounds now checks if `parentNode` has an `offsetParent` before calling `getBoundingClientRect` on it (thanks @McFarts #2134)
310311

311312
### Bug Fixes
312313

src/core/ScaleManager.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1421,7 +1421,7 @@ Phaser.ScaleManager.prototype = {
14211421
{
14221422
// Ref. http://msdn.microsoft.com/en-us/library/hh781509(v=vs.85).aspx for getBoundingClientRect
14231423
var clientRect = parentNode.getBoundingClientRect();
1424-
var parentRect = parentNode.offsetParent.getBoundingClientRect();
1424+
var parentRect = (parentNode.offsetParent) ? parentNode.offsetParent.getBoundingClientRect() : parentNode.getBoundingClientRect();
14251425

14261426
bounds.setTo(clientRect.left - parentRect.left, clientRect.top - parentRect.top, clientRect.width, clientRect.height);
14271427

0 commit comments

Comments
 (0)