Skip to content

Commit

Permalink
cast type of else statement - might work better with type guard
Browse files Browse the repository at this point in the history
  • Loading branch information
chippieTV committed Jul 25, 2021
1 parent 1642415 commit a5ddac3
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/source/raster_dem_tile_worker_source.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import DEMData from '../data/dem_data';
import {RGBAImage} from '../util/image';
import window from '../util/window';

import type Actor from '../util/actor';
import type {
WorkerDEMTileParameters,
WorkerDEMTileCallback,
TileParameters
} from './worker_source';
const {ImageBitmap} = window;

class RasterDEMTileWorkerSource {
actor: Actor;
Expand All @@ -25,7 +23,7 @@ class RasterDEMTileWorkerSource {
loadTile(params: WorkerDEMTileParameters, callback: WorkerDEMTileCallback) {
const {uid, encoding, rawImageData} = params;
// Main thread will transfer ImageBitmap if offscreen decode with OffscreenCanvas is supported, else it will transfer an already decoded image.
const imagePixels = (ImageBitmap && rawImageData instanceof ImageBitmap) ? this.getImageData(rawImageData) : rawImageData;
const imagePixels = (ImageBitmap && rawImageData instanceof ImageBitmap) ? this.getImageData(rawImageData) : rawImageData as RGBAImage;
const dem = new DEMData(uid, imagePixels, encoding);
this.loaded = this.loaded || {};
this.loaded[uid] = dem;
Expand Down

0 comments on commit a5ddac3

Please sign in to comment.