rely on registerDisposable
This commit is contained in:
+2
-9
@@ -108,13 +108,6 @@ ol.Map = function() {
|
|||||||
* @type {Element}
|
* @type {Element}
|
||||||
*/
|
*/
|
||||||
this.container_ = null;
|
this.container_ = null;
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
* @type {ol.handler.Drag}
|
|
||||||
*/
|
|
||||||
this.dragHandler_ = null;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
goog.inherits(ol.Map, goog.events.EventTarget);
|
goog.inherits(ol.Map, goog.events.EventTarget);
|
||||||
|
|
||||||
@@ -472,7 +465,8 @@ ol.Map.prototype.setViewport = function() {
|
|||||||
'class': 'ol-viewport',
|
'class': 'ol-viewport',
|
||||||
'style': 'width:100%;height:100%;top:0;left:0;position:relative;overflow:hidden'
|
'style': 'width:100%;height:100%;top:0;left:0;position:relative;overflow:hidden'
|
||||||
}));
|
}));
|
||||||
this.dragHandler_ = new ol.handler.Drag(this, this.viewport_);
|
var dragHandler = new ol.handler.Drag(this, this.viewport_);
|
||||||
|
this.registerDisposable(dragHandler);
|
||||||
}
|
}
|
||||||
goog.dom.appendChild(this.container_, this.viewport_);
|
goog.dom.appendChild(this.container_, this.viewport_);
|
||||||
};
|
};
|
||||||
@@ -545,7 +539,6 @@ ol.Map.prototype.disposeInternal = function() {
|
|||||||
for (var key in this) {
|
for (var key in this) {
|
||||||
delete this[key];
|
delete this[key];
|
||||||
}
|
}
|
||||||
this.dragHandler_.dispose();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,8 +12,10 @@ goog.require('goog.Disposable');
|
|||||||
*/
|
*/
|
||||||
ol.handler.Drag = function(map, elt) {
|
ol.handler.Drag = function(map, elt) {
|
||||||
|
|
||||||
this.dragger_ = new goog.fx.Dragger(elt);
|
var dragger = new goog.fx.Dragger(elt);
|
||||||
this.dragger_.defaultAction = function() {};
|
this.registerDisposable(dragger);
|
||||||
|
|
||||||
|
dragger.defaultAction = function() {};
|
||||||
|
|
||||||
var prevX = 0, prevY = 0;
|
var prevX = 0, prevY = 0;
|
||||||
|
|
||||||
@@ -44,11 +46,11 @@ ol.handler.Drag = function(map, elt) {
|
|||||||
goog.events.dispatchEvent(map, newE);
|
goog.events.dispatchEvent(map, newE);
|
||||||
};
|
};
|
||||||
|
|
||||||
goog.events.listen(this.dragger_, goog.fx.Dragger.EventType.START,
|
goog.events.listen(dragger, goog.fx.Dragger.EventType.START,
|
||||||
handleDragStart, false, this);
|
handleDragStart, false, this);
|
||||||
goog.events.listen(this.dragger_, goog.fx.Dragger.EventType.DRAG,
|
goog.events.listen(dragger, goog.fx.Dragger.EventType.DRAG,
|
||||||
handleDrag, false, this);
|
handleDrag, false, this);
|
||||||
goog.events.listen(this.dragger_, goog.fx.Dragger.EventType.END,
|
goog.events.listen(dragger, goog.fx.Dragger.EventType.END,
|
||||||
handleDragEnd, false, this);
|
handleDragEnd, false, this);
|
||||||
};
|
};
|
||||||
goog.inherits(ol.handler.Drag, goog.Disposable);
|
goog.inherits(ol.handler.Drag, goog.Disposable);
|
||||||
|
|||||||
Reference in New Issue
Block a user