Fix HTML Canvas typing issues

This commit is contained in:
Frederic Junod
2018-05-09 15:46:39 +02:00
parent db54301514
commit cdb3e1c529
2 changed files with 3 additions and 3 deletions

View File

@@ -94,7 +94,7 @@ ImageCanvas.prototype.load = function() {
/** /**
* @inheritDoc * @return {HTMLCanvasElement} Canvas element.
*/ */
ImageCanvas.prototype.getImage = function() { ImageCanvas.prototype.getImage = function() {
return this.canvas_; return this.canvas_;

View File

@@ -10,14 +10,14 @@
* @return {CanvasRenderingContext2D} The context. * @return {CanvasRenderingContext2D} The context.
*/ */
export function createCanvasContext2D(opt_width, opt_height) { export function createCanvasContext2D(opt_width, opt_height) {
const canvas = document.createElement('CANVAS'); const canvas = /** @type {HTMLCanvasElement} */ (document.createElement('CANVAS'));
if (opt_width) { if (opt_width) {
canvas.width = opt_width; canvas.width = opt_width;
} }
if (opt_height) { if (opt_height) {
canvas.height = opt_height; canvas.height = opt_height;
} }
return canvas.getContext('2d'); return /** @type {CanvasRenderingContext2D} */ (canvas.getContext('2d'));
} }