Merge pull request #7433 from fredj/hints

Don't use getHints if it's not needed
This commit is contained in:
Frédéric Junod
2017-11-08 14:46:31 +01:00
committed by GitHub
3 changed files with 5 additions and 6 deletions

View File

@@ -151,7 +151,7 @@ ol.interaction.DragPan.handleDownEvent_ = function(mapBrowserEvent) {
view.setHint(ol.ViewHint.INTERACTING, 1);
}
// stop any current animation
if (view.getHints()[ol.ViewHint.ANIMATING]) {
if (view.getAnimating()) {
view.setCenter(mapBrowserEvent.frameState.viewState.center);
}
if (this.kinetic_) {

View File

@@ -6,7 +6,6 @@ goog.require('ol.CollectionEventType');
goog.require('ol.Feature');
goog.require('ol.MapBrowserEventType');
goog.require('ol.MapBrowserPointerEvent');
goog.require('ol.ViewHint');
goog.require('ol.array');
goog.require('ol.coordinate');
goog.require('ol.events');
@@ -804,7 +803,7 @@ ol.interaction.Modify.handleEvent = function(mapBrowserEvent) {
this.lastPointerEvent_ = mapBrowserEvent;
var handled;
if (!mapBrowserEvent.map.getView().getHints()[ol.ViewHint.INTERACTING] &&
if (!mapBrowserEvent.map.getView().getInteracting() &&
mapBrowserEvent.type == ol.MapBrowserEventType.POINTERMOVE &&
!this.handlingDownUpSequence) {
this.handlePointerMove_(mapBrowserEvent);

View File

@@ -341,7 +341,7 @@ ol.View.prototype.animate = function(var_args) {
* @api
*/
ol.View.prototype.getAnimating = function() {
return this.getHints()[ol.ViewHint.ANIMATING] > 0;
return this.hints_[ol.ViewHint.ANIMATING] > 0;
};
@@ -351,7 +351,7 @@ ol.View.prototype.getAnimating = function() {
* @api
*/
ol.View.prototype.getInteracting = function() {
return this.getHints()[ol.ViewHint.INTERACTING] > 0;
return this.hints_[ol.ViewHint.INTERACTING] > 0;
};
@@ -360,7 +360,7 @@ ol.View.prototype.getInteracting = function() {
* @api
*/
ol.View.prototype.cancelAnimations = function() {
this.setHint(ol.ViewHint.ANIMATING, -this.getHints()[ol.ViewHint.ANIMATING]);
this.setHint(ol.ViewHint.ANIMATING, -this.hints_[ol.ViewHint.ANIMATING]);
for (var i = 0, ii = this.animations_.length; i < ii; ++i) {
var series = this.animations_[i];
if (series[0].callback) {