Merge pull request #179 from fredj/kinetic-update-arg
Change ol.Kinetic.update and begin arguments.
This commit is contained in:
@@ -51,7 +51,9 @@ goog.inherits(ol.interaction.DragPan, ol.interaction.Drag);
|
|||||||
*/
|
*/
|
||||||
ol.interaction.DragPan.prototype.handleDrag = function(mapBrowserEvent) {
|
ol.interaction.DragPan.prototype.handleDrag = function(mapBrowserEvent) {
|
||||||
if (this.kinetic_) {
|
if (this.kinetic_) {
|
||||||
this.kinetic_.update(mapBrowserEvent.browserEvent);
|
this.kinetic_.update(
|
||||||
|
mapBrowserEvent.browserEvent.clientX,
|
||||||
|
mapBrowserEvent.browserEvent.clientY);
|
||||||
}
|
}
|
||||||
var map = mapBrowserEvent.map;
|
var map = mapBrowserEvent.map;
|
||||||
// FIXME works for View2D only
|
// FIXME works for View2D only
|
||||||
@@ -104,7 +106,7 @@ ol.interaction.DragPan.prototype.handleDragStart = function(mapBrowserEvent) {
|
|||||||
var browserEvent = mapBrowserEvent.browserEvent;
|
var browserEvent = mapBrowserEvent.browserEvent;
|
||||||
if (this.condition_(browserEvent)) {
|
if (this.condition_(browserEvent)) {
|
||||||
if (this.kinetic_) {
|
if (this.kinetic_) {
|
||||||
this.kinetic_.begin(browserEvent);
|
this.kinetic_.begin(browserEvent.clientX, browserEvent.clientY);
|
||||||
}
|
}
|
||||||
var map = mapBrowserEvent.map;
|
var map = mapBrowserEvent.map;
|
||||||
map.requestRenderFrame();
|
map.requestRenderFrame();
|
||||||
|
|||||||
+9
-7
@@ -63,23 +63,25 @@ ol.Kinetic = function(decay, minVelocity, delay) {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {goog.events.BrowserEvent} browserEvent Browser event.
|
* @param {number} x X.
|
||||||
|
* @param {number} y Y.
|
||||||
*/
|
*/
|
||||||
ol.Kinetic.prototype.begin = function(browserEvent) {
|
ol.Kinetic.prototype.begin = function(x, y) {
|
||||||
this.points_.length = 0;
|
this.points_.length = 0;
|
||||||
this.angle_ = 0;
|
this.angle_ = 0;
|
||||||
this.initialVelocity_ = 0;
|
this.initialVelocity_ = 0;
|
||||||
this.update(browserEvent);
|
this.update(x, y);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {goog.events.BrowserEvent} browserEvent Browser event.
|
* @param {number} x X.
|
||||||
|
* @param {number} y Y.
|
||||||
*/
|
*/
|
||||||
ol.Kinetic.prototype.update = function(browserEvent) {
|
ol.Kinetic.prototype.update = function(x, y) {
|
||||||
this.points_.push({
|
this.points_.push({
|
||||||
x: browserEvent.clientX,
|
x: x,
|
||||||
y: browserEvent.clientY,
|
y: y,
|
||||||
t: goog.now()
|
t: goog.now()
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user