Closed cmtt closed 11 years ago
Cool with the direction of this pull request but there are a few issues:
Function.bind
implementation with this mapping library. Bind also should not be necessary: the handlers use scope, not this
.handler
variable, not this
.getHandler: function (id, mHandler) {
, not getHandler : function (id, mHandler) {
Thanks for the heads up, the pull request was changed accordingly
A multiplication seems to be a tiny bit faster than a division in a few Gecko browsers, so I changed every "/ 2" to "* 0.5", have a look at: http://jsperf.com/multiply-vs-division
Despite that, this pull request allows event handlers to be de-/attached, removed and added back. In case of MouseWheelHandler, I have re-introduced a bind method (as a polyfill from MDN for old and beloved browsers) due to the _zoomDiv variable. Also, it was necessary to expose MouseHandler's handlers again.
Event handlers must have an id string, otherwise, the following new methods cannot determine what you'd refer to.
map.getHandler({String} id); map.disableHandler({String} id); map.enableHandler({String} id); map.removeHandler({String} id); map.addHandler({Function} handler);