Make map's deviceOptions map options
This removes the map's deviceOptions config option, and instead introduces loadTilesWhileAnimating and loadTilesWhileInteracting map options. By default, both are false now, to make zooming and panning smoother on most devices.
This commit is contained in:
@@ -165,6 +165,21 @@ ol.Map = function(options) {
|
||||
|
||||
var optionsInternal = ol.Map.createOptionsInternal(options);
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
* @private
|
||||
*/
|
||||
this.loadTilesWhileAnimating_ = goog.isDef(options.loadTilesWhileAnimating) ?
|
||||
options.loadTilesWhileAnimating : false;
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
* @private
|
||||
*/
|
||||
this.loadTilesWhileInteracting_ =
|
||||
goog.isDef(options.loadTilesWhileInteracting) ?
|
||||
options.loadTilesWhileInteracting : false;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
@@ -302,12 +317,6 @@ ol.Map = function(options) {
|
||||
*/
|
||||
this.controls_ = optionsInternal.controls;
|
||||
|
||||
/**
|
||||
* @type {olx.DeviceOptions}
|
||||
* @private
|
||||
*/
|
||||
this.deviceOptions_ = optionsInternal.deviceOptions;
|
||||
|
||||
/**
|
||||
* @type {ol.Collection.<ol.interaction.Interaction>}
|
||||
* @private
|
||||
@@ -915,15 +924,14 @@ ol.Map.prototype.handlePostRender = function() {
|
||||
var tileSourceCount = 0;
|
||||
if (!goog.isNull(frameState)) {
|
||||
var hints = frameState.viewHints;
|
||||
var deviceOptions = this.deviceOptions_;
|
||||
if (hints[ol.ViewHint.ANIMATING]) {
|
||||
maxTotalLoading = deviceOptions.loadTilesWhileAnimating === false ?
|
||||
0 : 8;
|
||||
maxTotalLoading = this.loadTilesWhileAnimating_ === true ?
|
||||
8 : 0;
|
||||
maxNewLoads = 2;
|
||||
}
|
||||
if (hints[ol.ViewHint.INTERACTING]) {
|
||||
maxTotalLoading = deviceOptions.loadTilesWhileInteracting === false ?
|
||||
0 : 8;
|
||||
maxTotalLoading = this.loadTilesWhileInteracting_ === true ?
|
||||
8 : 0;
|
||||
maxNewLoads = 2;
|
||||
}
|
||||
tileSourceCount = goog.object.getCount(frameState.wantedTiles);
|
||||
@@ -1397,7 +1405,6 @@ ol.Map.prototype.unskipFeature = function(feature) {
|
||||
|
||||
/**
|
||||
* @typedef {{controls: ol.Collection.<ol.control.Control>,
|
||||
* deviceOptions: olx.DeviceOptions,
|
||||
* interactions: ol.Collection.<ol.interaction.Interaction>,
|
||||
* keyboardEventTarget: (Element|Document),
|
||||
* logos: Object,
|
||||
@@ -1511,9 +1518,6 @@ ol.Map.createOptionsInternal = function(options) {
|
||||
controls = ol.control.defaults();
|
||||
}
|
||||
|
||||
var deviceOptions = goog.isDef(options.deviceOptions) ?
|
||||
options.deviceOptions : /** @type {olx.DeviceOptions} */ ({});
|
||||
|
||||
var interactions;
|
||||
if (goog.isDef(options.interactions)) {
|
||||
if (goog.isArray(options.interactions)) {
|
||||
@@ -1540,7 +1544,6 @@ ol.Map.createOptionsInternal = function(options) {
|
||||
|
||||
return {
|
||||
controls: controls,
|
||||
deviceOptions: deviceOptions,
|
||||
interactions: interactions,
|
||||
keyboardEventTarget: keyboardEventTarget,
|
||||
logos: logos,
|
||||
|
||||
Reference in New Issue
Block a user