{"action":"created","issue":{"url":"https://api.github.com/repos/istarkov/google-map-react/issues/210","repository_url":"https://api.github.com/repos/istarkov/google-map-react","labels_url":"https://api.github.com/repos/istarkov/google-map-react/issues/210/labels{/name}","comments_url":"https://api.github.com/repos/istarkov/google-map-react/issues/210/comments","events_url":"https://api.github.com/repos/istarkov/google-map-react/issues/210/events","html_url":"https://github.com/istarkov/google-map-react/issues/210","id":168540520,"number":210,"title":"Change zoom to fit all markers without change center","user":{"login":"khmelevskii","id":668591,"avatar_url":"https://avatars.githubusercontent.com/u/668591?v=3","gravatar_id":"","url":"https://api.github.com/users/khmelevskii","html_url":"https://github.com/khmelevskii","followers_url":"https://api.github.com/users/khmelevskii/followers","following_url":"https://api.github.com/users/khmelevskii/following{/other_user}","gists_url":"https://api.github.com/users/khmelevskii/gists{/gist_id}","starred_url":"https://api.github.com/users/khmelevskii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/khmelevskii/subscriptions","organizations_url":"https://api.github.com/users/khmelevskii/orgs","repos_url":"https://api.github.com/users/khmelevskii/repos","events_url":"https://api.github.com/users/khmelevskii/events{/privacy}","received_events_url":"https://api.github.com/users/khmelevskii/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2016-07-31T21:57:04Z","updated_at":"2016-09-14T18:44:13Z","closed_at":null,"body":"How calc zoom for visible all markers and don't change map center"},"comment":{"url":"https://api.github.com/repos/istarkov/google-map-react/issues/comments/247114629","html_url":"https://github.com/istarkov/google-map-react/issues/210#issuecomment-247114629","issue_url":"https://api.github.com/repos/istarkov/google-map-react/issues/210","id":247114629,"user":{"login":"leandrooriente","id":1781007,"avatar_url":"https://avatars.githubusercontent.com/u/1781007?v=3","gravatar_id":"","url":"https://api.github.com/users/leandrooriente","html_url":"https://github.com/leandrooriente","followers_url":"https://api.github.com/users/leandrooriente/followers","following_url":"https://api.github.com/users/leandrooriente/following{/other_user}","gists_url":"https://api.github.com/users/leandrooriente/gists{/gist_id}","starred_url":"https://api.github.com/users/leandrooriente/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leandrooriente/subscriptions","organizations_url":"https://api.github.com/users/leandrooriente/orgs","repos_url":"https://api.github.com/users/leandrooriente/repos","events_url":"https://api.github.com/users/leandrooriente/events{/privacy}","received_events_url":"https://api.github.com/users/leandrooriente/received_events","type":"User","site_admin":false},"created_at":"2016-09-14T18:44:13Z","updated_at":"2016-09-14T18:44:13Z","body":"## Google Maps fitBounds params: \r\nhttps://developers.google.com/maps/documentation/javascript/reference#LatLngBounds\r\n\r\n```\r\nsw?:LatLng|LatLngLiteral,\r\nne?:LatLng|LatLngLiteral\r\n```\r\n\r\nBounds Methods:\r\n\r\n```\r\ngetNorthEast()\r\ngetSouthWest()\r\n```\r\n\r\n## Google Map React fitBounds method: \r\nhttps://github.com/istarkov/google-map-react/blob/master/src/utils/utils.js#L67\r\n\r\n```\r\nfitBounds({ nw, se }, { width, height }) {...\r\n```\r\n\r\n## Workaround \r\n\r\n```\r\n      let bounds = new google.maps.LatLngBounds()\r\n\r\n      nextProps.places.forEach(p => {\r\n        bounds.extend(new google.maps.LatLng(p.lat, p.lng))\r\n      })\r\n\r\n      // WRONG DEFINITION: \r\n      const se = bounds.getNorthEast() // SE --> NE\r\n      const nw = bounds.getSouthWest() // NW --> SW\r\n      const { center, zoom } = fitBounds({\r\n        se: { lat: se.lat(), lng: se.lng() },\r\n        nw: { lat: nw.lat(), lng: nw.lng() }\r\n      }, { width: 777, height: 225 })\r\n\r\n      this.setState({ center, zoom: 14 })\r\n```"}}
{"actor":{"display_login":"leandrooriente"}}