{"action":"created","issue":{"url":"https://api.github.com/repos/STRML/react-grid-layout/issues/56","labels_url":"https://api.github.com/repos/STRML/react-grid-layout/issues/56/labels{/name}","comments_url":"https://api.github.com/repos/STRML/react-grid-layout/issues/56/comments","events_url":"https://api.github.com/repos/STRML/react-grid-layout/issues/56/events","html_url":"https://github.com/STRML/react-grid-layout/issues/56","id":75767586,"number":56,"title":"Keeping the boxes within the limits of the container","user":{"login":"volkanunsal","id":151600,"avatar_url":"https://avatars.githubusercontent.com/u/151600?v=3","gravatar_id":"","url":"https://api.github.com/users/volkanunsal","html_url":"https://github.com/volkanunsal","followers_url":"https://api.github.com/users/volkanunsal/followers","following_url":"https://api.github.com/users/volkanunsal/following{/other_user}","gists_url":"https://api.github.com/users/volkanunsal/gists{/gist_id}","starred_url":"https://api.github.com/users/volkanunsal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/volkanunsal/subscriptions","organizations_url":"https://api.github.com/users/volkanunsal/orgs","repos_url":"https://api.github.com/users/volkanunsal/repos","events_url":"https://api.github.com/users/volkanunsal/events{/privacy}","received_events_url":"https://api.github.com/users/volkanunsal/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-05-12T22:47:59Z","updated_at":"2015-05-13T16:28:26Z","closed_at":"2015-05-13T16:27:37Z","body":"I don't understand how the demo keeps the boxes within the container. In my own demo, they never want to stay in their container, even though their x and y values never dip below 0 or exceed the maximum w or h I set for them. Here is my code:\r\n\r\n```\r\nonLayoutChange(layout) {\r\n  this.setState({layout: layout});\r\n},\r\n\r\ngetInitialState() {\r\n  var layout = [\r\n    {i: 1, x: 0, y: 0, minW: 0, minH: 3, maxH: 12, w: 4, h: 3},\r\n    {i: 2, x: 4, y: 0, minW: 0, minH: 3, maxH: 12, w: 4, h: 3},\r\n    {i: 3, x: 8, y: 0, minW: 0, minH: 3, maxH: 12, w: 4, h: 3},\r\n    {i: 4, x: 0, y: 1, minW: 0, minH: 3, maxH: 12, w: 12, h: 3}\r\n  ]\r\n  return {layout: layout};\r\n},\r\nrender(){\r\n  return <ReactGridLayout\r\n    className=\"layout\"\r\n    rowHeight={30}\r\n    isResizable={true}\r\n    cols={12}\r\n    layout={this.state.layout}\r\n    onLayoutChange={this.onLayoutChange}\r\n    >\r\n    <div key={1}>1</div>\r\n    <div key={2}>2</div>\r\n    <div key={3}>3</div>\r\n    <div key={4}>3</div>\r\n  </ReactGridLayout>;\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/STRML/react-grid-layout/issues/comments/101737410","html_url":"https://github.com/STRML/react-grid-layout/issues/56#issuecomment-101737410","issue_url":"https://api.github.com/repos/STRML/react-grid-layout/issues/56","id":101737410,"user":{"login":"STRML","id":1197375,"avatar_url":"https://avatars.githubusercontent.com/u/1197375?v=3","gravatar_id":"","url":"https://api.github.com/users/STRML","html_url":"https://github.com/STRML","followers_url":"https://api.github.com/users/STRML/followers","following_url":"https://api.github.com/users/STRML/following{/other_user}","gists_url":"https://api.github.com/users/STRML/gists{/gist_id}","starred_url":"https://api.github.com/users/STRML/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/STRML/subscriptions","organizations_url":"https://api.github.com/users/STRML/orgs","repos_url":"https://api.github.com/users/STRML/repos","events_url":"https://api.github.com/users/STRML/events{/privacy}","received_events_url":"https://api.github.com/users/STRML/received_events","type":"User","site_admin":false},"created_at":"2015-05-13T16:28:26Z","updated_at":"2015-05-13T16:28:26Z","body":"For reference, the issue was an improper optimization in `react-draggable` where it would not adjust the translation of an object if it was being moved back to its initial position. I've removed the optimization - it's not clear it sped anything up, anyway."}}