{"action":"created","issue":{"url":"https://api.github.com/repos/miguelcobain/ember-leaflet/issues/26","labels_url":"https://api.github.com/repos/miguelcobain/ember-leaflet/issues/26/labels{/name}","comments_url":"https://api.github.com/repos/miguelcobain/ember-leaflet/issues/26/comments","events_url":"https://api.github.com/repos/miguelcobain/ember-leaflet/issues/26/events","html_url":"https://github.com/miguelcobain/ember-leaflet/issues/26","id":127800824,"number":26,"title":"Using fitBounds","user":{"login":"lucacorti","id":1076999,"avatar_url":"https://avatars.githubusercontent.com/u/1076999?v=3","gravatar_id":"","url":"https://api.github.com/users/lucacorti","html_url":"https://github.com/lucacorti","followers_url":"https://api.github.com/users/lucacorti/followers","following_url":"https://api.github.com/users/lucacorti/following{/other_user}","gists_url":"https://api.github.com/users/lucacorti/gists{/gist_id}","starred_url":"https://api.github.com/users/lucacorti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lucacorti/subscriptions","organizations_url":"https://api.github.com/users/lucacorti/orgs","repos_url":"https://api.github.com/users/lucacorti/repos","events_url":"https://api.github.com/users/lucacorti/events{/privacy}","received_events_url":"https://api.github.com/users/lucacorti/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":17,"created_at":"2016-01-20T22:38:32Z","updated_at":"2016-01-27T14:16:39Z","closed_at":"2016-01-27T14:16:39Z","body":"I'm using a computed property to center the map on bounds calculeted from the set of markers added to the map:\r\n\r\n```\r\n  bounds: Ember.computed('places', function(){\r\n    return L.latLngBounds(this.get('places').map(function(place){ return place.get('location'); }));\r\n  })\r\n```\r\n\r\nThis works but not on the initial page load. On the first page load the map, the map is not zoomed. The set of markers is set on the controller from the route."},"comment":{"url":"https://api.github.com/repos/miguelcobain/ember-leaflet/issues/comments/175652463","html_url":"https://github.com/miguelcobain/ember-leaflet/issues/26#issuecomment-175652463","issue_url":"https://api.github.com/repos/miguelcobain/ember-leaflet/issues/26","id":175652463,"user":{"login":"miguelcobain","id":631691,"avatar_url":"https://avatars.githubusercontent.com/u/631691?v=3","gravatar_id":"","url":"https://api.github.com/users/miguelcobain","html_url":"https://github.com/miguelcobain","followers_url":"https://api.github.com/users/miguelcobain/followers","following_url":"https://api.github.com/users/miguelcobain/following{/other_user}","gists_url":"https://api.github.com/users/miguelcobain/gists{/gist_id}","starred_url":"https://api.github.com/users/miguelcobain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miguelcobain/subscriptions","organizations_url":"https://api.github.com/users/miguelcobain/orgs","repos_url":"https://api.github.com/users/miguelcobain/repos","events_url":"https://api.github.com/users/miguelcobain/events{/privacy}","received_events_url":"https://api.github.com/users/miguelcobain/received_events","type":"User","site_admin":false},"created_at":"2016-01-27T14:16:39Z","updated_at":"2016-01-27T14:16:39Z","body":"@lucacorti that problem was that you were including the styles in the `tsc.hbs` template with this line:\r\n`<link rel=\"stylesheet\" href=\"/assets/thats.css\">`.\r\n\r\nThis means that, at the time of rendering, leaflet doesn't know the container size. So, `fitBounds` doesn't really make sense when we don't know the container size, right? Like, \"fit\" where?\r\n\r\nPlacing the style `<link` in <head> at index.html file solved the problem.\r\n\r\nGlad to see ember-leaflet is helping art in some way! :+1: "}}