Change 'Image' type to 'HTMLImageElement'

This commit is contained in:
Frederic Junod
2018-06-28 13:44:09 +02:00
parent 52e286b03c
commit 0c300d651f
12 changed files with 22 additions and 22 deletions
+3 -3
View File
@@ -29,7 +29,7 @@ import ImageStyle from '../style/Image.js';
* @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that you must provide a
* `crossOrigin` value if you are using the WebGL renderer or if you want to access pixel data with the Canvas renderer.
* See {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image} for more detail.
* @property {Image|HTMLCanvasElement} [img] Image object for the icon. If the `src` option is not provided then the
* @property {HTMLImageElement|HTMLCanvasElement} [img] Image object for the icon. If the `src` option is not provided then the
* provided image must already be loaded. And in that case, it is required
* to provide the size of the image, with the `imgSize` option.
* @property {Array.<number>} [offset=[0, 0]] Offset, which, together with the size and the offset origin, define the
@@ -106,7 +106,7 @@ const Icon = function(opt_options) {
options.crossOrigin !== undefined ? options.crossOrigin : null;
/**
* @type {Image|HTMLCanvasElement}
* @type {HTMLImageElement|HTMLCanvasElement}
*/
const image = options.img !== undefined ? options.img : null;
@@ -299,7 +299,7 @@ Icon.prototype.getColor = function() {
/**
* Get the image icon.
* @param {number} pixelRatio Pixel ratio.
* @return {Image|HTMLCanvasElement} Image or Canvas element.
* @return {HTMLImageElement|HTMLCanvasElement} Image or Canvas element.
* @override
* @api
*/
+6 -6
View File
@@ -11,7 +11,7 @@ import {shared as iconImageCache} from '../style/IconImageCache.js';
/**
* @constructor
* @param {Image|HTMLCanvasElement} image Image.
* @param {HTMLImageElement|HTMLCanvasElement} image Image.
* @param {string|undefined} src Src.
* @param {module:ol/size~Size} size Size.
* @param {?string} crossOrigin Cross origin.
@@ -25,13 +25,13 @@ const IconImage = function(image, src, size, crossOrigin, imageState, color) {
/**
* @private
* @type {Image|HTMLCanvasElement}
* @type {HTMLImageElement|HTMLCanvasElement}
*/
this.hitDetectionImage_ = null;
/**
* @private
* @type {Image|HTMLCanvasElement}
* @type {HTMLImageElement|HTMLCanvasElement}
*/
this.image_ = !image ? new Image() : image;
@@ -92,7 +92,7 @@ inherits(IconImage, EventTarget);
/**
* @param {Image|HTMLCanvasElement} image Image.
* @param {HTMLImageElement|HTMLCanvasElement} image Image.
* @param {string} src Src.
* @param {module:ol/size~Size} size Size.
* @param {?string} crossOrigin Cross origin.
@@ -161,7 +161,7 @@ IconImage.prototype.handleImageLoad_ = function() {
/**
* @param {number} pixelRatio Pixel ratio.
* @return {Image|HTMLCanvasElement} Image or Canvas element.
* @return {HTMLImageElement|HTMLCanvasElement} Image or Canvas element.
*/
IconImage.prototype.getImage = function(pixelRatio) {
return this.canvas_ ? this.canvas_ : this.image_;
@@ -178,7 +178,7 @@ IconImage.prototype.getImageState = function() {
/**
* @param {number} pixelRatio Pixel ratio.
* @return {Image|HTMLCanvasElement} Image element.
* @return {HTMLImageElement|HTMLCanvasElement} Image element.
*/
IconImage.prototype.getHitDetectionImage = function(pixelRatio) {
if (!this.hitDetectionImage_) {
+2 -2
View File
@@ -122,7 +122,7 @@ ImageStyle.prototype.getAnchor = function() {};
* Get the image element for the symbolizer.
* @abstract
* @param {number} pixelRatio Pixel ratio.
* @return {HTMLCanvasElement|HTMLVideoElement|Image} Image element.
* @return {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement} Image element.
*/
ImageStyle.prototype.getImage = function(pixelRatio) {};
@@ -130,7 +130,7 @@ ImageStyle.prototype.getImage = function(pixelRatio) {};
/**
* @abstract
* @param {number} pixelRatio Pixel ratio.
* @return {HTMLCanvasElement|HTMLVideoElement|Image} Image element.
* @return {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement} Image element.
*/
ImageStyle.prototype.getHitDetectionImage = function(pixelRatio) {};