Merge pull request #6486 from ahocevar/reset-on-pointer-count-change
Do not set center when touches count has changed
This commit is contained in:
@@ -39,6 +39,11 @@ ol.interaction.DragPan = function(opt_options) {
|
||||
*/
|
||||
this.lastCentroid = null;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
this.lastPointersCount_;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {ol.EventsConditionType}
|
||||
@@ -62,8 +67,10 @@ ol.inherits(ol.interaction.DragPan, ol.interaction.Pointer);
|
||||
* @private
|
||||
*/
|
||||
ol.interaction.DragPan.handleDragEvent_ = function(mapBrowserEvent) {
|
||||
var targetPointers = this.targetPointers;
|
||||
var centroid =
|
||||
ol.interaction.Pointer.centroid(this.targetPointers);
|
||||
ol.interaction.Pointer.centroid(targetPointers);
|
||||
if (targetPointers.length == this.lastPointersCount_) {
|
||||
if (this.kinetic_) {
|
||||
this.kinetic_.update(centroid[0], centroid[1]);
|
||||
}
|
||||
@@ -80,7 +87,13 @@ ol.interaction.DragPan.handleDragEvent_ = function(mapBrowserEvent) {
|
||||
center = view.constrainCenter(center);
|
||||
view.setCenter(center);
|
||||
}
|
||||
} else if (this.kinetic_) {
|
||||
// reset so we don't overestimate the kinetic energy after
|
||||
// after one finger down, tiny drag, second finger down
|
||||
this.kinetic_.begin();
|
||||
}
|
||||
this.lastCentroid = centroid;
|
||||
this.lastPointersCount_ = targetPointers.length;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user