@mapwhit/tilerenderer 1.0.0 → 1.1.1
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 +114 -49
- 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 +64 -34
- 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 +54 -34
- 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/util/util.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const Coordinate = require('../geo/coordinate');
|
|
1
|
+
import UnitBezier from '@mapbox/unitbezier';
|
|
2
|
+
import Coordinate from '../geo/coordinate.js';
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* @module util
|
|
@@ -14,9 +13,13 @@ const Coordinate = require('../geo/coordinate');
|
|
|
14
13
|
*
|
|
15
14
|
* @private
|
|
16
15
|
*/
|
|
17
|
-
function easeCubicInOut(t) {
|
|
18
|
-
if (t <= 0)
|
|
19
|
-
|
|
16
|
+
export function easeCubicInOut(t) {
|
|
17
|
+
if (t <= 0) {
|
|
18
|
+
return 0;
|
|
19
|
+
}
|
|
20
|
+
if (t >= 1) {
|
|
21
|
+
return 1;
|
|
22
|
+
}
|
|
20
23
|
const t2 = t * t;
|
|
21
24
|
const t3 = t2 * t;
|
|
22
25
|
return 4 * (t < 0.5 ? t3 : 3 * (t - t2) + t3 - 0.75);
|
|
@@ -32,7 +35,7 @@ function easeCubicInOut(t) {
|
|
|
32
35
|
* @param p2y control point 2 y coordinate
|
|
33
36
|
* @private
|
|
34
37
|
*/
|
|
35
|
-
function bezier(p1x, p1y, p2x, p2y) {
|
|
38
|
+
export function bezier(p1x, p1y, p2x, p2y) {
|
|
36
39
|
const bezier = new UnitBezier(p1x, p1y, p2x, p2y);
|
|
37
40
|
return function (t) {
|
|
38
41
|
return bezier.solve(t);
|
|
@@ -45,7 +48,7 @@ function bezier(p1x, p1y, p2x, p2y) {
|
|
|
45
48
|
*
|
|
46
49
|
* @private
|
|
47
50
|
*/
|
|
48
|
-
const ease = bezier(0.25, 0.1, 0.25, 1);
|
|
51
|
+
export const ease = bezier(0.25, 0.1, 0.25, 1);
|
|
49
52
|
|
|
50
53
|
/**
|
|
51
54
|
* constrain n to the given range via min + max
|
|
@@ -56,7 +59,7 @@ const ease = bezier(0.25, 0.1, 0.25, 1);
|
|
|
56
59
|
* @returns the clamped value
|
|
57
60
|
* @private
|
|
58
61
|
*/
|
|
59
|
-
function clamp(n, min, max) {
|
|
62
|
+
export function clamp(n, min, max) {
|
|
60
63
|
return Math.min(max, Math.max(min, n));
|
|
61
64
|
}
|
|
62
65
|
|
|
@@ -69,7 +72,7 @@ function clamp(n, min, max) {
|
|
|
69
72
|
* @returns constrained number
|
|
70
73
|
* @private
|
|
71
74
|
*/
|
|
72
|
-
function wrap(n, min, max) {
|
|
75
|
+
export function wrap(n, min, max) {
|
|
73
76
|
const d = max - min;
|
|
74
77
|
const w = ((((n - min) % d) + d) % d) + min;
|
|
75
78
|
return w === min ? max : w;
|
|
@@ -81,7 +84,7 @@ function wrap(n, min, max) {
|
|
|
81
84
|
* @returns centerpoint
|
|
82
85
|
* @private
|
|
83
86
|
*/
|
|
84
|
-
function getCoordinatesCenter(coords) {
|
|
87
|
+
export function getCoordinatesCenter(coords) {
|
|
85
88
|
let minX = Number.POSITIVE_INFINITY;
|
|
86
89
|
let minY = Number.POSITIVE_INFINITY;
|
|
87
90
|
let maxX = Number.NEGATIVE_INFINITY;
|
|
@@ -108,7 +111,7 @@ function getCoordinatesCenter(coords) {
|
|
|
108
111
|
* @returns true for a counter clockwise set of points
|
|
109
112
|
*/
|
|
110
113
|
// http://bryceboe.com/2006/10/23/line-segment-intersection-algorithm/
|
|
111
|
-
function isCounterClockwise(a, b, c) {
|
|
114
|
+
export function isCounterClockwise(a, b, c) {
|
|
112
115
|
return (c.y - a.y) * (b.x - a.x) > (b.y - a.y) * (c.x - a.x);
|
|
113
116
|
}
|
|
114
117
|
|
|
@@ -120,7 +123,7 @@ function isCounterClockwise(a, b, c) {
|
|
|
120
123
|
* @private
|
|
121
124
|
* @param ring Exterior or interior ring
|
|
122
125
|
*/
|
|
123
|
-
function calculateSignedArea(ring) {
|
|
126
|
+
export function calculateSignedArea(ring) {
|
|
124
127
|
let sum = 0;
|
|
125
128
|
const len = ring.length;
|
|
126
129
|
let p2 = ring[len - 1]; // last point
|
|
@@ -138,10 +141,12 @@ function calculateSignedArea(ring) {
|
|
|
138
141
|
* @param points array of points
|
|
139
142
|
* @return true if the points are a closed polygon
|
|
140
143
|
*/
|
|
141
|
-
function isClosedPolygon(points) {
|
|
144
|
+
export function isClosedPolygon(points) {
|
|
142
145
|
// If it is 2 points that are the same then it is a point
|
|
143
146
|
// If it is 3 points with start and end the same then it is a line
|
|
144
|
-
if (points.length < 4)
|
|
147
|
+
if (points.length < 4) {
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
145
150
|
|
|
146
151
|
const p1 = points[0];
|
|
147
152
|
const p2 = points[points.length - 1];
|
|
@@ -162,7 +167,7 @@ function isClosedPolygon(points) {
|
|
|
162
167
|
* @return cartesian coordinates in [x, y, z]
|
|
163
168
|
*/
|
|
164
169
|
|
|
165
|
-
function sphericalToCartesian([r, azimuthal, polar]) {
|
|
170
|
+
export function sphericalToCartesian([r, azimuthal, polar]) {
|
|
166
171
|
// We abstract "north"/"up" (compass-wise) to be 0° when really this is 90° (π/2):
|
|
167
172
|
// correct for that here
|
|
168
173
|
azimuthal += 90;
|
|
@@ -177,16 +182,3 @@ function sphericalToCartesian([r, azimuthal, polar]) {
|
|
|
177
182
|
z: r * Math.cos(polar)
|
|
178
183
|
};
|
|
179
184
|
}
|
|
180
|
-
|
|
181
|
-
module.exports = {
|
|
182
|
-
easeCubicInOut,
|
|
183
|
-
bezier,
|
|
184
|
-
ease,
|
|
185
|
-
clamp,
|
|
186
|
-
wrap,
|
|
187
|
-
getCoordinatesCenter,
|
|
188
|
-
isCounterClockwise,
|
|
189
|
-
calculateSignedArea,
|
|
190
|
-
isClosedPolygon,
|
|
191
|
-
sphericalToCartesian
|
|
192
|
-
};
|
|
@@ -34,11 +34,13 @@ class Feature {
|
|
|
34
34
|
geometry: this.geometry
|
|
35
35
|
};
|
|
36
36
|
for (const i in this) {
|
|
37
|
-
if (i === '_geometry' || i === '_vectorTileFeature')
|
|
37
|
+
if (i === '_geometry' || i === '_vectorTileFeature') {
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
38
40
|
json[i] = this[i];
|
|
39
41
|
}
|
|
40
42
|
return json;
|
|
41
43
|
}
|
|
42
44
|
}
|
|
43
45
|
|
|
44
|
-
|
|
46
|
+
export default Feature;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { charHasRotatedVerticalOrientation } from './script_detection.js';
|
|
2
2
|
|
|
3
|
-
const verticalizedCharacterMap = {
|
|
3
|
+
export const verticalizedCharacterMap = {
|
|
4
4
|
'!': '︕',
|
|
5
5
|
'#': '#',
|
|
6
6
|
$: '$',
|
|
@@ -86,7 +86,7 @@ const verticalizedCharacterMap = {
|
|
|
86
86
|
'」': '﹂'
|
|
87
87
|
};
|
|
88
88
|
|
|
89
|
-
function verticalizePunctuation(input) {
|
|
89
|
+
export default function verticalizePunctuation(input) {
|
|
90
90
|
let output = '';
|
|
91
91
|
|
|
92
92
|
for (let i = 0; i < input.length; i++) {
|
|
@@ -106,7 +106,3 @@ function verticalizePunctuation(input) {
|
|
|
106
106
|
|
|
107
107
|
return output;
|
|
108
108
|
}
|
|
109
|
-
|
|
110
|
-
verticalizePunctuation.verticalizedCharacterMap = verticalizedCharacterMap;
|
|
111
|
-
|
|
112
|
-
module.exports = verticalizePunctuation;
|
package/src/util/warn.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
const warnOnceHistory = {};
|
|
8
8
|
|
|
9
|
-
function
|
|
9
|
+
function warnOnce(message) {
|
|
10
10
|
if (!warnOnceHistory[message]) {
|
|
11
11
|
console.warn(message);
|
|
12
12
|
warnOnceHistory[message] = true;
|
|
@@ -15,7 +15,7 @@ function once(message) {
|
|
|
15
15
|
|
|
16
16
|
function noop() {}
|
|
17
17
|
|
|
18
|
+
const once = typeof console !== 'undefined' ? warnOnce : noop;
|
|
19
|
+
|
|
18
20
|
// console isn't defined in some WebWorkers, see #2558
|
|
19
|
-
|
|
20
|
-
once: typeof console !== 'undefined' ? once : noop
|
|
21
|
-
};
|
|
21
|
+
export default { once };
|
package/src/util/web_worker.js
CHANGED