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;
|
this.lastCentroid = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {number}
|
||||||
|
*/
|
||||||
|
this.lastPointersCount_;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {ol.EventsConditionType}
|
* @type {ol.EventsConditionType}
|
||||||
@@ -62,8 +67,10 @@ ol.inherits(ol.interaction.DragPan, ol.interaction.Pointer);
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ol.interaction.DragPan.handleDragEvent_ = function(mapBrowserEvent) {
|
ol.interaction.DragPan.handleDragEvent_ = function(mapBrowserEvent) {
|
||||||
|
var targetPointers = this.targetPointers;
|
||||||
var centroid =
|
var centroid =
|
||||||
ol.interaction.Pointer.centroid(this.targetPointers);
|
ol.interaction.Pointer.centroid(targetPointers);
|
||||||
|
if (targetPointers.length == this.lastPointersCount_) {
|
||||||
if (this.kinetic_) {
|
if (this.kinetic_) {
|
||||||
this.kinetic_.update(centroid[0], centroid[1]);
|
this.kinetic_.update(centroid[0], centroid[1]);
|
||||||
}
|
}
|
||||||
@@ -80,7 +87,13 @@ ol.interaction.DragPan.handleDragEvent_ = function(mapBrowserEvent) {
|
|||||||
center = view.constrainCenter(center);
|
center = view.constrainCenter(center);
|
||||||
view.setCenter(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.lastCentroid = centroid;
|
||||||
|
this.lastPointersCount_ = targetPointers.length;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user