Remove unnecessary type cast
This commit is contained in:
@@ -26,9 +26,8 @@ const styleFunction = function(feature) {
|
|||||||
scale = size / 10;
|
scale = size / 10;
|
||||||
let style = styleCache[size];
|
let style = styleCache[size];
|
||||||
if (!style) {
|
if (!style) {
|
||||||
const canvas = /** @type {HTMLCanvasElement} */ (document.createElement('canvas'));
|
const canvas = document.createElement('canvas');
|
||||||
const vectorContext = toContext(
|
const vectorContext = toContext(canvas.getContext('2d'),
|
||||||
/** @type {CanvasRenderingContext2D} */ (canvas.getContext('2d')),
|
|
||||||
{size: [size, size], pixelRatio: 1});
|
{size: [size, size], pixelRatio: 1});
|
||||||
vectorContext.setStyle(new Style({
|
vectorContext.setStyle(new Style({
|
||||||
fill: new Fill({color: 'rgba(255, 153, 0, 0.4)'}),
|
fill: new Fill({color: 'rgba(255, 153, 0, 0.4)'}),
|
||||||
|
|||||||
@@ -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 = /** @type {HTMLCanvasElement} */ (document.createElement('canvas'));
|
const canvas = 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 /** @type {CanvasRenderingContext2D} */ (canvas.getContext('2d'));
|
return canvas.getContext('2d');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class RenderBox extends Disposable {
|
|||||||
* @type {HTMLDivElement}
|
* @type {HTMLDivElement}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.element_ = /** @type {HTMLDivElement} */ (document.createElement('div'));
|
this.element_ = document.createElement('div');
|
||||||
this.element_.style.position = 'absolute';
|
this.element_.style.position = 'absolute';
|
||||||
this.element_.className = 'ol-box ' + className;
|
this.element_.className = 'ol-box ' + className;
|
||||||
|
|
||||||
|
|||||||
@@ -42,9 +42,7 @@ class IconImage extends EventTarget {
|
|||||||
* @private
|
* @private
|
||||||
* @type {HTMLCanvasElement}
|
* @type {HTMLCanvasElement}
|
||||||
*/
|
*/
|
||||||
this.canvas_ = color ?
|
this.canvas_ = color ? document.createElement('canvas') : null;
|
||||||
/** @type {HTMLCanvasElement} */ (document.createElement('canvas')) :
|
|
||||||
null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
|
|||||||
@@ -323,7 +323,7 @@ let HAS = false;
|
|||||||
//TODO Remove side effects
|
//TODO Remove side effects
|
||||||
if (typeof window !== 'undefined' && 'WebGLRenderingContext' in window) {
|
if (typeof window !== 'undefined' && 'WebGLRenderingContext' in window) {
|
||||||
try {
|
try {
|
||||||
const canvas = /** @type {HTMLCanvasElement} */ (document.createElement('canvas'));
|
const canvas = document.createElement('canvas');
|
||||||
const gl = getContext(canvas);
|
const gl = getContext(canvas);
|
||||||
if (gl) {
|
if (gl) {
|
||||||
HAS = true;
|
HAS = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user