{"action":"created","issue":{"url":"https://api.github.com/repos/shoes/shoes4/issues/1170","labels_url":"https://api.github.com/repos/shoes/shoes4/issues/1170/labels{/name}","comments_url":"https://api.github.com/repos/shoes/shoes4/issues/1170/comments","events_url":"https://api.github.com/repos/shoes/shoes4/issues/1170/events","html_url":"https://github.com/shoes/shoes4/pull/1170","id":112513404,"number":1170,"title":"Slot clipping for painted elements","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":null,"comments":6,"created_at":"2015-10-21T05:02:31Z","updated_at":"2015-11-22T13:33:26Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/shoes/shoes4/pulls/1170","html_url":"https://github.com/shoes/shoes4/pull/1170","diff_url":"https://github.com/shoes/shoes4/pull/1170.diff","patch_url":"https://github.com/shoes/shoes4/pull/1170.patch"},"body":"This PR will cover what we need on #1036 for non-control elements--all art and text elements in Shoes.\r\n\r\nBasically all that's necessary is to set the \"clipping\" on any graphics context before we draw with it. We set the clipping back to it's original state afterward, using a helper method added on the (poorly named) `Shoes::Swt::Common::Resource`.\r\n\r\nWIP because this deserves some actual specs, not just to pass the existing ones, and I might rename `Resource` while I'm at it."},"comment":{"url":"https://api.github.com/repos/shoes/shoes4/issues/comments/158759934","html_url":"https://github.com/shoes/shoes4/pull/1170#issuecomment-158759934","issue_url":"https://api.github.com/repos/shoes/shoes4/issues/1170","id":158759934,"user":{"login":"PragTob","id":606517,"avatar_url":"https://avatars.githubusercontent.com/u/606517?v=3","gravatar_id":"","url":"https://api.github.com/users/PragTob","html_url":"https://github.com/PragTob","followers_url":"https://api.github.com/users/PragTob/followers","following_url":"https://api.github.com/users/PragTob/following{/other_user}","gists_url":"https://api.github.com/users/PragTob/gists{/gist_id}","starred_url":"https://api.github.com/users/PragTob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PragTob/subscriptions","organizations_url":"https://api.github.com/users/PragTob/orgs","repos_url":"https://api.github.com/users/PragTob/repos","events_url":"https://api.github.com/users/PragTob/events{/privacy}","received_events_url":"https://api.github.com/users/PragTob/received_events","type":"User","site_admin":false},"created_at":"2015-11-22T13:33:26Z","updated_at":"2015-11-22T13:33:26Z","body":"This is weird... I remember that one could always throw around art elements and it'd just be ok. It seems that this is related to whether or not a slot as width/height explicitly set. First example:\r\n\r\n```ruby\r\nShoes.app do\r\nstack do\r\n  para 'omg lol'\r\n  rect 20, 20, 500, 500, fill: green\r\nend\r\nend\r\n```\r\n\r\nthis branch:\r\n\r\n![shoes 4 _013](https://cloud.githubusercontent.com/assets/606517/11324013/6aca44b2-9124-11e5-9c07-f36aacfa0e6c.png)\r\n\r\nShoes 3.2:\r\n\r\n![shoes_014](https://cloud.githubusercontent.com/assets/606517/11324014/793cdcda-9124-11e5-99f3-fc55d49d7d15.png)\r\n\r\nShoes 3.1 (it still compiles over here, wow!):\r\n\r\n![shoes_016](https://cloud.githubusercontent.com/assets/606517/11324016/85e099cc-9124-11e5-8a91-241408197252.png)\r\n\r\n\r\nNow when we set an explicit size:\r\n\r\n```ruby\r\nShoes.app do\r\nstack width: 100, height: 100 do\r\n  para 'omg lol'\r\n  rect 20, 20, 500, 500, fill: green\r\nend\r\nend\r\n\r\n```\r\n\r\nthis branch:\r\n\r\n![shoes 4 _017](https://cloud.githubusercontent.com/assets/606517/11324031/f299bd0a-9124-11e5-9d99-45835faf73fb.png)\r\n\r\nShoes 3.2:\r\n\r\n![shoes_019](https://cloud.githubusercontent.com/assets/606517/11324033/fa1b2172-9124-11e5-941d-fe4173a7e8aa.png)\r\n\r\nShoes 3.1:\r\n\r\n![shoes_021](https://cloud.githubusercontent.com/assets/606517/11324034/ff53563c-9124-11e5-9cdf-f7143b95bfa3.png)\r\n\r\n\r\nI.e. behavior does not seem to be right when there is no size set. But that might as well be because the slot sizes are set differently in the versions... let's check that:\r\n\r\n```ruby\r\nShoes.app do\r\ns = stack do\r\n  para 'omg lol'\r\n  rect 20, 20, 500, 500, fill: green\r\nend\r\n\r\nbutton 'report' do\r\n  debug \"height: #{s.height}\"\r\n  debug \"width: #{s.width}\"\r\nend\r\nend\r\n```\r\n\r\nthis branch (Shoes 4):\r\n\r\n```\r\nDEBUG: height: 19\r\nDEBUG: width: 600\r\n```\r\n\r\nShoes 3.2:\r\n\r\n```\r\nDEBUG: height: 35\r\nDEBUG: width: 600\r\n```\r\n\r\nShoes 3.1:\r\n\r\n```\r\nDEBUG: height: 35\r\nDEBUG: width: 600\r\n```\r\n\r\nWhich seems... weird arbitrary. Or well... it just does the clipping if explicit sizes are set. Which is weird but also somehow understandable... thoughts? @jasonrclark "}}