diff --git a/src/objectliterals.jsdoc b/src/objectliterals.jsdoc index 622a98a221..71636f4f7c 100644 --- a/src/objectliterals.jsdoc +++ b/src/objectliterals.jsdoc @@ -25,6 +25,9 @@ * @typedef {Object} olx.MapOptions * @property {ol.Collection|Array.|undefined} controls * Controls initially added to the map. + * @property {number|undefined} devicePixelRatio The ratio between physical + * pixels and device-independent pixels (dips) on the device. If `undefined` + * then it gets set by using `window.devicePixelRatio`. * @property {ol.Collection|Array.|undefined} interactions * Interactions that are initially added to the map. * @property {Array.|ol.Collection|undefined} layers Layers. diff --git a/src/ol/map.js b/src/ol/map.js index 1019341a02..797451b7a5 100644 --- a/src/ol/map.js +++ b/src/ol/map.js @@ -157,6 +157,13 @@ ol.Map = function(options) { var optionsInternal = ol.Map.createOptionsInternal(options); + /** + * @private + * @type {number} + */ + this.devicePixelRatio_ = goog.isDef(options.devicePixelRatio) ? + options.devicePixelRatio : ol.BrowserFeature.DEVICE_PIXEL_RATIO; + /** * @private * @type {goog.async.AnimationDelay}