small handlers refactoring

This commit is contained in:
Mourner 2011-03-28 15:39:02 +03:00
parent 94ab90ae2f
commit a69cb4df15
4 changed files with 5 additions and 7 deletions

View File

@ -3,9 +3,8 @@
*/
L.Handler = L.Class.extend({
initialize: function(map, enabled) {
initialize: function(map) {
this._map = map;
if (enabled) { this.enable(); }
},
enabled: function() {

View File

@ -3,11 +3,10 @@
*/
L.Handler.ShiftDragZoom = L.Handler.extend({
initialize: function(map, enabled) {
initialize: function(map) {
this._map = map;
this._container = map._container;
this._pane = map._panes.overlayPane;
L.Handler.prototype.initialize.apply(this, arguments);
},
enable: function() {

View File

@ -3,7 +3,6 @@
*/
L.Handler.TouchZoom = L.Handler.extend({
enable: function() {
if (!L.Browser.mobileWebkit || this._enabled) { return; }
L.DomEvent.addListener(this._map._container, 'touchstart', this._onTouchStart, this);

View File

@ -365,7 +365,8 @@ L.Map = L.Class.extend({
};
for (var i in handlers) {
if (handlers.hasOwnProperty(i) && handlers[i]) {
this[i] = new handlers[i](this, this.options[i]);
this[i] = new handlers[i](this);
if (this.options[i]) this[i].enable();
}
}
},