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
+1 -1
View File
@@ -151,7 +151,7 @@ ol.interaction.DragPan.handleDownEvent_ = function(mapBrowserEvent) {
view.setHint(ol.ViewHint.INTERACTING, 1); view.setHint(ol.ViewHint.INTERACTING, 1);
} }
// stop any current animation // stop any current animation
if (view.getHints()[ol.ViewHint.ANIMATING]) { if (view.getAnimating()) {
view.setCenter(mapBrowserEvent.frameState.viewState.center); view.setCenter(mapBrowserEvent.frameState.viewState.center);
} }
if (this.kinetic_) { if (this.kinetic_) {
+1 -2
View File
@@ -6,7 +6,6 @@ goog.require('ol.CollectionEventType');
goog.require('ol.Feature'); goog.require('ol.Feature');
goog.require('ol.MapBrowserEventType'); goog.require('ol.MapBrowserEventType');
goog.require('ol.MapBrowserPointerEvent'); goog.require('ol.MapBrowserPointerEvent');
goog.require('ol.ViewHint');
goog.require('ol.array'); goog.require('ol.array');
goog.require('ol.coordinate'); goog.require('ol.coordinate');
goog.require('ol.events'); goog.require('ol.events');
@@ -804,7 +803,7 @@ ol.interaction.Modify.handleEvent = function(mapBrowserEvent) {
this.lastPointerEvent_ = mapBrowserEvent; this.lastPointerEvent_ = mapBrowserEvent;
var handled; var handled;
if (!mapBrowserEvent.map.getView().getHints()[ol.ViewHint.INTERACTING] && if (!mapBrowserEvent.map.getView().getInteracting() &&
mapBrowserEvent.type == ol.MapBrowserEventType.POINTERMOVE && mapBrowserEvent.type == ol.MapBrowserEventType.POINTERMOVE &&
!this.handlingDownUpSequence) { !this.handlingDownUpSequence) {
this.handlePointerMove_(mapBrowserEvent); this.handlePointerMove_(mapBrowserEvent);
+3 -3
View File
@@ -341,7 +341,7 @@ ol.View.prototype.animate = function(var_args) {
* @api * @api
*/ */
ol.View.prototype.getAnimating = function() { 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 * @api
*/ */
ol.View.prototype.getInteracting = function() { 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 * @api
*/ */
ol.View.prototype.cancelAnimations = function() { 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) { for (var i = 0, ii = this.animations_.length; i < ii; ++i) {
var series = this.animations_[i]; var series = this.animations_[i];
if (series[0].callback) { if (series[0].callback) {