{"action":"created","issue":{"url":"https://api.github.com/repos/shoes/shoes4/issues/1124","labels_url":"https://api.github.com/repos/shoes/shoes4/issues/1124/labels{/name}","comments_url":"https://api.github.com/repos/shoes/shoes4/issues/1124/comments","events_url":"https://api.github.com/repos/shoes/shoes4/issues/1124/events","html_url":"https://github.com/shoes/shoes4/pull/1124","id":75085706,"number":1124,"title":"Position element as they are added","user":{"login":"jasonrclark","id":130504,"avatar_url":"https://avatars.githubusercontent.com/u/130504?v=3","gravatar_id":"","url":"https://api.github.com/users/jasonrclark","html_url":"https://github.com/jasonrclark","followers_url":"https://api.github.com/users/jasonrclark/followers","following_url":"https://api.github.com/users/jasonrclark/following{/other_user}","gists_url":"https://api.github.com/users/jasonrclark/gists{/gist_id}","starred_url":"https://api.github.com/users/jasonrclark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasonrclark/subscriptions","organizations_url":"https://api.github.com/users/jasonrclark/orgs","repos_url":"https://api.github.com/users/jasonrclark/repos","events_url":"https://api.github.com/users/jasonrclark/events{/privacy}","received_events_url":"https://api.github.com/users/jasonrclark/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/shoes/shoes4/milestones/8","html_url":"https://github.com/shoes/shoes4/milestones/4.0.0.pre5","labels_url":"https://api.github.com/repos/shoes/shoes4/milestones/8/labels","id":1094491,"number":8,"title":"4.0.0.pre5","description":"","creator":{"login":"jasonrclark","id":130504,"avatar_url":"https://avatars.githubusercontent.com/u/130504?v=3","gravatar_id":"","url":"https://api.github.com/users/jasonrclark","html_url":"https://github.com/jasonrclark","followers_url":"https://api.github.com/users/jasonrclark/followers","following_url":"https://api.github.com/users/jasonrclark/following{/other_user}","gists_url":"https://api.github.com/users/jasonrclark/gists{/gist_id}","starred_url":"https://api.github.com/users/jasonrclark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasonrclark/subscriptions","organizations_url":"https://api.github.com/users/jasonrclark/orgs","repos_url":"https://api.github.com/users/jasonrclark/repos","events_url":"https://api.github.com/users/jasonrclark/events{/privacy}","received_events_url":"https://api.github.com/users/jasonrclark/received_events","type":"User","site_admin":false},"open_issues":19,"closed_issues":6,"state":"open","created_at":"2015-05-04T05:00:18Z","updated_at":"2015-05-20T17:36:23Z","due_on":null,"closed_at":null},"comments":4,"created_at":"2015-05-11T04:49:38Z","updated_at":"2015-05-24T19:37:05Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/shoes/shoes4/pulls/1124","html_url":"https://github.com/shoes/shoes4/pull/1124","diff_url":"https://github.com/shoes/shoes4/pull/1124.diff","patch_url":"https://github.com/shoes/shoes4/pull/1124.patch"},"body":"Fixes #593! Also fixes #590!!!\r\n\r\nDecided to take a swipe at positioning elements as we go, and it turned out to not be so bad. Much of the positioning mechanism was already in place from `contents_alignment`--we just needed to invoke it at different times.\r\n\r\nThe basic approach is that a `Slot` will now track a persistent `@current_position`, so when an element is added, it can be positioned based on that. `contents_alignment` interacts with that same position, so any later element additions after alignment pick up where it left off.\r\n\r\nThe implementation is greatly simplified by giving up in a couple of (to my perception uncommon) cases.\r\n\r\nFirst punt is prepending--then we'll just do the `contents_alignment` instead. If you did this a ton, you'd have a bad time perf-wise, but the form of the method isn't very shoes-y anyway, and I don't see lots of samples with prepending, so I'm good with it.\r\n\r\nSecondly, if you change a slot in the middle of a list of other slots, we don't get smart, we just `contents_alignment` on the parent to sort it out. If this proves to happen a lot and cause performance problems we can try to be smarter, but for now was more comfortable with keeping that path simpler.\r\n\r\nOnly found one small perf issue raised by the changes. Game of life was slow to start because of the large number of `rect` elements, all of which claimed to need positioning. Turns out, they didn't, but the art elements were wrongly reporting that they took up space. A quick change in `AbsoluteDimensions` and we were back to good.\r\n\r\nDid require quite a bit of spec futzing to get things right (although the actual changes in the end were pretty small). Specifically I saw issues when things weren't quite set up right that would cause us to raise swallowed exceptions in positioning, which while not crashing the test immediately, did often result in failures as expectations weren't met. If you see any of these type of swallowed errors on the terminal with an app, please let me know through an issue!\r\n\r\nShoes on! :panda_face: :fire: :money_with_wings: "},"comment":{"url":"https://api.github.com/repos/shoes/shoes4/issues/comments/105055975","html_url":"https://github.com/shoes/shoes4/pull/1124#issuecomment-105055975","issue_url":"https://api.github.com/repos/shoes/shoes4/issues/1124","id":105055975,"user":{"login":"jasonrclark","id":130504,"avatar_url":"https://avatars.githubusercontent.com/u/130504?v=3","gravatar_id":"","url":"https://api.github.com/users/jasonrclark","html_url":"https://github.com/jasonrclark","followers_url":"https://api.github.com/users/jasonrclark/followers","following_url":"https://api.github.com/users/jasonrclark/following{/other_user}","gists_url":"https://api.github.com/users/jasonrclark/gists{/gist_id}","starred_url":"https://api.github.com/users/jasonrclark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasonrclark/subscriptions","organizations_url":"https://api.github.com/users/jasonrclark/orgs","repos_url":"https://api.github.com/users/jasonrclark/repos","events_url":"https://api.github.com/users/jasonrclark/events{/privacy}","received_events_url":"https://api.github.com/users/jasonrclark/received_events","type":"User","site_admin":false},"created_at":"2015-05-24T19:37:05Z","updated_at":"2015-05-24T19:37:05Z","body":"Ah yes, I actually added that `RedrawingAspect` bit :grin: #559 was the PR, and the sample from that still passes without the redraw hooks for `contents_alignment` here (as I'd expect.) Woot!\r\n\r\nMay have some bits of time across the afternoon and evening today and tomorrow, so will pick away at the various locations and then run through samples once they're locked down. Shoes on!"}}