diff --git a/src/objectliterals.jsdoc b/src/objectliterals.jsdoc
index e26100a3b2..c57fc51ad8 100644
--- a/src/objectliterals.jsdoc
+++ b/src/objectliterals.jsdoc
@@ -6,6 +6,13 @@
* @todo stability experimental
*/
+/**
+ * @typedef {Object} olx.DeviceOptions
+ * @property {boolean|undefined} loadTilesWhileAnimating When set to false, no tiles will be loaded while animating, which improves responsiveness on devices with slow memory. Default is `true`.
+ * @property {boolean|undefined} loadTilesWhileInteracting When set to false, no tiles will be loaded while interacting, which improves responsiveness on devices with slow memory. Default is `true`.
+ * @todo stability experimental
+ */
+
/**
* @typedef {Object} olx.DeviceOrientationOptions
* @property {boolean|undefined} tracking Start tracking. Default is `false`.
@@ -25,6 +32,8 @@
* @typedef {Object} olx.MapOptions
* @property {ol.Collection|Array.
|undefined} controls
* Controls initially added to the map.
+ * @property {olx.DeviceOptions|undefined} deviceOptions
+ * Device options for the map.
* @property {number|undefined} pixelRatio The ratio between physical
* pixels and device-independent pixels (dips) on the device. If `undefined`
* then it gets set by using `window.devicePixelRatio`.
diff --git a/src/ol/map.js b/src/ol/map.js
index 7d24ae58c6..082e23b3c6 100644
--- a/src/ol/map.js
+++ b/src/ol/map.js
@@ -311,6 +311,12 @@ ol.Map = function(options) {
*/
this.controls_ = optionsInternal.controls;
+ /**
+ * @type {olx.DeviceOptions}
+ * @private
+ */
+ this.deviceOptions_ = optionsInternal.deviceOptions;
+
/**
* @type {ol.Collection}
* @private
@@ -827,8 +833,15 @@ ol.Map.prototype.handlePostRender = function() {
var tileSourceCount = 0;
if (!goog.isNull(frameState)) {
var hints = frameState.viewHints;
- if (hints[ol.ViewHint.ANIMATING] || hints[ol.ViewHint.INTERACTING]) {
- maxTotalLoading = 8;
+ var deviceOptions = this.deviceOptions_;
+ if (hints[ol.ViewHint.ANIMATING]) {
+ maxTotalLoading = deviceOptions.loadTilesWhileAnimating === false ?
+ 0 : 8;
+ maxNewLoads = 2;
+ }
+ if (hints[ol.ViewHint.INTERACTING]) {
+ maxTotalLoading = deviceOptions.loadTilesWhileInteracting === false ?
+ 0 : 8;
maxNewLoads = 2;
}
tileSourceCount = goog.object.getCount(frameState.wantedTiles);
@@ -1316,6 +1329,7 @@ ol.Map.prototype.withFrozenRendering = function(f, opt_this) {
/**
* @typedef {{controls: ol.Collection,
+ * deviceOptions: olx.DeviceOptions,
* interactions: ol.Collection,
* keyboardEventTarget: (Element|Document),
* ol3Logo: boolean,
@@ -1416,6 +1430,9 @@ 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)) {
@@ -1442,6 +1459,7 @@ ol.Map.createOptionsInternal = function(options) {
return {
controls: controls,
+ deviceOptions: deviceOptions,
interactions: interactions,
keyboardEventTarget: keyboardEventTarget,
ol3Logo: ol3Logo,