{"action":"closed","issue":{"url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/6137","repository_url":"https://api.github.com/repos/mapbox/mapbox-gl-js","labels_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/6137/labels{/name}","comments_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/6137/comments","events_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/6137/events","html_url":"https://github.com/mapbox/mapbox-gl-js/issues/6137","id":296656169,"number":6137,"title":"Update ScaleControl unit of distance on the fly","user":{"login":"ryanhamley","id":4523080,"avatar_url":"https://avatars1.githubusercontent.com/u/4523080?v=4","gravatar_id":"","url":"https://api.github.com/users/ryanhamley","html_url":"https://github.com/ryanhamley","followers_url":"https://api.github.com/users/ryanhamley/followers","following_url":"https://api.github.com/users/ryanhamley/following{/other_user}","gists_url":"https://api.github.com/users/ryanhamley/gists{/gist_id}","starred_url":"https://api.github.com/users/ryanhamley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryanhamley/subscriptions","organizations_url":"https://api.github.com/users/ryanhamley/orgs","repos_url":"https://api.github.com/users/ryanhamley/repos","events_url":"https://api.github.com/users/ryanhamley/events{/privacy}","received_events_url":"https://api.github.com/users/ryanhamley/received_events","type":"User","site_admin":false},"labels":[{"id":31015438,"url":"https://api.github.com/repos/mapbox/mapbox-gl-js/labels/feature%20:green_apple:","name":"feature :green_apple:","color":"c5def5","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-02-13T08:50:12Z","updated_at":"2018-04-18T17:14:55Z","closed_at":"2018-04-18T17:14:55Z","author_association":"NONE","body":"## Motivation\r\n\r\n<!--\r\nWhat problem are we trying to solve?\r\nWhat use cases are we trying to accommodate?\r\n(Focus on the problem and save design ideas for the next section.)\r\n-->\r\nIt should be possible to programatically change the ScaleControl's unit of distance and have the ScaleControl instantly update. This is helpful for applications that may need to show scale's in different units based on a site's location.\r\n\r\n## Design Alternatives\r\n\r\n<!--\r\nHow could we accommodate the use cases above?\r\nIs \"do nothing\" an option?\r\n-->\r\n\r\nYou could remove the scale and add it back when you want to change the unit.\r\n\r\nAlternatively, you could provide a method to update the scale's internal unit and update the scale.\r\n\r\n## Design\r\n\r\n<!--\r\nWhich design should we implement?\r\nWhat are the advantages of this design?\r\nWhat are some potential drawbacks of this design?\r\n-->\r\n\r\nRemoving and re-adding the control is inefficient and can result in layout issues if multiple controls are in the same container. Updating the internal unit is fairly straightforward and only requires calling the existing `updateScale` method. I believe exposing this method is the proper way to achieve this goal.\r\n\r\n### Mock-Up\r\n\r\n<!--\r\nWhat will this design look like to developers?\r\nWhat will this design look like to end users?\r\n-->\r\n\r\nN/A\r\n\r\n### Concepts\r\n\r\n<!--\r\nHow will we teach this design?\r\nWhat terminology will work best for the new concepts introduced by this design?\r\nWhat existing precedents support the new concepts?\r\nWhere do the concepts set new precedents?\r\n-->\r\n\r\nN/A\r\n\r\n### Implementation\r\n\r\n<!--\r\nHow you would implement the design in Javascript?\r\nHow you would implement the design in C++?\r\nWhat parts of the Mapbox GL ecosystem will need to change to accomodate this design?\r\nAre there any important edge cases?\r\n-->\r\n\r\nProposed [pull request here](https://github.com/mapbox/mapbox-gl-js/pull/6138)"}}
{"actor":{"display_login":"jfirebaugh"}}