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) {
|
||||
if (this.kinetic_) {
|
||||
this.kinetic_.update(mapBrowserEvent.browserEvent);
|
||||
this.kinetic_.update(
|
||||
mapBrowserEvent.browserEvent.clientX,
|
||||
mapBrowserEvent.browserEvent.clientY);
|
||||
}
|
||||
var map = mapBrowserEvent.map;
|
||||
// FIXME works for View2D only
|
||||
@@ -104,7 +106,7 @@ ol.interaction.DragPan.prototype.handleDragStart = function(mapBrowserEvent) {
|
||||
var browserEvent = mapBrowserEvent.browserEvent;
|
||||
if (this.condition_(browserEvent)) {
|
||||
if (this.kinetic_) {
|
||||
this.kinetic_.begin(browserEvent);
|
||||
this.kinetic_.begin(browserEvent.clientX, browserEvent.clientY);
|
||||
}
|
||||
var map = mapBrowserEvent.map;
|
||||
map.requestRenderFrame();
|
||||
|
||||
@@ -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.angle_ = 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({
|
||||
x: browserEvent.clientX,
|
||||
y: browserEvent.clientY,
|
||||
x: x,
|
||||
y: y,
|
||||
t: goog.now()
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user