{"action":"created","issue":{"url":"https://api.github.com/repos/photonstorm/phaser/issues/2709","repository_url":"https://api.github.com/repos/photonstorm/phaser","labels_url":"https://api.github.com/repos/photonstorm/phaser/issues/2709/labels{/name}","comments_url":"https://api.github.com/repos/photonstorm/phaser/issues/2709/comments","events_url":"https://api.github.com/repos/photonstorm/phaser/issues/2709/events","html_url":"https://github.com/photonstorm/phaser/issues/2709","id":172302032,"number":2709,"title":"[Docs Error] Phaser.Group's width and height","user":{"login":"JTronLabs","id":7429786,"avatar_url":"https://avatars.githubusercontent.com/u/7429786?v=3","gravatar_id":"","url":"https://api.github.com/users/JTronLabs","html_url":"https://github.com/JTronLabs","followers_url":"https://api.github.com/users/JTronLabs/followers","following_url":"https://api.github.com/users/JTronLabs/following{/other_user}","gists_url":"https://api.github.com/users/JTronLabs/gists{/gist_id}","starred_url":"https://api.github.com/users/JTronLabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JTronLabs/subscriptions","organizations_url":"https://api.github.com/users/JTronLabs/orgs","repos_url":"https://api.github.com/users/JTronLabs/repos","events_url":"https://api.github.com/users/JTronLabs/events{/privacy}","received_events_url":"https://api.github.com/users/JTronLabs/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-08-21T03:05:59Z","updated_at":"2016-09-26T20:52:20Z","closed_at":"2016-09-26T20:52:20Z","body":"This Issue is about (delete as applicable)\r\n\r\n* An error in the documentation\r\n\r\n If you try to set Phaser.Group's width or height, you'll fail, google it, and come across this [thread](http://www.html5gamedevs.com/topic/10540-can-i-set-the-group-width/). As far as I know, it is a variable that can only be set internally, based upon the farthest separated items inside of it. Despite that, the docs read\r\n\r\n> The width of the displayObjectContainer, setting this will actually modify the scale to achieve the value set\r\n\r\nI propose setting it to something like:\r\n\r\n> Read-only variable derived from what is inside of this Phaser.Group. Width is the difference of the right most child's right and the left most child's left.\r\n\r\n> Read-only variable derived from what is inside of this Phaser.Group. Height is the difference of the bottom most child's bottom and the top most child's top.\r\n\r\nI believe the file to change is [DisplayObjectContainer](https://github.com/photonstorm/phaser/blob/v2.6.1/src/pixi/display/DisplayObjectContainer.js), as that is refenced in Group's [width](http://phaser.io/docs/2.6.1/Phaser.Group.html#width). Since it is inherited though, I don't know if it will mess up any other docs. "},"comment":{"url":"https://api.github.com/repos/photonstorm/phaser/issues/comments/249694012","html_url":"https://github.com/photonstorm/phaser/issues/2709#issuecomment-249694012","issue_url":"https://api.github.com/repos/photonstorm/phaser/issues/2709","id":249694012,"user":{"login":"photonstorm","id":164476,"avatar_url":"https://avatars.githubusercontent.com/u/164476?v=3","gravatar_id":"","url":"https://api.github.com/users/photonstorm","html_url":"https://github.com/photonstorm","followers_url":"https://api.github.com/users/photonstorm/followers","following_url":"https://api.github.com/users/photonstorm/following{/other_user}","gists_url":"https://api.github.com/users/photonstorm/gists{/gist_id}","starred_url":"https://api.github.com/users/photonstorm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/photonstorm/subscriptions","organizations_url":"https://api.github.com/users/photonstorm/orgs","repos_url":"https://api.github.com/users/photonstorm/repos","events_url":"https://api.github.com/users/photonstorm/events{/privacy}","received_events_url":"https://api.github.com/users/photonstorm/received_events","type":"User","site_admin":false},"created_at":"2016-09-26T20:52:20Z","updated_at":"2016-09-26T20:52:20Z","body":"`Group.width` is the calculated width, in pixels, is read. If you set it, it adjusts the scale (like the docs say). Here's a little test case to show what I mean:\r\n\r\n```\r\n\r\nvar game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, render: render });\r\n\r\nvar group;\r\n\r\nfunction preload() {\r\n\r\n    game.load.image('block', 'assets/sprites/32x32.png');\r\n    \r\n}\r\n\r\nfunction create() {\r\n\r\n    group = game.add.group();\r\n\r\n    //  Create a 200x100 sized Group, with 2 sprites in the top-left and bottom-right corner\r\n    group.create(0, 0, 'block');\r\n    group.create(168, 68, 'block');\r\n\r\n    //  Set Group dimensions x2\r\n    group.width = 400;\r\n    group.height = 200;\r\n\r\n}\r\n\r\nfunction render() {\r\n\r\n    game.debug.text('width: ' + group.width, 0, 400);\r\n    game.debug.text('height: ' + group.height, 0, 432);\r\n\r\n}\r\n```"}}
{"actor":{"display_login":"photonstorm"}}