diff --git a/src/render/draw_line.js b/src/render/draw_line.js index 524afabc7aa..7a24132b6ef 100644 --- a/src/render/draw_line.js +++ b/src/render/draw_line.js @@ -16,7 +16,7 @@ import type LineStyleLayer from '../style/style_layer/line_style_layer'; import type LineBucket from '../data/bucket/line_bucket'; import type {OverscaledTileID} from '../source/tile_id'; import {clamp, nextPowerOfTwo} from '../util/util'; -import {renderColorRamp, type ColorRampParams} from '../util/color_ramp'; +import {renderColorRamp} from '../util/color_ramp'; import EXTENT from '../data/extent'; export default function drawLine(painter: Painter, sourceCache: SourceCache, layer: LineStyleLayer, coords: Array) { @@ -82,7 +82,6 @@ export default function drawLine(painter: Painter, sourceCache: SourceCache, lay } else if (gradient) { let gradientTexture = bucket.gradientTexture; if (!gradientTexture || layer.gradientTextureInvalidated) { - const sourceMaxZoom = sourceCache.getSource().maxzoom; const lineLength = bucket.maxLineLength / EXTENT; // Logical pixel tile size is 512px, and 1024px right before current zoom + 1 const maxTilePixelSize = 1024; diff --git a/src/util/color_ramp.js b/src/util/color_ramp.js index fd68e5fbae2..0ea20617284 100644 --- a/src/util/color_ramp.js +++ b/src/util/color_ramp.js @@ -24,7 +24,7 @@ export function renderColorRamp(params: ColorRampParams): RGBAImage { const evaluationGlobals = {}; const width = params.resolution || 256; const height = params.clips ? params.clips.length : 1; - const image = params.image || new RGBAImage({width: width, height: height}); + const image = params.image || new RGBAImage({width, height}); assert(isPowerOfTwo(width)); @@ -37,7 +37,7 @@ export function renderColorRamp(params: ColorRampParams): RGBAImage { image.data[stride + index + 1] = Math.floor(pxColor.g * 255 / pxColor.a); image.data[stride + index + 2] = Math.floor(pxColor.b * 255 / pxColor.a); image.data[stride + index + 3] = Math.floor(pxColor.a * 255); - } + }; if (!params.clips) { for (let i = 0, j = 0; i < width; i++, j += 4) { @@ -60,4 +60,4 @@ export function renderColorRamp(params: ColorRampParams): RGBAImage { } return image; -} \ No newline at end of file +} diff --git a/test/unit/util/color_ramp.test.js b/test/unit/util/color_ramp.test.js index d048d27b6e1..b55e26e629f 100644 --- a/test/unit/util/color_ramp.test.js +++ b/test/unit/util/color_ramp.test.js @@ -34,7 +34,7 @@ test('renderColorRamp linear', (t) => { 1, 'red' ], spec, {handleErrors: false}).value; - const ramp = renderColorRamp({ expression, evaluationKey: 'lineProgress' }); + const ramp = renderColorRamp({expression, evaluationKey: 'lineProgress'}); t.equal(ramp.width, 256); t.equal(ramp.height, 1); @@ -61,7 +61,7 @@ test('renderColorRamp step', (t) => { 1, 'black' ], spec, {handleErrors: false}).value; - const ramp = renderColorRamp({ expression, evaluationKey: 'lineProgress', resolution: 512 }); + const ramp = renderColorRamp({expression, evaluationKey: 'lineProgress', resolution: 512}); t.equal(ramp.width, 512); t.equal(ramp.height, 1); @@ -89,12 +89,12 @@ test('renderColorRamp usePlacement', (t) => { 1, 'white' ], spec, {handleErrors: false}).value; - let ramp = renderColorRamp({ expression, evaluationKey: 'lineProgress', resolution: 512 }); + const ramp = renderColorRamp({expression, evaluationKey: 'lineProgress', resolution: 512}); t.equal(ramp.width, 512); t.equal(ramp.height, 1); - renderColorRamp({ expression, evaluationKey: 'lineProgress', resolution: 512, image: ramp }); + renderColorRamp({expression, evaluationKey: 'lineProgress', resolution: 512, image: ramp}); t.equal(pixelAt(ramp, 0)[3], 127, 'pixel at 0.0 matches input alpha'); t.ok(nearlyEquals(pixelAt(ramp, 50), [255, 0, 0, 127]), 'pixel < 0.1 matches input');