Replace RasterOperationType enum with typedef

This commit is contained in:
Maximilian Krög
2022-07-24 17:51:19 +02:00
parent 2caa071a08
commit 14c2c31d4c

View File

@@ -450,13 +450,9 @@ const RasterEventType = {
}; };
/** /**
* @typedef {'pixel' | 'image'} RasterOperationType
* Raster operation type. Supported values are `'pixel'` and `'image'`. * Raster operation type. Supported values are `'pixel'` and `'image'`.
* @enum {string}
*/ */
const RasterOperationType = {
PIXEL: 'pixel',
IMAGE: 'image',
};
/** /**
* @typedef {import("./Image.js").ImageSourceEventTypes|'beforeoperations'|'afteroperations'} RasterSourceEventTypes * @typedef {import("./Image.js").ImageSourceEventTypes|'beforeoperations'|'afteroperations'} RasterSourceEventTypes
@@ -575,9 +571,7 @@ class RasterSource extends ImageSource {
* @type {RasterOperationType} * @type {RasterOperationType}
*/ */
this.operationType_ = this.operationType_ =
options.operationType !== undefined options.operationType !== undefined ? options.operationType : 'pixel';
? options.operationType
: RasterOperationType.PIXEL;
/** /**
* @private * @private
@@ -692,7 +686,7 @@ class RasterSource extends ImageSource {
this.processor_ = new Processor({ this.processor_ = new Processor({
operation: operation, operation: operation,
imageOps: this.operationType_ === RasterOperationType.IMAGE, imageOps: this.operationType_ === 'image',
queue: 1, queue: 1,
lib: opt_lib, lib: opt_lib,
threads: this.threads_, threads: this.threads_,