@mapwhit/tilerenderer 1.0.0 → 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/build/min/package.json +2 -1
- package/build/min/src/shaders/_prelude.fragment.glsl.js +1 -1
- package/build/min/src/shaders/_prelude.vertex.glsl.js +1 -1
- package/build/min/src/shaders/background.fragment.glsl.js +1 -1
- package/build/min/src/shaders/background.vertex.glsl.js +1 -1
- package/build/min/src/shaders/background_pattern.fragment.glsl.js +1 -1
- package/build/min/src/shaders/background_pattern.vertex.glsl.js +1 -1
- package/build/min/src/shaders/circle.fragment.glsl.js +1 -1
- package/build/min/src/shaders/circle.vertex.glsl.js +1 -1
- 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 +1 -1
- package/build/min/src/shaders/fill.vertex.glsl.js +1 -1
- package/build/min/src/shaders/fill_extrusion.fragment.glsl.js +1 -1
- package/build/min/src/shaders/fill_extrusion.vertex.glsl.js +1 -1
- package/build/min/src/shaders/fill_extrusion_pattern.fragment.glsl.js +1 -1
- package/build/min/src/shaders/fill_extrusion_pattern.vertex.glsl.js +1 -1
- package/build/min/src/shaders/fill_outline.fragment.glsl.js +1 -1
- package/build/min/src/shaders/fill_outline.vertex.glsl.js +1 -1
- package/build/min/src/shaders/fill_outline_pattern.fragment.glsl.js +1 -1
- package/build/min/src/shaders/fill_outline_pattern.vertex.glsl.js +1 -1
- package/build/min/src/shaders/fill_pattern.fragment.glsl.js +1 -1
- package/build/min/src/shaders/fill_pattern.vertex.glsl.js +1 -1
- package/build/min/src/shaders/heatmap.fragment.glsl.js +1 -1
- package/build/min/src/shaders/heatmap.vertex.glsl.js +1 -1
- package/build/min/src/shaders/heatmap_texture.fragment.glsl.js +1 -1
- package/build/min/src/shaders/heatmap_texture.vertex.glsl.js +1 -1
- package/build/min/src/shaders/hillshade.fragment.glsl.js +1 -1
- package/build/min/src/shaders/hillshade.vertex.glsl.js +1 -1
- package/build/min/src/shaders/hillshade_prepare.fragment.glsl.js +1 -1
- package/build/min/src/shaders/hillshade_prepare.vertex.glsl.js +1 -1
- package/build/min/src/shaders/line.fragment.glsl.js +1 -1
- package/build/min/src/shaders/line.vertex.glsl.js +1 -1
- package/build/min/src/shaders/line_gradient.fragment.glsl.js +1 -1
- package/build/min/src/shaders/line_gradient.vertex.glsl.js +1 -1
- package/build/min/src/shaders/line_pattern.fragment.glsl.js +1 -1
- package/build/min/src/shaders/line_pattern.vertex.glsl.js +1 -1
- package/build/min/src/shaders/line_sdf.fragment.glsl.js +1 -1
- package/build/min/src/shaders/line_sdf.vertex.glsl.js +1 -1
- package/build/min/src/shaders/raster.fragment.glsl.js +1 -1
- package/build/min/src/shaders/raster.vertex.glsl.js +1 -1
- package/build/min/src/shaders/symbol_icon.fragment.glsl.js +1 -1
- package/build/min/src/shaders/symbol_icon.vertex.glsl.js +1 -1
- package/build/min/src/shaders/symbol_sdf.fragment.glsl.js +1 -1
- package/build/min/src/shaders/symbol_sdf.vertex.glsl.js +1 -1
- package/package.json +3 -2
- package/src/data/array_types.js +54 -81
- package/src/data/bucket/circle_attributes.js +2 -4
- package/src/data/bucket/circle_bucket.js +19 -13
- package/src/data/bucket/fill_attributes.js +2 -4
- package/src/data/bucket/fill_bucket.js +38 -24
- package/src/data/bucket/fill_extrusion_attributes.js +2 -4
- package/src/data/bucket/fill_extrusion_bucket.js +56 -34
- package/src/data/bucket/heatmap_bucket.js +2 -7
- package/src/data/bucket/line_attributes.js +2 -4
- package/src/data/bucket/line_bucket.js +207 -159
- package/src/data/bucket/pattern_attributes.js +2 -4
- package/src/data/bucket/pattern_bucket_features.js +5 -7
- package/src/data/bucket/symbol_attributes.js +12 -26
- package/src/data/bucket/symbol_bucket.js +111 -221
- package/src/data/bucket/symbol_buffers.js +62 -0
- package/src/data/bucket/symbol_collision_buffers.js +33 -0
- package/src/data/bucket.js +2 -6
- package/src/data/dem_data.js +11 -7
- package/src/data/extent.js +1 -1
- package/src/data/feature_index.js +35 -20
- 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 +44 -26
- package/src/data/raster_bounds_attributes.js +2 -2
- package/src/data/segment.js +4 -3
- 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 +14 -9
- package/src/render/draw_circle.js +11 -8
- package/src/render/draw_collision_debug.js +11 -8
- package/src/render/draw_debug.js +16 -14
- package/src/render/draw_fill.js +19 -12
- package/src/render/draw_fill_extrusion.js +12 -9
- package/src/render/draw_heatmap.js +17 -12
- package/src/render/draw_hillshade.js +12 -9
- package/src/render/draw_line.js +30 -16
- package/src/render/draw_raster.js +17 -13
- package/src/render/draw_symbol.js +22 -17
- package/src/render/glyph_atlas.js +9 -5
- package/src/render/glyph_manager.js +1 -1
- package/src/render/image_atlas.js +4 -7
- package/src/render/image_manager.js +6 -9
- package/src/render/line_atlas.js +2 -2
- package/src/render/painter.js +65 -47
- package/src/render/program/background_program.js +6 -13
- package/src/render/program/circle_program.js +4 -6
- 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 +8 -14
- package/src/render/program/fill_program.js +10 -21
- package/src/render/program/heatmap_program.js +8 -14
- package/src/render/program/hillshade_program.js +10 -16
- package/src/render/program/line_program.js +11 -22
- package/src/render/program/pattern.js +5 -7
- package/src/render/program/program_uniforms.js +13 -20
- package/src/render/program/raster_program.js +3 -5
- 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 +11 -7
- package/src/source/geojson_worker_source.js +7 -7
- package/src/source/geojson_wrapper.js +4 -4
- package/src/source/image_source.js +11 -12
- package/src/source/load_tilejson.js +3 -3
- package/src/source/pixels_to_tile_units.js +3 -3
- package/src/source/query_features.js +13 -10
- package/src/source/raster_dem_tile_source.js +12 -10
- package/src/source/raster_tile_source.js +13 -9
- package/src/source/resources/glyphs.js +2 -3
- package/src/source/resources/index.js +2 -4
- package/src/source/rtl_text_plugin.js +8 -8
- package/src/source/source.js +9 -15
- package/src/source/source_cache.js +105 -47
- package/src/source/source_state.js +37 -14
- package/src/source/tile.js +38 -23
- package/src/source/tile_bounds.js +15 -8
- package/src/source/tile_cache.js +2 -2
- package/src/source/tile_id.js +30 -23
- package/src/source/vector_tile_source.js +10 -8
- package/src/source/vector_tile_worker_source.js +4 -4
- package/src/source/worker_tile.js +24 -22
- 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 +3 -4
- package/src/style/properties.js +21 -44
- package/src/style/query_utils.js +4 -10
- package/src/style/style.js +58 -33
- 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 +12 -9
- package/src/style/style_layer/circle_style_layer_properties.js +2 -2
- package/src/style/style_layer/fill_extrusion_style_layer.js +16 -13
- package/src/style/style_layer/fill_extrusion_style_layer_properties.js +2 -2
- package/src/style/style_layer/fill_style_layer.js +6 -7
- package/src/style/style_layer/fill_style_layer_properties.js +2 -2
- package/src/style/style_layer/heatmap_style_layer.js +5 -6
- package/src/style/style_layer/heatmap_style_layer_properties.js +2 -2
- package/src/style/style_layer/hillshade_style_layer.js +3 -4
- package/src/style/style_layer/hillshade_style_layer_properties.js +2 -2
- package/src/style/style_layer/line_style_layer.js +10 -11
- 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 +7 -8
- package/src/style/style_layer/symbol_style_layer_properties.js +2 -2
- package/src/style/style_layer.js +21 -20
- package/src/style/style_layer_index.js +2 -2
- 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 -2
- 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 +5 -5
- 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 -1
- package/src/symbol/placement.js +25 -20
- package/src/symbol/projection.js +29 -28
- package/src/symbol/quads.js +10 -12
- package/src/symbol/shaping.js +27 -19
- package/src/symbol/symbol_layout.js +17 -21
- package/src/symbol/symbol_size.js +13 -12
- package/src/symbol/transform_text.js +3 -3
- package/src/ui/camera.js +34 -18
- package/src/ui/map.js +53 -33
- 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 +1 -1
- package/src/util/image.js +3 -8
- 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 +7 -3
- package/src/util/loader/image.js +1 -1
- package/src/util/object.js +25 -23
- 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/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,7 +96,9 @@ 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
|
|
|
@@ -399,17 +401,25 @@ 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
424
|
const layout = bucket.layers[0]._layout;
|
|
415
425
|
const duplicateOpacityState = new JointOpacityState(null, 0, false, false, true);
|
|
@@ -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,7 +19,7 @@ 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
24
|
const layout = layer._layout;
|
|
26
25
|
|
|
@@ -92,7 +91,7 @@ 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
96
|
const textRotate = (layer._layout.get('text-rotate').evaluate(feature, {}) * Math.PI) / 180;
|
|
98
97
|
const textOffset = layer._layout
|
|
@@ -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:
|
|
@@ -29,7 +28,7 @@ const murmur3 = require('murmurhash-js');
|
|
|
29
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;
|
|
@@ -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
|
-
};
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const EvaluationParameters = require('../style/evaluation_parameters');
|
|
6
|
-
|
|
7
|
-
module.exports = { getSizeData, evaluateSizeForFeature, evaluateSizeForZoom };
|
|
1
|
+
import { normalizePropertyExpression } from '@mapwhit/style-expressions';
|
|
2
|
+
import EvaluationParameters from '../style/evaluation_parameters.js';
|
|
3
|
+
import interpolate from '../util/interpolate.js';
|
|
4
|
+
import { clamp } from '../util/util.js';
|
|
8
5
|
|
|
9
6
|
// For {text,icon}-size, get the bucket-level data that will be needed by
|
|
10
7
|
// the painter to set symbol-size-related uniforms
|
|
11
|
-
function getSizeData(tileZoom, value) {
|
|
8
|
+
export function getSizeData(tileZoom, value) {
|
|
12
9
|
const { expression } = value;
|
|
13
10
|
if (expression.kind === 'constant') {
|
|
14
11
|
return {
|
|
@@ -25,10 +22,14 @@ function getSizeData(tileZoom, value) {
|
|
|
25
22
|
const levels = expression.zoomStops;
|
|
26
23
|
|
|
27
24
|
let lower = 0;
|
|
28
|
-
while (lower < levels.length && levels[lower] <= tileZoom)
|
|
25
|
+
while (lower < levels.length && levels[lower] <= tileZoom) {
|
|
26
|
+
lower++;
|
|
27
|
+
}
|
|
29
28
|
lower = Math.max(0, lower - 1);
|
|
30
29
|
let upper = lower;
|
|
31
|
-
while (upper < levels.length && levels[upper] < tileZoom + 1)
|
|
30
|
+
while (upper < levels.length && levels[upper] < tileZoom + 1) {
|
|
31
|
+
upper++;
|
|
32
|
+
}
|
|
32
33
|
upper = Math.min(levels.length - 1, upper);
|
|
33
34
|
|
|
34
35
|
const zoomRange = {
|
|
@@ -60,7 +61,7 @@ function getSizeData(tileZoom, value) {
|
|
|
60
61
|
};
|
|
61
62
|
}
|
|
62
63
|
|
|
63
|
-
function evaluateSizeForFeature(sizeData, partiallyEvaluatedSize, symbol) {
|
|
64
|
+
export function evaluateSizeForFeature(sizeData, partiallyEvaluatedSize, symbol) {
|
|
64
65
|
const part = partiallyEvaluatedSize;
|
|
65
66
|
if (sizeData.functionType === 'source') {
|
|
66
67
|
return symbol.lowerSize / 10;
|
|
@@ -71,7 +72,7 @@ function evaluateSizeForFeature(sizeData, partiallyEvaluatedSize, symbol) {
|
|
|
71
72
|
return part.uSize;
|
|
72
73
|
}
|
|
73
74
|
|
|
74
|
-
function evaluateSizeForZoom(sizeData, currentZoom, property) {
|
|
75
|
+
export function evaluateSizeForZoom(sizeData, currentZoom, property) {
|
|
75
76
|
if (sizeData.functionType === 'constant') {
|
|
76
77
|
return {
|
|
77
78
|
uSizeT: 0,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { plugin as rtlTextPlugin } from '../source/rtl_text_plugin.js';
|
|
2
2
|
|
|
3
3
|
function transformText(text, layer, feature) {
|
|
4
4
|
const transform = layer._layout.get('text-transform').evaluate(feature, {});
|
|
@@ -15,9 +15,9 @@ function transformText(text, layer, feature) {
|
|
|
15
15
|
return text;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
export default function (text, layer, feature) {
|
|
19
19
|
text.sections.forEach(section => {
|
|
20
20
|
section.text = transformText(section.text, layer, feature);
|
|
21
21
|
});
|
|
22
22
|
return text;
|
|
23
|
-
}
|
|
23
|
+
}
|
package/src/ui/camera.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import Point from '@mapbox/point-geometry';
|
|
2
|
+
import { Event, Evented } from '@mapwhit/events';
|
|
3
|
+
import LngLat from '../geo/lng_lat.js';
|
|
4
|
+
import LngLatBounds from '../geo/lng_lat_bounds.js';
|
|
5
|
+
import browser from '../util/browser.js';
|
|
6
|
+
import interpolate from '../util/interpolate.js';
|
|
7
|
+
import { deepEqual } from '../util/object.js';
|
|
8
|
+
import { clamp, ease as defaultEasing, wrap } from '../util/util.js';
|
|
9
|
+
import warn from '../util/warn.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Options common to {@link Map#jumpTo}, {@link Map#easeTo}, and {@link Map#flyTo}, controlling the desired location,
|
|
@@ -354,8 +354,12 @@ class Camera extends Evented {
|
|
|
354
354
|
if (
|
|
355
355
|
!deepEqual(
|
|
356
356
|
Object.keys(options.padding).sort((a, b) => {
|
|
357
|
-
if (a < b)
|
|
358
|
-
|
|
357
|
+
if (a < b) {
|
|
358
|
+
return -1;
|
|
359
|
+
}
|
|
360
|
+
if (a > b) {
|
|
361
|
+
return 1;
|
|
362
|
+
}
|
|
359
363
|
return 0;
|
|
360
364
|
}),
|
|
361
365
|
['bottom', 'left', 'right', 'top']
|
|
@@ -429,7 +433,9 @@ class Camera extends Evented {
|
|
|
429
433
|
const calculatedOptions = this.cameraForBounds(bounds, options);
|
|
430
434
|
|
|
431
435
|
// cameraForBounds warns + returns undefined if unable to fit:
|
|
432
|
-
if (!calculatedOptions)
|
|
436
|
+
if (!calculatedOptions) {
|
|
437
|
+
return this;
|
|
438
|
+
}
|
|
433
439
|
|
|
434
440
|
options = Object.assign(calculatedOptions, options);
|
|
435
441
|
|
|
@@ -542,7 +548,9 @@ class Camera extends Evented {
|
|
|
542
548
|
...options
|
|
543
549
|
};
|
|
544
550
|
|
|
545
|
-
if (options.animate === false)
|
|
551
|
+
if (options.animate === false) {
|
|
552
|
+
options.duration = 0;
|
|
553
|
+
}
|
|
546
554
|
|
|
547
555
|
const tr = this.transform;
|
|
548
556
|
const startZoom = this.getZoom();
|
|
@@ -820,7 +828,9 @@ class Camera extends Evented {
|
|
|
820
828
|
// When u₀ = u₁, the optimal path doesn’t require both ascent and descent.
|
|
821
829
|
if (Math.abs(u1) < 0.000001 || !Number.isFinite(S)) {
|
|
822
830
|
// Perform a more or less instantaneous transition if the path is too short.
|
|
823
|
-
if (Math.abs(w0 - w1) < 0.000001)
|
|
831
|
+
if (Math.abs(w0 - w1) < 0.000001) {
|
|
832
|
+
return this.easeTo(options, eventData);
|
|
833
|
+
}
|
|
824
834
|
|
|
825
835
|
const k = w1 < w0 ? -1 : 1;
|
|
826
836
|
S = Math.abs(Math.log(w1 / w0)) / rho;
|
|
@@ -932,8 +942,12 @@ class Camera extends Evented {
|
|
|
932
942
|
_normalizeBearing(bearing, currentBearing) {
|
|
933
943
|
bearing = wrap(bearing, -180, 180);
|
|
934
944
|
const diff = Math.abs(bearing - currentBearing);
|
|
935
|
-
if (Math.abs(bearing - 360 - currentBearing) < diff)
|
|
936
|
-
|
|
945
|
+
if (Math.abs(bearing - 360 - currentBearing) < diff) {
|
|
946
|
+
bearing -= 360;
|
|
947
|
+
}
|
|
948
|
+
if (Math.abs(bearing + 360 - currentBearing) < diff) {
|
|
949
|
+
bearing += 360;
|
|
950
|
+
}
|
|
937
951
|
return bearing;
|
|
938
952
|
}
|
|
939
953
|
|
|
@@ -941,11 +955,13 @@ class Camera extends Evented {
|
|
|
941
955
|
// interpolating between the two endpoints will cross it.
|
|
942
956
|
_normalizeCenter(center) {
|
|
943
957
|
const tr = this.transform;
|
|
944
|
-
if (!tr.renderWorldCopies || tr.lngRange)
|
|
958
|
+
if (!tr.renderWorldCopies || tr.lngRange) {
|
|
959
|
+
return;
|
|
960
|
+
}
|
|
945
961
|
|
|
946
962
|
const delta = center.lng - tr.center.lng;
|
|
947
963
|
center.lng += delta > 180 ? -360 : delta < -180 ? 360 : 0;
|
|
948
964
|
}
|
|
949
965
|
}
|
|
950
966
|
|
|
951
|
-
|
|
967
|
+
export default Camera;
|