{"action":"created","issue":{"url":"https://api.github.com/repos/OpenGeoscience/geojs/issues/467","labels_url":"https://api.github.com/repos/OpenGeoscience/geojs/issues/467/labels{/name}","comments_url":"https://api.github.com/repos/OpenGeoscience/geojs/issues/467/comments","events_url":"https://api.github.com/repos/OpenGeoscience/geojs/issues/467/events","html_url":"https://github.com/OpenGeoscience/geojs/pull/467","id":118093823,"number":467,"title":"Discrete zoom and mouse event throttling","user":{"login":"jbeezley","id":31890,"avatar_url":"https://avatars.githubusercontent.com/u/31890?v=3","gravatar_id":"","url":"https://api.github.com/users/jbeezley","html_url":"https://github.com/jbeezley","followers_url":"https://api.github.com/users/jbeezley/followers","following_url":"https://api.github.com/users/jbeezley/following{/other_user}","gists_url":"https://api.github.com/users/jbeezley/gists{/gist_id}","starred_url":"https://api.github.com/users/jbeezley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbeezley/subscriptions","organizations_url":"https://api.github.com/users/jbeezley/orgs","repos_url":"https://api.github.com/users/jbeezley/repos","events_url":"https://api.github.com/users/jbeezley/events{/privacy}","received_events_url":"https://api.github.com/users/jbeezley/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-11-20T18:03:37Z","updated_at":"2015-11-23T20:55:55Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/OpenGeoscience/geojs/pulls/467","html_url":"https://github.com/OpenGeoscience/geojs/pull/467","diff_url":"https://github.com/OpenGeoscience/geojs/pull/467.diff","patch_url":"https://github.com/OpenGeoscience/geojs/pull/467.patch"},"body":"This adds new utility methods for throttling and debouncing functions.  These methods are used in the map interactor to throttle all mouse events to improve rendering performance.  In addition, zoom events are debounced to fix discrete zooming on touch devices, which fire small continuous scroll events rather than large discrete events like a traditional mouse wheel.\r\n\r\nThe interaction with discrete zooming isn't great for a couple of reasons.\r\n\r\n1.  There is a significant delay that occurs while the map is rendering\r\n2.  There is no indication that the zoom is doing anything at intermediate values\r\n\r\nIt may help to implement a \"snap to discrete values\" feature, but that is out of scope of this PR.  You can try the new behavior at the following link.\r\n\r\nhttp://jsbin.com/feduco/3"},"comment":{"url":"https://api.github.com/repos/OpenGeoscience/geojs/issues/comments/159061631","html_url":"https://github.com/OpenGeoscience/geojs/pull/467#issuecomment-159061631","issue_url":"https://api.github.com/repos/OpenGeoscience/geojs/issues/467","id":159061631,"user":{"login":"jbeezley","id":31890,"avatar_url":"https://avatars.githubusercontent.com/u/31890?v=3","gravatar_id":"","url":"https://api.github.com/users/jbeezley","html_url":"https://github.com/jbeezley","followers_url":"https://api.github.com/users/jbeezley/followers","following_url":"https://api.github.com/users/jbeezley/following{/other_user}","gists_url":"https://api.github.com/users/jbeezley/gists{/gist_id}","starred_url":"https://api.github.com/users/jbeezley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbeezley/subscriptions","organizations_url":"https://api.github.com/users/jbeezley/orgs","repos_url":"https://api.github.com/users/jbeezley/repos","events_url":"https://api.github.com/users/jbeezley/events{/privacy}","received_events_url":"https://api.github.com/users/jbeezley/received_events","type":"User","site_admin":false},"created_at":"2015-11-23T20:55:55Z","updated_at":"2015-11-23T20:55:55Z","body":"> I would think that 400 ms is too long as in general the default is 200ms but I wouldn't know until I look into this some more.\r\n\r\nI don't think this particular value makes much difference, it only determines when the remainder is thrown away.\r\n\r\nI just looked at what [Leaflet](http://leafletjs.com/) does.  It seems to be very similar to what I have done here.  The difference is that the leaflet renderer is far more responsive than ours.  By this I mean it starts the redraw almost immediately.  GeoJS seems to get \"choppy\" and the rendering freezes.  I did a profile and it looks like the method [here](https://github.com/OpenGeoscience/geojs/blob/master/src/gl/planeFeature.js#L114) is blocking everything.  In the screenshot below, it blocks the main thread for over 3/4 of a second:\r\n\r\n![screen shot 2015-11-23 at 3 53 15 pm](https://cloud.githubusercontent.com/assets/31890/11349516/9cb7f33a-91fa-11e5-9a95-53b3fbf4c565.png)\r\n"}}