diff --git a/src/shaders/symbol_icon.vertex.glsl b/src/shaders/symbol_icon.vertex.glsl index 324b7a6ac2d..0038be25e57 100644 --- a/src/shaders/symbol_icon.vertex.glsl +++ b/src/shaders/symbol_icon.vertex.glsl @@ -42,9 +42,9 @@ void main() { float size; if (!u_is_size_zoom_constant && !u_is_size_feature_constant) { - size = mix(a_size[0], a_size[1], u_size_t) / 10.0; + size = mix(a_size[0], a_size[1], u_size_t) / 256.0; } else if (u_is_size_zoom_constant && !u_is_size_feature_constant) { - size = a_size[0] / 10.0; + size = a_size[0] / 256.0; } else if (!u_is_size_zoom_constant && u_is_size_feature_constant) { size = u_size; } else { diff --git a/src/shaders/symbol_sdf.vertex.glsl b/src/shaders/symbol_sdf.vertex.glsl index 92866986b63..87219b0a880 100644 --- a/src/shaders/symbol_sdf.vertex.glsl +++ b/src/shaders/symbol_sdf.vertex.glsl @@ -57,9 +57,9 @@ void main() { float size; if (!u_is_size_zoom_constant && !u_is_size_feature_constant) { - size = mix(a_size[0], a_size[1], u_size_t) / 10.0; + size = mix(a_size[0], a_size[1], u_size_t) / 256.0; } else if (u_is_size_zoom_constant && !u_is_size_feature_constant) { - size = a_size[0] / 10.0; + size = a_size[0] / 256.0; } else if (!u_is_size_zoom_constant && u_is_size_feature_constant) { size = u_size; } else { diff --git a/src/symbol/symbol_layout.js b/src/symbol/symbol_layout.js index 4f07e5fd793..e509ee6a5f4 100644 --- a/src/symbol/symbol_layout.js +++ b/src/symbol/symbol_layout.js @@ -19,6 +19,7 @@ import EXTENT from '../data/extent'; import SymbolBucket from '../data/bucket/symbol_bucket'; import EvaluationParameters from '../style/evaluation_parameters'; import {Formatted} from '../style-spec/expression/definitions/formatted'; +import {SIZE_PACK_FACTOR} from './symbol_size'; import type {Shaping, PositionedIcon} from './shaping'; import type {CollisionBoxArray} from '../data/array_types'; @@ -289,12 +290,12 @@ function addTextVertices(bucket: SymbolBucket, if (sizeData.functionType === 'source') { textSizeData = [ - 10 * layer.layout.get('text-size').evaluate(feature, {}) + SIZE_PACK_FACTOR * layer.layout.get('text-size').evaluate(feature, {}) ]; } else if (sizeData.functionType === 'composite') { textSizeData = [ - 10 * sizes.compositeTextSizes[0].evaluate(feature, {}), - 10 * sizes.compositeTextSizes[1].evaluate(feature, {}) + SIZE_PACK_FACTOR * sizes.compositeTextSizes[0].evaluate(feature, {}), + SIZE_PACK_FACTOR * sizes.compositeTextSizes[1].evaluate(feature, {}) ]; } @@ -382,12 +383,12 @@ function addSymbol(bucket: SymbolBucket, if (sizeData.functionType === 'source') { iconSizeData = [ - 10 * layer.layout.get('icon-size').evaluate(feature, {}) + SIZE_PACK_FACTOR * layer.layout.get('icon-size').evaluate(feature, {}) ]; } else if (sizeData.functionType === 'composite') { iconSizeData = [ - 10 * sizes.compositeIconSizes[0].evaluate(feature, {}), - 10 * sizes.compositeIconSizes[1].evaluate(feature, {}) + SIZE_PACK_FACTOR * sizes.compositeIconSizes[0].evaluate(feature, {}), + SIZE_PACK_FACTOR * sizes.compositeIconSizes[1].evaluate(feature, {}) ]; } diff --git a/src/symbol/symbol_size.js b/src/symbol/symbol_size.js index a863f483c8e..fac5bb7cbf9 100644 --- a/src/symbol/symbol_size.js +++ b/src/symbol/symbol_size.js @@ -10,7 +10,9 @@ import type {Property, PropertyValue, PossiblyEvaluatedPropertyValue} from '../s import type {CameraExpression, CompositeExpression} from '../style-spec/expression/index'; import type {PropertyValueSpecification} from '../style-spec/types'; -export { getSizeData, evaluateSizeForFeature, evaluateSizeForZoom }; +const SIZE_PACK_FACTOR = 256; + +export { getSizeData, evaluateSizeForFeature, evaluateSizeForZoom, SIZE_PACK_FACTOR }; export type SizeData = { functionType: 'constant', @@ -89,9 +91,9 @@ function evaluateSizeForFeature(sizeData: SizeData, symbol: { lowerSize: number, upperSize: number}) { const part = partiallyEvaluatedSize; if (sizeData.functionType === 'source') { - return symbol.lowerSize / 10; + return symbol.lowerSize / SIZE_PACK_FACTOR; } else if (sizeData.functionType === 'composite') { - return interpolate(symbol.lowerSize / 10, symbol.upperSize / 10, part.uSizeT); + return interpolate(symbol.lowerSize / SIZE_PACK_FACTOR, symbol.upperSize / SIZE_PACK_FACTOR, part.uSizeT); } else { return part.uSize; } diff --git a/test/integration/render-tests/regressions/mapbox-gl-js#7066/expected.png b/test/integration/render-tests/regressions/mapbox-gl-js#7066/expected.png new file mode 100644 index 00000000000..2eaefeaa3e4 Binary files /dev/null and b/test/integration/render-tests/regressions/mapbox-gl-js#7066/expected.png differ diff --git a/test/integration/render-tests/regressions/mapbox-gl-js#7066/style.json b/test/integration/render-tests/regressions/mapbox-gl-js#7066/style.json new file mode 100644 index 00000000000..878ac257b35 --- /dev/null +++ b/test/integration/render-tests/regressions/mapbox-gl-js#7066/style.json @@ -0,0 +1,40 @@ +{ + "version": 8, + "metadata": { + "test": { + "pixelRatio": 10, + "width": 24, + "height": 24 + } + }, + "sources": { + "geojson": { + "type": "geojson", + "data": { + "type": "Feature", + "properties": { + "size": 0.05 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 0, + 0 + ] + } + } + } + }, + "sprite": "local://sprites/emerald", + "layers": [ + { + "id": "symbol", + "type": "symbol", + "source": "geojson", + "layout": { + "icon-size": ["get", "size"], + "icon-image": "generic_icon" + } + } + ] +}