@mapwhit/tilerenderer 0.52.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/build/min/package.json +2 -1
- package/build/min/src/shaders/_prelude.fragment.glsl.js +2 -2
- package/build/min/src/shaders/_prelude.vertex.glsl.js +2 -2
- package/build/min/src/shaders/background.fragment.glsl.js +2 -2
- package/build/min/src/shaders/background.vertex.glsl.js +1 -1
- package/build/min/src/shaders/background_pattern.fragment.glsl.js +2 -2
- package/build/min/src/shaders/background_pattern.vertex.glsl.js +1 -1
- package/build/min/src/shaders/circle.fragment.glsl.js +2 -2
- package/build/min/src/shaders/circle.vertex.glsl.js +2 -2
- package/build/min/src/shaders/clipping_mask.fragment.glsl.js +1 -1
- package/build/min/src/shaders/clipping_mask.vertex.glsl.js +1 -1
- package/build/min/src/shaders/collision_box.fragment.glsl.js +1 -1
- package/build/min/src/shaders/collision_box.vertex.glsl.js +1 -1
- package/build/min/src/shaders/collision_circle.fragment.glsl.js +1 -1
- package/build/min/src/shaders/collision_circle.vertex.glsl.js +1 -1
- package/build/min/src/shaders/debug.fragment.glsl.js +1 -1
- package/build/min/src/shaders/debug.vertex.glsl.js +1 -1
- package/build/min/src/shaders/fill.fragment.glsl.js +2 -2
- package/build/min/src/shaders/fill.vertex.glsl.js +2 -2
- package/build/min/src/shaders/fill_extrusion.fragment.glsl.js +2 -2
- package/build/min/src/shaders/fill_extrusion.vertex.glsl.js +2 -2
- package/build/min/src/shaders/fill_extrusion_pattern.fragment.glsl.js +2 -2
- package/build/min/src/shaders/fill_extrusion_pattern.vertex.glsl.js +2 -2
- package/build/min/src/shaders/fill_outline.fragment.glsl.js +2 -2
- package/build/min/src/shaders/fill_outline.vertex.glsl.js +2 -2
- package/build/min/src/shaders/fill_outline_pattern.fragment.glsl.js +2 -2
- package/build/min/src/shaders/fill_outline_pattern.vertex.glsl.js +2 -2
- package/build/min/src/shaders/fill_pattern.fragment.glsl.js +2 -2
- package/build/min/src/shaders/fill_pattern.vertex.glsl.js +2 -2
- package/build/min/src/shaders/heatmap.fragment.glsl.js +2 -2
- package/build/min/src/shaders/heatmap.vertex.glsl.js +2 -2
- package/build/min/src/shaders/heatmap_texture.fragment.glsl.js +2 -2
- package/build/min/src/shaders/heatmap_texture.vertex.glsl.js +1 -1
- package/build/min/src/shaders/hillshade.fragment.glsl.js +2 -2
- package/build/min/src/shaders/hillshade.vertex.glsl.js +1 -1
- package/build/min/src/shaders/hillshade_prepare.fragment.glsl.js +2 -2
- package/build/min/src/shaders/hillshade_prepare.vertex.glsl.js +1 -1
- package/build/min/src/shaders/line.fragment.glsl.js +2 -2
- package/build/min/src/shaders/line.vertex.glsl.js +2 -2
- package/build/min/src/shaders/line_gradient.fragment.glsl.js +2 -2
- package/build/min/src/shaders/line_gradient.vertex.glsl.js +2 -2
- package/build/min/src/shaders/line_pattern.fragment.glsl.js +2 -2
- package/build/min/src/shaders/line_pattern.vertex.glsl.js +2 -2
- package/build/min/src/shaders/line_sdf.fragment.glsl.js +2 -2
- package/build/min/src/shaders/line_sdf.vertex.glsl.js +2 -2
- package/build/min/src/shaders/raster.fragment.glsl.js +2 -2
- package/build/min/src/shaders/raster.vertex.glsl.js +1 -1
- package/build/min/src/shaders/symbol_icon.fragment.glsl.js +2 -2
- package/build/min/src/shaders/symbol_icon.vertex.glsl.js +2 -2
- package/build/min/src/shaders/symbol_sdf.fragment.glsl.js +2 -2
- package/build/min/src/shaders/symbol_sdf.vertex.glsl.js +2 -2
- package/package.json +5 -4
- package/src/data/array_types.js +55 -117
- package/src/data/bucket/circle_attributes.js +2 -4
- package/src/data/bucket/circle_bucket.js +19 -16
- package/src/data/bucket/fill_attributes.js +2 -4
- package/src/data/bucket/fill_bucket.js +38 -27
- package/src/data/bucket/fill_extrusion_attributes.js +2 -4
- package/src/data/bucket/fill_extrusion_bucket.js +56 -37
- package/src/data/bucket/heatmap_bucket.js +2 -11
- package/src/data/bucket/line_attributes.js +2 -4
- package/src/data/bucket/line_bucket.js +208 -163
- package/src/data/bucket/pattern_attributes.js +2 -4
- package/src/data/bucket/pattern_bucket_features.js +7 -9
- package/src/data/bucket/symbol_attributes.js +12 -26
- package/src/data/bucket/symbol_bucket.js +174 -323
- package/src/data/bucket/symbol_buffers.js +62 -0
- package/src/data/bucket/symbol_collision_buffers.js +33 -0
- package/src/data/bucket.js +26 -25
- package/src/data/dem_data.js +11 -10
- package/src/data/extent.js +1 -1
- package/src/data/feature_index.js +38 -28
- package/src/data/index_array_type.js +1 -6
- package/src/data/load_geometry.js +6 -9
- package/src/data/pos_attributes.js +2 -3
- package/src/data/program_configuration.js +47 -38
- package/src/data/raster_bounds_attributes.js +2 -2
- package/src/data/segment.js +4 -7
- package/src/geo/coordinate.js +1 -1
- package/src/geo/lng_lat.js +3 -3
- package/src/geo/lng_lat_bounds.js +8 -4
- package/src/geo/transform.js +69 -30
- package/src/gl/color_mode.js +2 -2
- package/src/gl/context.js +28 -29
- package/src/gl/cull_face_mode.js +1 -1
- package/src/gl/depth_mode.js +1 -1
- package/src/gl/framebuffer.js +8 -4
- package/src/gl/index_buffer.js +2 -2
- package/src/gl/stencil_mode.js +1 -1
- package/src/gl/value.js +33 -68
- package/src/gl/vertex_buffer.js +2 -2
- package/src/index.js +49 -25
- package/src/render/draw_background.js +17 -12
- package/src/render/draw_circle.js +15 -12
- package/src/render/draw_collision_debug.js +11 -8
- package/src/render/draw_debug.js +16 -14
- package/src/render/draw_fill.js +27 -20
- package/src/render/draw_fill_extrusion.js +20 -17
- package/src/render/draw_heatmap.js +21 -16
- package/src/render/draw_hillshade.js +12 -9
- package/src/render/draw_line.js +36 -22
- package/src/render/draw_raster.js +22 -18
- package/src/render/draw_symbol.js +38 -33
- package/src/render/glyph_atlas.js +9 -8
- package/src/render/glyph_manager.js +2 -3
- package/src/render/image_atlas.js +4 -11
- package/src/render/image_manager.js +39 -28
- package/src/render/line_atlas.js +2 -2
- package/src/render/painter.js +78 -61
- package/src/render/program/background_program.js +6 -13
- package/src/render/program/circle_program.js +8 -10
- package/src/render/program/clipping_mask_program.js +3 -5
- package/src/render/program/collision_program.js +4 -6
- package/src/render/program/debug_program.js +3 -5
- package/src/render/program/fill_extrusion_program.js +9 -15
- package/src/render/program/fill_program.js +10 -21
- package/src/render/program/heatmap_program.js +9 -15
- package/src/render/program/hillshade_program.js +16 -22
- package/src/render/program/line_program.js +14 -25
- package/src/render/program/pattern.js +5 -7
- package/src/render/program/program_uniforms.js +13 -20
- package/src/render/program/raster_program.js +9 -11
- package/src/render/program/symbol_program.js +5 -7
- package/src/render/program.js +5 -6
- package/src/render/texture.js +1 -1
- package/src/render/tile_mask.js +6 -4
- package/src/render/uniform_binding.js +9 -20
- package/src/render/vertex_array_object.js +5 -3
- package/src/shaders/encode_attribute.js +2 -6
- package/src/shaders/index.js +103 -51
- package/src/source/geojson_source.js +25 -30
- package/src/source/geojson_worker_source.js +46 -74
- package/src/source/geojson_wrapper.js +13 -5
- package/src/source/image_source.js +17 -28
- package/src/source/load_tilejson.js +3 -3
- package/src/source/pixels_to_tile_units.js +3 -3
- package/src/source/query_features.js +17 -15
- package/src/source/raster_dem_tile_source.js +54 -71
- package/src/source/raster_tile_source.js +14 -15
- package/src/source/resources/glyphs.js +4 -5
- package/src/source/resources/index.js +4 -12
- package/src/source/rtl_text_plugin.js +62 -35
- package/src/source/source.js +14 -22
- package/src/source/source_cache.js +221 -179
- package/src/source/source_state.js +125 -13
- package/src/source/tile.js +67 -66
- package/src/source/tile_bounds.js +36 -29
- package/src/source/tile_cache.js +2 -2
- package/src/source/tile_id.js +30 -26
- package/src/source/vector_tile_source.js +23 -21
- package/src/source/vector_tile_worker_source.js +22 -26
- package/src/source/worker_tile.js +139 -134
- package/src/style/create_style_layer.js +11 -11
- package/src/style/evaluation_parameters.js +4 -6
- package/src/style/light.js +5 -5
- package/src/style/load_sprite.js +6 -6
- package/src/style/parse_glyph_pbf.js +21 -17
- package/src/style/pauseable_placement.js +7 -9
- package/src/style/properties.js +21 -51
- package/src/style/query_utils.js +7 -13
- package/src/style/style.js +314 -221
- package/src/style/style_layer/background_style_layer.js +3 -4
- package/src/style/style_layer/background_style_layer_properties.js +2 -2
- package/src/style/style_layer/circle_style_layer.js +25 -20
- package/src/style/style_layer/circle_style_layer_properties.js +2 -2
- package/src/style/style_layer/fill_extrusion_style_layer.js +55 -37
- package/src/style/style_layer/fill_extrusion_style_layer_properties.js +2 -2
- package/src/style/style_layer/fill_style_layer.js +11 -12
- package/src/style/style_layer/fill_style_layer_properties.js +2 -2
- package/src/style/style_layer/heatmap_style_layer.js +6 -7
- package/src/style/style_layer/heatmap_style_layer_properties.js +2 -2
- package/src/style/style_layer/hillshade_style_layer.js +4 -5
- package/src/style/style_layer/hillshade_style_layer_properties.js +2 -2
- package/src/style/style_layer/line_style_layer.js +33 -30
- package/src/style/style_layer/line_style_layer_properties.js +5 -5
- package/src/style/style_layer/raster_style_layer.js +3 -4
- package/src/style/style_layer/raster_style_layer_properties.js +2 -2
- package/src/style/style_layer/symbol_style_layer.js +20 -21
- package/src/style/style_layer/symbol_style_layer_properties.js +2 -2
- package/src/style/style_layer.js +66 -47
- package/src/style/style_layer_index.js +17 -42
- package/src/style/zoom_history.js +1 -1
- package/src/style-spec/error/parsing_error.js +1 -1
- package/src/style-spec/error/validation_error.js +5 -3
- package/src/style-spec/feature_filter/convert.js +17 -9
- package/src/style-spec/feature_filter/index.js +13 -9
- package/src/style-spec/util/eval_support.js +2 -2
- package/src/style-spec/util/ref_properties.js +1 -1
- package/src/symbol/anchor.js +2 -6
- package/src/symbol/check_max_angle.js +13 -5
- package/src/symbol/clip_line.js +2 -3
- package/src/symbol/collision_feature.js +8 -4
- package/src/symbol/collision_index.js +5 -7
- package/src/symbol/cross_tile_symbol_index.js +7 -10
- package/src/symbol/get_anchors.js +15 -8
- package/src/symbol/grid_index.js +5 -3
- package/src/symbol/mergelines.js +2 -2
- package/src/symbol/opacity_state.js +1 -5
- package/src/symbol/placement.js +28 -23
- package/src/symbol/projection.js +29 -28
- package/src/symbol/quads.js +14 -16
- package/src/symbol/shaping.js +27 -19
- package/src/symbol/symbol_layout.js +24 -28
- package/src/symbol/symbol_size.js +13 -12
- package/src/symbol/transform_text.js +4 -4
- package/src/ui/camera.js +34 -18
- package/src/ui/map.js +102 -44
- package/src/util/async.js +11 -5
- package/src/util/browser.js +1 -1
- package/src/util/callback.js +3 -9
- package/src/util/classify_rings.js +13 -8
- package/src/util/color_ramp.js +3 -3
- package/src/util/config.js +4 -4
- package/src/util/dictionary_coder.js +2 -3
- package/src/util/dom.js +7 -3
- package/src/util/find_pole_of_inaccessibility.js +29 -14
- package/src/util/group_layers.js +41 -0
- package/src/util/image.js +3 -13
- package/src/util/interpolate.js +1 -1
- package/src/util/intersection_tests.js +80 -42
- package/src/util/is_char_in_unicode_block.js +1 -1
- package/src/util/key.js +25 -0
- package/src/util/loader/image.js +1 -1
- package/src/util/object.js +33 -76
- package/src/util/script_detection.js +212 -91
- package/src/util/struct_array.js +8 -40
- package/src/util/task_queue.js +11 -7
- package/src/util/throttle.js +2 -2
- package/src/util/tile_cover.js +8 -5
- package/src/util/token.js +1 -1
- package/src/util/unique_id.js +2 -2
- package/src/util/util.js +21 -29
- package/src/util/vectortile_to_geojson.js +4 -2
- package/src/util/verticalize_punctuation.js +3 -7
- package/src/util/warn.js +4 -4
- package/src/util/web_worker.js +3 -3
- package/src/worker.js +1 -4
- package/src/source/resources/images.js +0 -68
- package/src/source/worker.js +0 -110
- package/src/source/worker_source.js +0 -14
- package/src/style-spec/deref.js +0 -51
- package/src/style-spec/group_by_layout.js +0 -46
- package/src/util/actor.js +0 -108
- package/src/util/dispatcher.js +0 -65
- package/src/util/global_worker_pool.js +0 -15
- package/src/util/transfer_registry.js +0 -168
- package/src/util/web_worker_transfer.js +0 -43
- package/src/util/worker_pool.js +0 -41
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const { SymbolInstanceArray } = require('../data/array_types');
|
|
1
|
+
import EXTENT from '../data/extent.js';
|
|
4
2
|
|
|
5
3
|
/*
|
|
6
4
|
The CrossTileSymbolIndex generally works on the assumption that
|
|
@@ -240,7 +238,9 @@ class CrossTileSymbolIndex {
|
|
|
240
238
|
|
|
241
239
|
for (const tile of tiles) {
|
|
242
240
|
const symbolBucket = tile.getBucket(styleLayer);
|
|
243
|
-
if (!symbolBucket || styleLayer.id !== symbolBucket.
|
|
241
|
+
if (!symbolBucket || styleLayer.id !== symbolBucket.layers[0].id) {
|
|
242
|
+
continue;
|
|
243
|
+
}
|
|
244
244
|
|
|
245
245
|
if (!symbolBucket.bucketInstanceId) {
|
|
246
246
|
symbolBucket.bucketInstanceId = ++this.maxBucketInstanceId;
|
|
@@ -260,16 +260,13 @@ class CrossTileSymbolIndex {
|
|
|
260
260
|
}
|
|
261
261
|
|
|
262
262
|
pruneUnusedLayers(usedLayers) {
|
|
263
|
-
const
|
|
264
|
-
usedLayers.forEach(usedLayer => {
|
|
265
|
-
usedLayerMap[usedLayer] = true;
|
|
266
|
-
});
|
|
263
|
+
const usedLayersSet = new Set(usedLayers);
|
|
267
264
|
for (const layerId in this.layerIndexes) {
|
|
268
|
-
if (!
|
|
265
|
+
if (!usedLayersSet.has(layerId)) {
|
|
269
266
|
delete this.layerIndexes[layerId];
|
|
270
267
|
}
|
|
271
268
|
}
|
|
272
269
|
}
|
|
273
270
|
}
|
|
274
271
|
|
|
275
|
-
|
|
272
|
+
export default CrossTileSymbolIndex;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const checkMaxAngle = require('./check_max_angle');
|
|
5
|
-
|
|
6
|
-
module.exports = { getAnchors, getCenterAnchor };
|
|
1
|
+
import Anchor from '../symbol/anchor.js';
|
|
2
|
+
import interpolate from '../util/interpolate.js';
|
|
3
|
+
import checkMaxAngle from './check_max_angle.js';
|
|
7
4
|
|
|
8
5
|
function getLineLength(line) {
|
|
9
6
|
let lineLength = 0;
|
|
@@ -24,7 +21,7 @@ function getShapedLabelLength(shapedText, shapedIcon) {
|
|
|
24
21
|
);
|
|
25
22
|
}
|
|
26
23
|
|
|
27
|
-
function getCenterAnchor(line, maxAngle, shapedText, shapedIcon, glyphSize, boxScale) {
|
|
24
|
+
export function getCenterAnchor(line, maxAngle, shapedText, shapedIcon, glyphSize, boxScale) {
|
|
28
25
|
const angleWindowSize = getAngleWindowSize(shapedText, glyphSize, boxScale);
|
|
29
26
|
const labelLength = getShapedLabelLength(shapedText, shapedIcon) * boxScale;
|
|
30
27
|
|
|
@@ -55,7 +52,17 @@ function getCenterAnchor(line, maxAngle, shapedText, shapedIcon, glyphSize, boxS
|
|
|
55
52
|
}
|
|
56
53
|
}
|
|
57
54
|
|
|
58
|
-
function getAnchors(
|
|
55
|
+
export function getAnchors(
|
|
56
|
+
line,
|
|
57
|
+
spacing,
|
|
58
|
+
maxAngle,
|
|
59
|
+
shapedText,
|
|
60
|
+
shapedIcon,
|
|
61
|
+
glyphSize,
|
|
62
|
+
boxScale,
|
|
63
|
+
overscaling,
|
|
64
|
+
tileExtent
|
|
65
|
+
) {
|
|
59
66
|
// Resample a line to get anchor points for labels and check that each
|
|
60
67
|
// potential label passes text-max-angle check and has enough froom to fit
|
|
61
68
|
// on the line.
|
package/src/symbol/grid_index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { clamp } from '../util/util.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* GridIndex is a data structure for testing the intersection of
|
|
@@ -266,7 +266,9 @@ class GridIndex {
|
|
|
266
266
|
for (let x = cx1; x <= cx2; x++) {
|
|
267
267
|
for (let y = cy1; y <= cy2; y++) {
|
|
268
268
|
const cellIndex = xCellCount * y + x;
|
|
269
|
-
if (fn.call(this, x1, y1, x2, y2, cellIndex, ...args))
|
|
269
|
+
if (fn.call(this, x1, y1, x2, y2, cellIndex, ...args)) {
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
270
272
|
}
|
|
271
273
|
}
|
|
272
274
|
|
|
@@ -280,7 +282,7 @@ class GridIndex {
|
|
|
280
282
|
}
|
|
281
283
|
}
|
|
282
284
|
|
|
283
|
-
|
|
285
|
+
export default GridIndex;
|
|
284
286
|
|
|
285
287
|
function circlesCollide(x1, y1, r1, x2, y2, r2) {
|
|
286
288
|
const dx = x2 - x1;
|
package/src/symbol/mergelines.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
export default function (features) {
|
|
2
2
|
const leftIndex = new Map();
|
|
3
3
|
const rightIndex = new Map();
|
|
4
4
|
const mergedFeatures = [];
|
|
@@ -73,4 +73,4 @@ module.exports = function (features) {
|
|
|
73
73
|
const { x, y } = geom.at(onRight ? -1 : 0);
|
|
74
74
|
return `${text}:${x}:${y}`;
|
|
75
75
|
}
|
|
76
|
-
}
|
|
76
|
+
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
const { register } = require('../util/transfer_registry');
|
|
2
|
-
|
|
3
1
|
class OpacityState {
|
|
4
2
|
constructor() {
|
|
5
3
|
this.opacity = 0;
|
|
@@ -16,6 +14,4 @@ class OpacityState {
|
|
|
16
14
|
}
|
|
17
15
|
}
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
module.exports = OpacityState;
|
|
17
|
+
export default OpacityState;
|
package/src/symbol/placement.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import assert from 'assert';
|
|
2
|
+
import EXTENT from '../data/extent.js';
|
|
3
|
+
import pixelsToTileUnits from '../source/pixels_to_tile_units.js';
|
|
4
|
+
import properties from '../style/style_layer/symbol_style_layer_properties.js';
|
|
5
|
+
import CollisionIndex from './collision_index.js';
|
|
6
|
+
import * as projection from './projection.js';
|
|
7
|
+
import * as symbolSize from './symbol_size.js';
|
|
2
8
|
|
|
3
|
-
const EXTENT = require('../data/extent');
|
|
4
|
-
const symbolSize = require('./symbol_size');
|
|
5
|
-
const projection = require('./projection');
|
|
6
|
-
const properties = require('../style/style_layer/symbol_style_layer_properties');
|
|
7
9
|
const symbolLayoutProperties = properties.layout;
|
|
8
|
-
const assert = require('assert');
|
|
9
|
-
const pixelsToTileUnits = require('../source/pixels_to_tile_units');
|
|
10
10
|
|
|
11
11
|
class OpacityState {
|
|
12
12
|
constructor(prevState, increment, placed, skipFade) {
|
|
@@ -44,7 +44,7 @@ class JointPlacement {
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
class RetainedQueryData {
|
|
47
|
+
export class RetainedQueryData {
|
|
48
48
|
constructor(bucketInstanceId, featureIndex, sourceLayerIndex, bucketIndex, tileID) {
|
|
49
49
|
this.bucketInstanceId = bucketInstanceId;
|
|
50
50
|
this.featureIndex = featureIndex;
|
|
@@ -81,7 +81,7 @@ class CollisionGroups {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
class Placement {
|
|
84
|
+
export class Placement {
|
|
85
85
|
constructor(transform, fadeDuration, crossSourceCollisions) {
|
|
86
86
|
this.transform = transform.clone();
|
|
87
87
|
this.collisionIndex = new CollisionIndex(this.transform);
|
|
@@ -96,11 +96,13 @@ class Placement {
|
|
|
96
96
|
placeLayerTile(styleLayer, tile, showCollisionBoxes, seenCrossTileIDs) {
|
|
97
97
|
const symbolBucket = tile.getBucket(styleLayer);
|
|
98
98
|
const bucketFeatureIndex = tile.latestFeatureIndex;
|
|
99
|
-
if (!symbolBucket || !bucketFeatureIndex || styleLayer.id !== symbolBucket.
|
|
99
|
+
if (!symbolBucket || !bucketFeatureIndex || styleLayer.id !== symbolBucket.layers[0].id) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
100
102
|
|
|
101
103
|
const collisionBoxArray = tile.collisionBoxArray;
|
|
102
104
|
|
|
103
|
-
const layout = symbolBucket.layers[0].
|
|
105
|
+
const layout = symbolBucket.layers[0]._layout;
|
|
104
106
|
|
|
105
107
|
const scale = 2 ** (this.transform.zoom - tile.tileID.overscaledZ);
|
|
106
108
|
const textPixelRatio = tile.tileSize / EXTENT;
|
|
@@ -159,7 +161,7 @@ class Placement {
|
|
|
159
161
|
seenCrossTileIDs,
|
|
160
162
|
collisionBoxArray
|
|
161
163
|
) {
|
|
162
|
-
const layout = bucket.layers[0].
|
|
164
|
+
const layout = bucket.layers[0]._layout;
|
|
163
165
|
|
|
164
166
|
const partiallyEvaluatedTextSize = symbolSize.evaluateSizeForZoom(
|
|
165
167
|
bucket.textSizeData,
|
|
@@ -399,19 +401,27 @@ class Placement {
|
|
|
399
401
|
|
|
400
402
|
for (const tile of tiles) {
|
|
401
403
|
const symbolBucket = tile.getBucket(styleLayer);
|
|
402
|
-
if (symbolBucket && tile.latestFeatureIndex && styleLayer.id === symbolBucket.
|
|
404
|
+
if (symbolBucket && tile.latestFeatureIndex && styleLayer.id === symbolBucket.layers[0].id) {
|
|
403
405
|
this.updateBucketOpacities(symbolBucket, seenCrossTileIDs, tile.collisionBoxArray);
|
|
404
406
|
}
|
|
405
407
|
}
|
|
406
408
|
}
|
|
407
409
|
|
|
408
410
|
updateBucketOpacities(bucket, seenCrossTileIDs, collisionBoxArray) {
|
|
409
|
-
if (bucket.hasTextData())
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
if (bucket.
|
|
411
|
+
if (bucket.hasTextData()) {
|
|
412
|
+
bucket.text.opacityVertexArray.clear();
|
|
413
|
+
}
|
|
414
|
+
if (bucket.hasIconData()) {
|
|
415
|
+
bucket.icon.opacityVertexArray.clear();
|
|
416
|
+
}
|
|
417
|
+
if (bucket.hasCollisionBoxData()) {
|
|
418
|
+
bucket.collisionBox.collisionVertexArray.clear();
|
|
419
|
+
}
|
|
420
|
+
if (bucket.hasCollisionCircleData()) {
|
|
421
|
+
bucket.collisionCircle.collisionVertexArray.clear();
|
|
422
|
+
}
|
|
413
423
|
|
|
414
|
-
const layout = bucket.layers[0].
|
|
424
|
+
const layout = bucket.layers[0]._layout;
|
|
415
425
|
const duplicateOpacityState = new JointOpacityState(null, 0, false, false, true);
|
|
416
426
|
const textAllowOverlap = layout.get('text-allow-overlap');
|
|
417
427
|
const iconAllowOverlap = layout.get('icon-allow-overlap');
|
|
@@ -579,8 +589,3 @@ function packOpacity(opacityState) {
|
|
|
579
589
|
targetBit
|
|
580
590
|
);
|
|
581
591
|
}
|
|
582
|
-
|
|
583
|
-
module.exports = {
|
|
584
|
-
RetainedQueryData,
|
|
585
|
-
Placement
|
|
586
|
-
};
|
package/src/symbol/projection.js
CHANGED
|
@@ -1,22 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import glMatrix from '@mapbox/gl-matrix';
|
|
2
|
+
import Point from '@mapbox/point-geometry';
|
|
3
|
+
import { addDynamicAttributes } from '../data/bucket/symbol_bucket.js';
|
|
4
|
+
import properties from '../style/style_layer/symbol_style_layer_properties.js';
|
|
5
|
+
import { WritingMode } from '../symbol/shaping.js';
|
|
6
|
+
import * as symbolSize from './symbol_size.js';
|
|
7
|
+
|
|
8
|
+
const { mat4, vec4 } = glMatrix;
|
|
7
9
|
const symbolLayoutProperties = properties.layout;
|
|
8
10
|
|
|
9
|
-
const { WritingMode } = require('../symbol/shaping');
|
|
10
|
-
|
|
11
|
-
module.exports = {
|
|
12
|
-
updateLineLabels,
|
|
13
|
-
getLabelPlaneMatrix,
|
|
14
|
-
getGlCoordMatrix,
|
|
15
|
-
project,
|
|
16
|
-
placeFirstAndLastGlyph,
|
|
17
|
-
xyTransformMat4
|
|
18
|
-
};
|
|
19
|
-
|
|
20
11
|
/*
|
|
21
12
|
* # Overview of coordinate spaces
|
|
22
13
|
*
|
|
@@ -65,7 +56,7 @@ module.exports = {
|
|
|
65
56
|
/*
|
|
66
57
|
* Returns a matrix for converting from tile units to the correct label coordinate space.
|
|
67
58
|
*/
|
|
68
|
-
function getLabelPlaneMatrix(posMatrix, pitchWithMap, rotateWithMap, transform, pixelsToTileUnits) {
|
|
59
|
+
export function getLabelPlaneMatrix(posMatrix, pitchWithMap, rotateWithMap, transform, pixelsToTileUnits) {
|
|
69
60
|
const m = mat4.identity(new Float32Array(16));
|
|
70
61
|
if (pitchWithMap) {
|
|
71
62
|
mat4.identity(m);
|
|
@@ -84,7 +75,7 @@ function getLabelPlaneMatrix(posMatrix, pitchWithMap, rotateWithMap, transform,
|
|
|
84
75
|
/*
|
|
85
76
|
* Returns a matrix for converting from the correct label coordinate space to gl coords.
|
|
86
77
|
*/
|
|
87
|
-
function getGlCoordMatrix(posMatrix, pitchWithMap, rotateWithMap, transform, pixelsToTileUnits) {
|
|
78
|
+
export function getGlCoordMatrix(posMatrix, pitchWithMap, rotateWithMap, transform, pixelsToTileUnits) {
|
|
88
79
|
const m = mat4.identity(new Float32Array(16));
|
|
89
80
|
if (pitchWithMap) {
|
|
90
81
|
mat4.multiply(m, m, posMatrix);
|
|
@@ -100,7 +91,7 @@ function getGlCoordMatrix(posMatrix, pitchWithMap, rotateWithMap, transform, pix
|
|
|
100
91
|
return m;
|
|
101
92
|
}
|
|
102
93
|
|
|
103
|
-
function project(point, matrix) {
|
|
94
|
+
export function project(point, matrix) {
|
|
104
95
|
const pos = [point.x, point.y, 0, 1];
|
|
105
96
|
xyTransformMat4(pos, pos, matrix);
|
|
106
97
|
const w = pos[3];
|
|
@@ -122,7 +113,7 @@ function isVisible(anchorPos, clippingBuffer) {
|
|
|
122
113
|
* Update the `dynamicLayoutVertexBuffer` for the buffer with the correct glyph positions for the current map view.
|
|
123
114
|
* This is only run on labels that are aligned with lines. Horizontal labels are handled entirely in the shader.
|
|
124
115
|
*/
|
|
125
|
-
function updateLineLabels(
|
|
116
|
+
export function updateLineLabels(
|
|
126
117
|
bucket,
|
|
127
118
|
posMatrix,
|
|
128
119
|
painter,
|
|
@@ -233,7 +224,7 @@ function updateLineLabels(
|
|
|
233
224
|
}
|
|
234
225
|
}
|
|
235
226
|
|
|
236
|
-
function placeFirstAndLastGlyph(
|
|
227
|
+
export function placeFirstAndLastGlyph(
|
|
237
228
|
fontScale,
|
|
238
229
|
glyphOffsetArray,
|
|
239
230
|
lineOffsetX,
|
|
@@ -269,7 +260,9 @@ function placeFirstAndLastGlyph(
|
|
|
269
260
|
projectionCache,
|
|
270
261
|
returnTileDistance
|
|
271
262
|
);
|
|
272
|
-
if (!firstPlacedGlyph)
|
|
263
|
+
if (!firstPlacedGlyph) {
|
|
264
|
+
return null;
|
|
265
|
+
}
|
|
273
266
|
|
|
274
267
|
const lastPlacedGlyph = placeGlyphAlongLine(
|
|
275
268
|
fontScale * lastGlyphOffset,
|
|
@@ -286,7 +279,9 @@ function placeFirstAndLastGlyph(
|
|
|
286
279
|
projectionCache,
|
|
287
280
|
returnTileDistance
|
|
288
281
|
);
|
|
289
|
-
if (!lastPlacedGlyph)
|
|
282
|
+
if (!lastPlacedGlyph) {
|
|
283
|
+
return null;
|
|
284
|
+
}
|
|
290
285
|
|
|
291
286
|
return { first: firstPlacedGlyph, last: lastPlacedGlyph };
|
|
292
287
|
}
|
|
@@ -428,7 +423,9 @@ function placeGlyphsAlongLine(
|
|
|
428
423
|
projectionCache,
|
|
429
424
|
false
|
|
430
425
|
);
|
|
431
|
-
if (!singleGlyph)
|
|
426
|
+
if (!singleGlyph) {
|
|
427
|
+
return { notEnoughRoom: true };
|
|
428
|
+
}
|
|
432
429
|
|
|
433
430
|
placedGlyphs = [singleGlyph];
|
|
434
431
|
}
|
|
@@ -486,7 +483,9 @@ function placeGlyphAlongLine(
|
|
|
486
483
|
angle = Math.PI;
|
|
487
484
|
}
|
|
488
485
|
|
|
489
|
-
if (dir < 0)
|
|
486
|
+
if (dir < 0) {
|
|
487
|
+
angle += Math.PI;
|
|
488
|
+
}
|
|
490
489
|
|
|
491
490
|
let currentIndex = dir > 0 ? lineStartIndex + anchorSegment : lineStartIndex + anchorSegment + 1;
|
|
492
491
|
|
|
@@ -501,7 +500,9 @@ function placeGlyphAlongLine(
|
|
|
501
500
|
currentIndex += dir;
|
|
502
501
|
|
|
503
502
|
// offset does not fit on the projected line
|
|
504
|
-
if (currentIndex < lineStartIndex || currentIndex >= lineEndIndex)
|
|
503
|
+
if (currentIndex < lineStartIndex || currentIndex >= lineEndIndex) {
|
|
504
|
+
return null;
|
|
505
|
+
}
|
|
505
506
|
|
|
506
507
|
prev = current;
|
|
507
508
|
|
|
@@ -591,7 +592,7 @@ function hideGlyphs(num, dynamicLayoutVertexArray) {
|
|
|
591
592
|
|
|
592
593
|
// For line label layout, we're not using z output and our w input is always 1
|
|
593
594
|
// This custom matrix transformation ignores those components to make projection faster
|
|
594
|
-
function xyTransformMat4(out, a, m) {
|
|
595
|
+
export function xyTransformMat4(out, a, m) {
|
|
595
596
|
const x = a[0];
|
|
596
597
|
const y = a[1];
|
|
597
598
|
out[0] = m[0] * x + m[4] * y + m[12];
|
package/src/symbol/quads.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const { GLYPH_PBF_BORDER } = require('../style/parse_glyph_pbf');
|
|
1
|
+
import Point from '@mapbox/point-geometry';
|
|
2
|
+
import { GLYPH_PBF_BORDER } from '../style/parse_glyph_pbf.js';
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* A textured quad for rendering a single icon or glyph.
|
|
@@ -20,9 +19,9 @@ const { GLYPH_PBF_BORDER } = require('../style/parse_glyph_pbf');
|
|
|
20
19
|
* Create the quads used for rendering an icon.
|
|
21
20
|
* @private
|
|
22
21
|
*/
|
|
23
|
-
function getIconQuads(anchor, shapedIcon, layer, alongLine, shapedText, feature) {
|
|
22
|
+
export function getIconQuads(anchor, shapedIcon, layer, alongLine, shapedText, feature) {
|
|
24
23
|
const image = shapedIcon.image;
|
|
25
|
-
const layout = layer.
|
|
24
|
+
const layout = layer._layout;
|
|
26
25
|
|
|
27
26
|
// If you have a 10px icon that isn't perfectly aligned to the pixel grid it will cover 11 actual
|
|
28
27
|
// pixels. The quad needs to be padded to account for this, otherwise they'll look slightly clipped
|
|
@@ -71,7 +70,7 @@ function getIconQuads(anchor, shapedIcon, layer, alongLine, shapedText, feature)
|
|
|
71
70
|
bl = new Point(left, bottom);
|
|
72
71
|
}
|
|
73
72
|
|
|
74
|
-
const angle = (layer.
|
|
73
|
+
const angle = (layer._layout.get('icon-rotate').evaluate(feature, {}) * Math.PI) / 180;
|
|
75
74
|
|
|
76
75
|
if (angle) {
|
|
77
76
|
const sin = Math.sin(angle);
|
|
@@ -92,10 +91,10 @@ function getIconQuads(anchor, shapedIcon, layer, alongLine, shapedText, feature)
|
|
|
92
91
|
* Create the quads used for rendering a text label.
|
|
93
92
|
* @private
|
|
94
93
|
*/
|
|
95
|
-
function getGlyphQuads(anchor, shaping, layer, alongLine, feature, positions) {
|
|
94
|
+
export function getGlyphQuads(anchor, shaping, layer, alongLine, feature, positions) {
|
|
96
95
|
const oneEm = 24;
|
|
97
|
-
const textRotate = (layer.
|
|
98
|
-
const textOffset = layer.
|
|
96
|
+
const textRotate = (layer._layout.get('text-rotate').evaluate(feature, {}) * Math.PI) / 180;
|
|
97
|
+
const textOffset = layer._layout
|
|
99
98
|
.get('text-offset')
|
|
100
99
|
.evaluate(feature, {})
|
|
101
100
|
.map(t => t * oneEm);
|
|
@@ -107,10 +106,14 @@ function getGlyphQuads(anchor, shaping, layer, alongLine, feature, positions) {
|
|
|
107
106
|
const positionedGlyph = positionedGlyphs[k];
|
|
108
107
|
const glyphPositions = positions[positionedGlyph.fontStack];
|
|
109
108
|
const glyph = glyphPositions?.[positionedGlyph.glyph];
|
|
110
|
-
if (!glyph)
|
|
109
|
+
if (!glyph) {
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
111
112
|
|
|
112
113
|
const rect = glyph.rect;
|
|
113
|
-
if (!rect)
|
|
114
|
+
if (!rect) {
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
114
117
|
|
|
115
118
|
// The rects have an addditional buffer that is not included in their size.
|
|
116
119
|
const glyphPadding = 1.0;
|
|
@@ -167,8 +170,3 @@ function getGlyphQuads(anchor, shaping, layer, alongLine, feature, positions) {
|
|
|
167
170
|
|
|
168
171
|
return quads;
|
|
169
172
|
}
|
|
170
|
-
|
|
171
|
-
module.exports = {
|
|
172
|
-
getIconQuads,
|
|
173
|
-
getGlyphQuads
|
|
174
|
-
};
|
package/src/symbol/shaping.js
CHANGED
|
@@ -1,19 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { plugin as rtlTextPlugin } from '../source/rtl_text_plugin.js';
|
|
2
|
+
import { charAllowsIdeographicBreaking, charHasUprightVerticalOrientation } from '../util/script_detection.js';
|
|
3
|
+
import verticalizePunctuation from '../util/verticalize_punctuation.js';
|
|
4
4
|
|
|
5
|
-
const WritingMode = {
|
|
5
|
+
export const WritingMode = {
|
|
6
6
|
horizontal: 1,
|
|
7
7
|
vertical: 2,
|
|
8
8
|
horizontalOnly: 3
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
module.exports = {
|
|
12
|
-
shapeText,
|
|
13
|
-
shapeIcon,
|
|
14
|
-
WritingMode
|
|
15
|
-
};
|
|
16
|
-
|
|
17
11
|
class TaggedString {
|
|
18
12
|
constructor() {
|
|
19
13
|
this.text = '';
|
|
@@ -98,7 +92,7 @@ function breakLines(input, lineBreakPoints) {
|
|
|
98
92
|
return lines;
|
|
99
93
|
}
|
|
100
94
|
|
|
101
|
-
function shapeText(
|
|
95
|
+
export function shapeText(
|
|
102
96
|
text,
|
|
103
97
|
glyphs,
|
|
104
98
|
defaultFontStack,
|
|
@@ -168,7 +162,9 @@ function shapeText(
|
|
|
168
162
|
|
|
169
163
|
shapeLines(shaping, glyphs, lines, lineHeight, textAnchor, textJustify, writingMode, spacing, verticalHeight);
|
|
170
164
|
|
|
171
|
-
if (!positionedGlyphs.length)
|
|
165
|
+
if (!positionedGlyphs.length) {
|
|
166
|
+
return false;
|
|
167
|
+
}
|
|
172
168
|
|
|
173
169
|
shaping.text = shaping.text.toString();
|
|
174
170
|
return shaping;
|
|
@@ -210,7 +206,9 @@ function determineAverageLineWidth(logicalInput, spacing, maxWidth, glyphMap) {
|
|
|
210
206
|
const section = logicalInput.getSection(index);
|
|
211
207
|
const positions = glyphMap[section.fontStack];
|
|
212
208
|
const glyph = positions?.[logicalInput.getCharCode(index)];
|
|
213
|
-
if (!glyph)
|
|
209
|
+
if (!glyph) {
|
|
210
|
+
continue;
|
|
211
|
+
}
|
|
214
212
|
totalWidth += glyph.metrics.advance * section.scale + spacing;
|
|
215
213
|
}
|
|
216
214
|
|
|
@@ -283,9 +281,13 @@ function leastBadBreaks(lastLineBreak) {
|
|
|
283
281
|
}
|
|
284
282
|
|
|
285
283
|
function determineLineBreaks(logicalInput, spacing, maxWidth, glyphMap) {
|
|
286
|
-
if (!maxWidth)
|
|
284
|
+
if (!maxWidth) {
|
|
285
|
+
return [];
|
|
286
|
+
}
|
|
287
287
|
|
|
288
|
-
if (!logicalInput)
|
|
288
|
+
if (!logicalInput) {
|
|
289
|
+
return [];
|
|
290
|
+
}
|
|
289
291
|
|
|
290
292
|
const potentialLineBreaks = [];
|
|
291
293
|
const targetWidth = determineAverageLineWidth(logicalInput, spacing, maxWidth, glyphMap);
|
|
@@ -298,7 +300,9 @@ function determineLineBreaks(logicalInput, spacing, maxWidth, glyphMap) {
|
|
|
298
300
|
const positions = glyphMap[section.fontStack];
|
|
299
301
|
const glyph = positions?.[codePoint];
|
|
300
302
|
|
|
301
|
-
if (glyph && !whitespace[codePoint])
|
|
303
|
+
if (glyph && !whitespace[codePoint]) {
|
|
304
|
+
currentX += glyph.metrics.advance * section.scale + spacing;
|
|
305
|
+
}
|
|
302
306
|
|
|
303
307
|
// Ideographic characters, spaces, and word-breaking punctuation that often appear without
|
|
304
308
|
// surrounding spaces.
|
|
@@ -395,7 +399,9 @@ function shapeLines(
|
|
|
395
399
|
const positions = glyphMap[section.fontStack];
|
|
396
400
|
const glyph = positions?.[codePoint];
|
|
397
401
|
|
|
398
|
-
if (!glyph)
|
|
402
|
+
if (!glyph) {
|
|
403
|
+
continue;
|
|
404
|
+
}
|
|
399
405
|
|
|
400
406
|
if (!charHasUprightVerticalOrientation(codePoint) || writingMode === WritingMode.horizontal) {
|
|
401
407
|
positionedGlyphs.push({
|
|
@@ -446,7 +452,9 @@ function shapeLines(
|
|
|
446
452
|
|
|
447
453
|
// justify right = 1, left = 0, center = 0.5
|
|
448
454
|
function justifyLine(positionedGlyphs, glyphMap, start, end, justify) {
|
|
449
|
-
if (!justify)
|
|
455
|
+
if (!justify) {
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
450
458
|
|
|
451
459
|
const lastPositionedGlyph = positionedGlyphs[end];
|
|
452
460
|
const positions = glyphMap[lastPositionedGlyph.fontStack];
|
|
@@ -471,7 +479,7 @@ function align(positionedGlyphs, justify, horizontalAlign, verticalAlign, maxLin
|
|
|
471
479
|
}
|
|
472
480
|
}
|
|
473
481
|
|
|
474
|
-
function shapeIcon(image, iconOffset, iconAnchor) {
|
|
482
|
+
export function shapeIcon(image, iconOffset, iconAnchor) {
|
|
475
483
|
const { horizontalAlign, verticalAlign } = getAnchorAlignment(iconAnchor);
|
|
476
484
|
const dx = iconOffset[0];
|
|
477
485
|
const dy = iconOffset[1];
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const murmur3 = require('murmurhash-js');
|
|
1
|
+
import murmur3 from 'murmurhash-js';
|
|
2
|
+
import SymbolBucket from '../data/bucket/symbol_bucket.js';
|
|
3
|
+
import EXTENT from '../data/extent.js';
|
|
4
|
+
import EvaluationParameters from '../style/evaluation_parameters.js';
|
|
5
|
+
import classifyRings from '../util/classify_rings.js';
|
|
6
|
+
import findPoleOfInaccessibility from '../util/find_pole_of_inaccessibility.js';
|
|
7
|
+
import { allowsLetterSpacing, allowsVerticalWritingMode } from '../util/script_detection.js';
|
|
8
|
+
import warn from '../util/warn.js';
|
|
9
|
+
import Anchor from './anchor.js';
|
|
10
|
+
import clipLine from './clip_line.js';
|
|
11
|
+
import CollisionFeature from './collision_feature.js';
|
|
12
|
+
import { getAnchors, getCenterAnchor } from './get_anchors.js';
|
|
13
|
+
import { getGlyphQuads, getIconQuads } from './quads.js';
|
|
14
|
+
import { shapeIcon, shapeText, WritingMode } from './shaping.js';
|
|
16
15
|
|
|
17
16
|
// The symbol layout process needs `text-size` evaluated at up to five different zoom levels, and
|
|
18
17
|
// `icon-size` at up to three:
|
|
@@ -26,10 +25,10 @@ const murmur3 = require('murmurhash-js');
|
|
|
26
25
|
// 5. For composite `*-size` expressions: two zoom levels of curve stops that "cover" the zoom level of the
|
|
27
26
|
// bucket. These go into a vertex buffer and are used by the shader to interpolate the size at render time.
|
|
28
27
|
//
|
|
29
|
-
// (1) and (2) are stored in `bucket.layers[0].
|
|
28
|
+
// (1) and (2) are stored in `bucket.layers[0]._layout`. The remainder are below.
|
|
30
29
|
//
|
|
31
30
|
|
|
32
|
-
function performSymbolLayout(bucket, glyphMap, glyphPositions, imageMap, imagePositions, showCollisionBoxes) {
|
|
31
|
+
export function performSymbolLayout(bucket, glyphMap, glyphPositions, imageMap, imagePositions, showCollisionBoxes) {
|
|
33
32
|
bucket.createArrays();
|
|
34
33
|
|
|
35
34
|
const tileSize = 512 * bucket.overscaling;
|
|
@@ -37,7 +36,7 @@ function performSymbolLayout(bucket, glyphMap, glyphPositions, imageMap, imagePo
|
|
|
37
36
|
bucket.compareText = {};
|
|
38
37
|
bucket.iconsNeedLinear = false;
|
|
39
38
|
|
|
40
|
-
const layout = bucket.layers[0].
|
|
39
|
+
const layout = bucket.layers[0]._layout;
|
|
41
40
|
const unevaluatedLayoutValues = bucket.layers[0]._unevaluatedLayout._values;
|
|
42
41
|
|
|
43
42
|
const sizes = {};
|
|
@@ -172,7 +171,7 @@ function addFeature(bucket, feature, shapedTextOrientations, shapedIcon, glyphPo
|
|
|
172
171
|
textMaxSize = layoutTextSize;
|
|
173
172
|
}
|
|
174
173
|
|
|
175
|
-
const layout = bucket.layers[0].
|
|
174
|
+
const layout = bucket.layers[0]._layout;
|
|
176
175
|
const textOffset = layout.get('text-offset').evaluate(feature, {});
|
|
177
176
|
const iconOffset = layout.get('icon-offset').evaluate(feature, {});
|
|
178
177
|
|
|
@@ -301,7 +300,7 @@ function addTextVertices(
|
|
|
301
300
|
let textSizeData = null;
|
|
302
301
|
|
|
303
302
|
if (sizeData.functionType === 'source') {
|
|
304
|
-
textSizeData = [10 * layer.
|
|
303
|
+
textSizeData = [10 * layer._layout.get('text-size').evaluate(feature, {})];
|
|
305
304
|
} else if (sizeData.functionType === 'composite') {
|
|
306
305
|
textSizeData = [
|
|
307
306
|
10 * sizes.compositeTextSizes[0].evaluate(feature, {}),
|
|
@@ -370,7 +369,7 @@ function addSymbol(
|
|
|
370
369
|
if (shapedTextOrientations.horizontal) {
|
|
371
370
|
// As a collision approximation, we can use either the vertical or the horizontal version of the feature
|
|
372
371
|
// We're counting on the two versions having similar dimensions
|
|
373
|
-
const textRotate = layer.
|
|
372
|
+
const textRotate = layer._layout.get('text-rotate').evaluate(feature, {});
|
|
374
373
|
textCollisionFeature = new CollisionFeature(
|
|
375
374
|
collisionBoxArray,
|
|
376
375
|
line,
|
|
@@ -430,7 +429,7 @@ function addSymbol(
|
|
|
430
429
|
shapedTextOrientations.horizontal,
|
|
431
430
|
feature
|
|
432
431
|
);
|
|
433
|
-
const iconRotate = layer.
|
|
432
|
+
const iconRotate = layer._layout.get('icon-rotate').evaluate(feature, {});
|
|
434
433
|
iconCollisionFeature = new CollisionFeature(
|
|
435
434
|
collisionBoxArray,
|
|
436
435
|
line,
|
|
@@ -452,7 +451,7 @@ function addSymbol(
|
|
|
452
451
|
let iconSizeData = null;
|
|
453
452
|
|
|
454
453
|
if (sizeData.functionType === 'source') {
|
|
455
|
-
iconSizeData = [10 * layer.
|
|
454
|
+
iconSizeData = [10 * layer._layout.get('icon-size').evaluate(feature, {})];
|
|
456
455
|
} else if (sizeData.functionType === 'composite') {
|
|
457
456
|
iconSizeData = [
|
|
458
457
|
10 * sizes.compositeIconSizes[0].evaluate(feature, {}),
|
|
@@ -477,8 +476,9 @@ function addSymbol(
|
|
|
477
476
|
const iconBoxStartIndex = iconCollisionFeature ? iconCollisionFeature.boxStartIndex : bucket.collisionBoxArray.length;
|
|
478
477
|
const iconBoxEndIndex = iconCollisionFeature ? iconCollisionFeature.boxEndIndex : bucket.collisionBoxArray.length;
|
|
479
478
|
|
|
480
|
-
if (bucket.glyphOffsetArray.length >= SymbolBucket.MAX_GLYPHS)
|
|
479
|
+
if (bucket.glyphOffsetArray.length >= SymbolBucket.MAX_GLYPHS) {
|
|
481
480
|
warn.once('Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907');
|
|
481
|
+
}
|
|
482
482
|
|
|
483
483
|
bucket.symbolInstances.emplaceBack(
|
|
484
484
|
anchor.x,
|
|
@@ -515,7 +515,3 @@ function anchorIsTooClose(bucket, text, repeatDistance, anchor) {
|
|
|
515
515
|
compareText[text].push(anchor);
|
|
516
516
|
return false;
|
|
517
517
|
}
|
|
518
|
-
|
|
519
|
-
module.exports = {
|
|
520
|
-
performSymbolLayout
|
|
521
|
-
};
|