Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f515c86f54 | ||
|
|
87eaa1fba4 | ||
|
|
032ce16519 | ||
|
|
ea190e2009 | ||
|
|
fbd954ac7c | ||
|
|
676dda7ca6 | ||
|
|
186935c147 | ||
|
|
8e35b7a1ad | ||
|
|
0c159cf0f7 |
11
changelog/v4.0.1.md
Normal file
11
changelog/v4.0.1.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# 4.0.1
|
||||
|
||||
## Summary
|
||||
|
||||
The v4.0.1 release is a patch release that addresses a regression in the v4.0.0 release. The fix makes pinch zooming work again properly when the two fingers are not placed on the screen at the same time.
|
||||
|
||||
See the [v4.0.0 release notes](https://github.com/openlayers/openlayers/releases/tag/v4.0.0) for details on upgrading from v3.20.x.
|
||||
|
||||
## Fix
|
||||
|
||||
* [#6486](https://github.com/openlayers/openlayers/pull/6486) - Do not set center when touches count has changed ([@ahocevar](https://github.com/ahocevar))
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "openlayers",
|
||||
"version": "4.0.0",
|
||||
"version": "4.0.1",
|
||||
"description": "Build tools and sources for developing OpenLayers based mapping applications",
|
||||
"keywords": [
|
||||
"map",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ol",
|
||||
"version": "3.21.0-beta.17",
|
||||
"version": "4.0.1-beta.1",
|
||||
"description": "OpenLayers as ES2015 modules",
|
||||
"main": "index.js",
|
||||
"module": "index.js",
|
||||
|
||||
@@ -39,6 +39,11 @@ ol.interaction.DragPan = function(opt_options) {
|
||||
*/
|
||||
this.lastCentroid = null;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
this.lastPointersCount_;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {ol.EventsConditionType}
|
||||
@@ -62,25 +67,33 @@ 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);
|
||||
if (this.kinetic_) {
|
||||
this.kinetic_.update(centroid[0], centroid[1]);
|
||||
}
|
||||
if (this.lastCentroid) {
|
||||
var deltaX = this.lastCentroid[0] - centroid[0];
|
||||
var deltaY = centroid[1] - this.lastCentroid[1];
|
||||
var map = mapBrowserEvent.map;
|
||||
var view = map.getView();
|
||||
var viewState = view.getState();
|
||||
var center = [deltaX, deltaY];
|
||||
ol.coordinate.scale(center, viewState.resolution);
|
||||
ol.coordinate.rotate(center, viewState.rotation);
|
||||
ol.coordinate.add(center, viewState.center);
|
||||
center = view.constrainCenter(center);
|
||||
view.setCenter(center);
|
||||
ol.interaction.Pointer.centroid(targetPointers);
|
||||
if (targetPointers.length == this.lastPointersCount_) {
|
||||
if (this.kinetic_) {
|
||||
this.kinetic_.update(centroid[0], centroid[1]);
|
||||
}
|
||||
if (this.lastCentroid) {
|
||||
var deltaX = this.lastCentroid[0] - centroid[0];
|
||||
var deltaY = centroid[1] - this.lastCentroid[1];
|
||||
var map = mapBrowserEvent.map;
|
||||
var view = map.getView();
|
||||
var viewState = view.getState();
|
||||
var center = [deltaX, deltaY];
|
||||
ol.coordinate.scale(center, viewState.resolution);
|
||||
ol.coordinate.rotate(center, viewState.rotation);
|
||||
ol.coordinate.add(center, viewState.center);
|
||||
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