@vaadin/bundles 25.0.0-alpha3 → 25.0.0-alpha5
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/node_modules_ol_ImageCanvas_js.js +76 -83
- package/node_modules_ol_ImageCanvas_js.js.map +1 -1
- package/node_modules_ol_TileRange_js.js +128 -110
- package/node_modules_ol_TileRange_js.js.map +1 -1
- package/node_modules_ol_Tile_js.js +279 -0
- package/node_modules_ol_Tile_js.js.map +1 -0
- package/node_modules_ol_VectorRenderTile_js.js +428 -143
- package/node_modules_ol_VectorRenderTile_js.js.map +1 -1
- package/node_modules_ol_VectorTile_js.js +405 -119
- package/node_modules_ol_VectorTile_js.js.map +1 -1
- package/node_modules_ol_control_MousePosition_js.js +327 -0
- package/node_modules_ol_control_MousePosition_js.js.map +1 -0
- package/node_modules_ol_control_ZoomToExtent_js.js +118 -0
- package/node_modules_ol_control_ZoomToExtent_js.js.map +1 -0
- package/node_modules_ol_events_SnapEvent_js.js +79 -0
- package/node_modules_ol_events_SnapEvent_js.js.map +1 -0
- package/node_modules_ol_featureloader_js.js +205 -0
- package/node_modules_ol_featureloader_js.js.map +1 -0
- package/node_modules_ol_geom_Circle_js.js +300 -0
- package/node_modules_ol_geom_Circle_js.js.map +1 -0
- package/node_modules_ol_geom_GeometryCollection_js.js +369 -0
- package/node_modules_ol_geom_GeometryCollection_js.js.map +1 -0
- package/node_modules_ol_geom_MultiPoint_js.js +228 -0
- package/node_modules_ol_geom_MultiPoint_js.js.map +1 -0
- package/node_modules_ol_geom_flat_center_js.js +47 -0
- package/node_modules_ol_geom_flat_center_js.js.map +1 -0
- package/node_modules_ol_geom_flat_geodesic_js.js +123 -88
- package/node_modules_ol_geom_flat_geodesic_js.js.map +1 -1
- package/node_modules_ol_geom_flat_interpolate_js.js +230 -0
- package/node_modules_ol_geom_flat_interpolate_js.js.map +1 -0
- package/node_modules_ol_geom_flat_length_js-_375a0.js +58 -0
- package/node_modules_ol_geom_flat_length_js-_375a0.js.map +1 -0
- package/node_modules_ol_geom_flat_length_js-_375a1.js +58 -0
- package/node_modules_ol_geom_flat_length_js-_375a1.js.map +1 -0
- package/node_modules_ol_geom_flat_length_js-_375a2.js +58 -0
- package/node_modules_ol_geom_flat_length_js-_375a2.js.map +1 -0
- package/node_modules_ol_geom_flat_length_js-_375a3.js +58 -0
- package/node_modules_ol_geom_flat_length_js-_375a3.js.map +1 -0
- package/node_modules_ol_geom_flat_length_js-_375a4.js +58 -0
- package/node_modules_ol_geom_flat_length_js-_375a4.js.map +1 -0
- package/node_modules_ol_geom_flat_linechunk_js.js +76 -0
- package/node_modules_ol_geom_flat_linechunk_js.js.map +1 -0
- package/node_modules_ol_geom_flat_straightchunk_js.js +68 -0
- package/node_modules_ol_geom_flat_straightchunk_js.js.map +1 -0
- package/node_modules_ol_geom_flat_textpath_js.js +178 -0
- package/node_modules_ol_geom_flat_textpath_js.js.map +1 -0
- package/node_modules_ol_interaction_DblClickDragZoom_js.js +285 -0
- package/node_modules_ol_interaction_DblClickDragZoom_js.js.map +1 -0
- package/node_modules_ol_interaction_DragAndDrop_js.js +351 -0
- package/node_modules_ol_interaction_DragAndDrop_js.js.map +1 -0
- package/node_modules_ol_interaction_DragRotateAndZoom_js.js +159 -0
- package/node_modules_ol_interaction_DragRotateAndZoom_js.js.map +1 -0
- package/node_modules_ol_layer_Vector_js-_49290.js +110 -0
- package/node_modules_ol_layer_Vector_js-_49290.js.map +1 -0
- package/node_modules_ol_layer_Vector_js-_49291.js +110 -0
- package/node_modules_ol_layer_Vector_js-_49291.js.map +1 -0
- package/node_modules_ol_layer_Vector_js-_49292.js +110 -0
- package/node_modules_ol_layer_Vector_js-_49292.js.map +1 -0
- package/node_modules_ol_layer_Vector_js-_49293.js +110 -0
- package/node_modules_ol_layer_Vector_js-_49293.js.map +1 -0
- package/node_modules_ol_loadingstrategy_js.js +95 -0
- package/node_modules_ol_loadingstrategy_js.js.map +1 -0
- package/node_modules_ol_render_VectorContext_js-_3ad60.js +144 -0
- package/node_modules_ol_render_VectorContext_js-_3ad60.js.map +1 -0
- package/node_modules_ol_render_VectorContext_js-_3ad61.js +144 -0
- package/node_modules_ol_render_VectorContext_js-_3ad61.js.map +1 -0
- package/node_modules_ol_render_VectorContext_js-node_modules_ol_render_canvas_hitdetect_js.js +372 -0
- package/node_modules_ol_render_VectorContext_js-node_modules_ol_render_canvas_hitdetect_js.js.map +1 -0
- package/node_modules_ol_render_canvas_ImageBuilder_js.js +318 -0
- package/node_modules_ol_render_canvas_ImageBuilder_js.js.map +1 -0
- package/node_modules_ol_render_canvas_Instruction_js.js +66 -0
- package/node_modules_ol_render_canvas_Instruction_js.js.map +1 -0
- package/node_modules_ol_render_canvas_LineStringBuilder_js.js +187 -0
- package/node_modules_ol_render_canvas_LineStringBuilder_js.js.map +1 -0
- package/node_modules_ol_render_canvas_PolygonBuilder_js.js +276 -0
- package/node_modules_ol_render_canvas_PolygonBuilder_js.js.map +1 -0
- package/node_modules_ol_render_canvas_ZIndexContext_js-_fab20.js +156 -0
- package/node_modules_ol_render_canvas_ZIndexContext_js-_fab20.js.map +1 -0
- package/node_modules_ol_render_canvas_ZIndexContext_js-_fab21.js +156 -0
- package/node_modules_ol_render_canvas_ZIndexContext_js-_fab21.js.map +1 -0
- package/node_modules_ol_render_js-node_modules_ol_render_VectorContext_js.js +301 -0
- package/node_modules_ol_render_js-node_modules_ol_render_VectorContext_js.js.map +1 -0
- package/node_modules_ol_renderer_Layer_js.js +219 -0
- package/node_modules_ol_renderer_Layer_js.js.map +1 -0
- package/node_modules_ol_source_Source_js.js +256 -0
- package/node_modules_ol_source_Source_js.js.map +1 -0
- package/node_modules_ol_source_VectorEventType_js-node_modules_ol_structs_RBush_js.js +318 -0
- package/node_modules_ol_source_VectorEventType_js-node_modules_ol_structs_RBush_js.js.map +1 -0
- package/node_modules_ol_source_VectorEventType_js.js +80 -0
- package/node_modules_ol_source_VectorEventType_js.js.map +1 -0
- package/node_modules_ol_structs_RBush_js.js +242 -0
- package/node_modules_ol_structs_RBush_js.js.map +1 -0
- package/node_modules_ol_style_js.js +2 -1
- package/node_modules_ol_style_js.js.map +1 -1
- package/node_modules_rbush_rbush_min_js.js +16 -0
- package/node_modules_rbush_rbush_min_js.js.map +1 -0
- package/package.json +142 -146
- package/vaadin-bundle.json +2447 -2352
- package/vaadin.js +52246 -63791
- package/vaadin.js.map +1 -1
- package/vendors-node_modules_dompurify_dist_purify_es_mjs.js +1364 -0
- package/vendors-node_modules_dompurify_dist_purify_es_mjs.js.map +1 -0
- package/vendors-node_modules_dompurify_dist_purify_js.js +26 -21
- package/vendors-node_modules_dompurify_dist_purify_js.js.map +1 -1
- package/vendors-node_modules_marked_lib_marked_esm_js.js +2205 -0
- package/vendors-node_modules_marked_lib_marked_esm_js.js.map +1 -0
- package/vendors-node_modules_marked_lib_marked_umd_js.js +2164 -2556
- package/vendors-node_modules_marked_lib_marked_umd_js.js.map +1 -1
- package/vendors-node_modules_ol_Feature_js.js +360 -0
- package/vendors-node_modules_ol_Feature_js.js.map +1 -0
- package/vendors-node_modules_ol_Geolocation_js.js +352 -293
- package/vendors-node_modules_ol_Geolocation_js.js.map +1 -1
- package/vendors-node_modules_ol_ImageTile_js.js +494 -0
- package/vendors-node_modules_ol_ImageTile_js.js.map +1 -0
- package/vendors-node_modules_ol_Overlay_js.js +606 -0
- package/vendors-node_modules_ol_Overlay_js.js.map +1 -0
- package/vendors-node_modules_ol_control_FullScreen_js.js +417 -0
- package/vendors-node_modules_ol_control_FullScreen_js.js.map +1 -0
- package/vendors-node_modules_ol_control_OverviewMap_js.js +711 -0
- package/vendors-node_modules_ol_control_OverviewMap_js.js.map +1 -0
- package/vendors-node_modules_ol_control_ScaleLine_js.js +509 -0
- package/vendors-node_modules_ol_control_ScaleLine_js.js.map +1 -0
- package/vendors-node_modules_ol_control_ZoomSlider_js.js +418 -0
- package/vendors-node_modules_ol_control_ZoomSlider_js.js.map +1 -0
- package/vendors-node_modules_ol_control_js.js +490 -0
- package/vendors-node_modules_ol_control_js.js.map +1 -0
- package/vendors-node_modules_ol_geom_LineString_js.js +574 -0
- package/vendors-node_modules_ol_geom_LineString_js.js.map +1 -0
- package/vendors-node_modules_ol_geom_MultiLineString_js.js +405 -0
- package/vendors-node_modules_ol_geom_MultiLineString_js.js.map +1 -0
- package/vendors-node_modules_ol_geom_MultiPolygon_js.js +773 -0
- package/vendors-node_modules_ol_geom_MultiPolygon_js.js.map +1 -0
- package/vendors-node_modules_ol_geom_js-node_modules_ol_geom_flat_length_js.js +769 -0
- package/vendors-node_modules_ol_geom_js-node_modules_ol_geom_flat_length_js.js.map +1 -0
- package/vendors-node_modules_ol_index_js.js +526 -675
- package/vendors-node_modules_ol_index_js.js.map +1 -1
- package/vendors-node_modules_ol_interaction_Draw_js.js +2777 -0
- package/vendors-node_modules_ol_interaction_Draw_js.js.map +1 -0
- package/vendors-node_modules_ol_interaction_Extent_js.js +586 -0
- package/vendors-node_modules_ol_interaction_Extent_js.js.map +1 -0
- package/vendors-node_modules_ol_interaction_Link_js.js +489 -0
- package/vendors-node_modules_ol_interaction_Link_js.js.map +1 -0
- package/vendors-node_modules_ol_interaction_Modify_js.js +1841 -0
- package/vendors-node_modules_ol_interaction_Modify_js.js.map +1 -0
- package/vendors-node_modules_ol_interaction_Select_js.js +623 -0
- package/vendors-node_modules_ol_interaction_Select_js.js.map +1 -0
- package/vendors-node_modules_ol_interaction_Snap_js.js +982 -0
- package/vendors-node_modules_ol_interaction_Snap_js.js.map +1 -0
- package/vendors-node_modules_ol_interaction_Translate_js.js +466 -0
- package/vendors-node_modules_ol_interaction_Translate_js.js.map +1 -0
- package/vendors-node_modules_ol_interaction_js.js +872 -0
- package/vendors-node_modules_ol_interaction_js.js.map +1 -0
- package/vendors-node_modules_ol_layer_Graticule_js.js +1374 -989
- package/vendors-node_modules_ol_layer_Graticule_js.js.map +1 -1
- package/vendors-node_modules_ol_render_Feature_js.js +546 -0
- package/vendors-node_modules_ol_render_Feature_js.js.map +1 -0
- package/vendors-node_modules_ol_render_canvas_BuilderGroup_js.js +897 -0
- package/vendors-node_modules_ol_render_canvas_BuilderGroup_js.js.map +1 -0
- package/vendors-node_modules_ol_render_canvas_Builder_js.js +907 -0
- package/vendors-node_modules_ol_render_canvas_Builder_js.js.map +1 -0
- package/vendors-node_modules_ol_render_canvas_ExecutorGroup_js.js +539 -0
- package/vendors-node_modules_ol_render_canvas_ExecutorGroup_js.js.map +1 -0
- package/vendors-node_modules_ol_render_canvas_Executor_js.js +1715 -0
- package/vendors-node_modules_ol_render_canvas_Executor_js.js.map +1 -0
- package/vendors-node_modules_ol_render_canvas_Immediate_js.js +1208 -0
- package/vendors-node_modules_ol_render_canvas_Immediate_js.js.map +1 -0
- package/vendors-node_modules_ol_render_canvas_TextBuilder_js.js +825 -0
- package/vendors-node_modules_ol_render_canvas_TextBuilder_js.js.map +1 -0
- package/vendors-node_modules_ol_renderer_canvas_Layer_js.js +654 -0
- package/vendors-node_modules_ol_renderer_canvas_Layer_js.js.map +1 -0
- package/vendors-node_modules_ol_renderer_canvas_VectorLayer_js.js +1044 -0
- package/vendors-node_modules_ol_renderer_canvas_VectorLayer_js.js.map +1 -0
- package/vendors-node_modules_ol_renderer_vector_js.js +460 -0
- package/vendors-node_modules_ol_renderer_vector_js.js.map +1 -0
- package/vendors-node_modules_ol_source_Vector_js.js +2091 -0
- package/vendors-node_modules_ol_source_Vector_js.js.map +1 -0
- package/node_modules_ol_ImageTile_js.js +0 -177
- package/node_modules_ol_ImageTile_js.js.map +0 -1
- package/node_modules_ol_render_js.js +0 -131
- package/node_modules_ol_render_js.js.map +0 -1
- package/node_modules_ol_structs_LRUCache_js.js +0 -275
- package/node_modules_ol_structs_LRUCache_js.js.map +0 -1
- package/node_modules_ol_tilecoord_js.js +0 -115
- package/node_modules_ol_tilecoord_js.js.map +0 -1
- package/vendors-node_modules_ol_TileCache_js.js +0 -461
- package/vendors-node_modules_ol_TileCache_js.js.map +0 -1
- package/vendors-node_modules_ol_Tile_js.js +0 -330
- package/vendors-node_modules_ol_Tile_js.js.map +0 -1
- package/vendors-node_modules_ol_style_Text_js.js +0 -509
- package/vendors-node_modules_ol_style_Text_js.js.map +0 -1
- package/vendors-node_modules_rbush_index_js.js +0 -531
- package/vendors-node_modules_rbush_index_js.js.map +0 -1
|
@@ -0,0 +1,825 @@
|
|
|
1
|
+
(self["webpackChunk_vaadin_bundles"] = self["webpackChunk_vaadin_bundles"] || []).push([["vendors-node_modules_ol_render_canvas_TextBuilder_js"],{
|
|
2
|
+
|
|
3
|
+
/***/ "./node_modules/ol/geom/flat/linechunk.js":
|
|
4
|
+
/*!************************************************!*\
|
|
5
|
+
!*** ./node_modules/ol/geom/flat/linechunk.js ***!
|
|
6
|
+
\************************************************/
|
|
7
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
8
|
+
|
|
9
|
+
__webpack_require__.r(__webpack_exports__);
|
|
10
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
11
|
+
/* harmony export */ "lineChunk": () => (/* binding */ lineChunk)
|
|
12
|
+
/* harmony export */ });
|
|
13
|
+
/* harmony import */ var _math_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../math.js */ "./node_modules/ol/math.js");
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Creates chunks of equal length from a linestring
|
|
18
|
+
* @param {number} chunkLength Length of each chunk.
|
|
19
|
+
* @param {Array<number>} flatCoordinates Flat coordinates.
|
|
20
|
+
* @param {number} offset Start offset of the `flatCoordinates`.
|
|
21
|
+
* @param {number} end End offset of the `flatCoordinates`.
|
|
22
|
+
* @param {number} stride Stride.
|
|
23
|
+
* @return {Array<Array<number>>} Chunks of linestrings with stride 2.
|
|
24
|
+
*/
|
|
25
|
+
function lineChunk(chunkLength, flatCoordinates, offset, end, stride) {
|
|
26
|
+
const chunks = [];
|
|
27
|
+
let cursor = offset;
|
|
28
|
+
let chunkM = 0;
|
|
29
|
+
let currentChunk = flatCoordinates.slice(offset, 2);
|
|
30
|
+
while (chunkM < chunkLength && cursor + stride < end) {
|
|
31
|
+
const [x1, y1] = currentChunk.slice(-2);
|
|
32
|
+
const x2 = flatCoordinates[cursor + stride];
|
|
33
|
+
const y2 = flatCoordinates[cursor + stride + 1];
|
|
34
|
+
const segmentLength = Math.sqrt(
|
|
35
|
+
(x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1),
|
|
36
|
+
);
|
|
37
|
+
chunkM += segmentLength;
|
|
38
|
+
if (chunkM >= chunkLength) {
|
|
39
|
+
const m = (chunkLength - chunkM + segmentLength) / segmentLength;
|
|
40
|
+
const x = (0,_math_js__WEBPACK_IMPORTED_MODULE_0__.lerp)(x1, x2, m);
|
|
41
|
+
const y = (0,_math_js__WEBPACK_IMPORTED_MODULE_0__.lerp)(y1, y2, m);
|
|
42
|
+
currentChunk.push(x, y);
|
|
43
|
+
chunks.push(currentChunk);
|
|
44
|
+
currentChunk = [x, y];
|
|
45
|
+
if (chunkM == chunkLength) {
|
|
46
|
+
cursor += stride;
|
|
47
|
+
}
|
|
48
|
+
chunkM = 0;
|
|
49
|
+
} else if (chunkM < chunkLength) {
|
|
50
|
+
currentChunk.push(
|
|
51
|
+
flatCoordinates[cursor + stride],
|
|
52
|
+
flatCoordinates[cursor + stride + 1],
|
|
53
|
+
);
|
|
54
|
+
cursor += stride;
|
|
55
|
+
} else {
|
|
56
|
+
const missing = segmentLength - chunkM;
|
|
57
|
+
const x = (0,_math_js__WEBPACK_IMPORTED_MODULE_0__.lerp)(x1, x2, missing / segmentLength);
|
|
58
|
+
const y = (0,_math_js__WEBPACK_IMPORTED_MODULE_0__.lerp)(y1, y2, missing / segmentLength);
|
|
59
|
+
currentChunk.push(x, y);
|
|
60
|
+
chunks.push(currentChunk);
|
|
61
|
+
currentChunk = [x, y];
|
|
62
|
+
chunkM = 0;
|
|
63
|
+
cursor += stride;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (chunkM > 0) {
|
|
67
|
+
chunks.push(currentChunk);
|
|
68
|
+
}
|
|
69
|
+
return chunks;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
/***/ }),
|
|
74
|
+
|
|
75
|
+
/***/ "./node_modules/ol/geom/flat/straightchunk.js":
|
|
76
|
+
/*!****************************************************!*\
|
|
77
|
+
!*** ./node_modules/ol/geom/flat/straightchunk.js ***!
|
|
78
|
+
\****************************************************/
|
|
79
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
80
|
+
|
|
81
|
+
__webpack_require__.r(__webpack_exports__);
|
|
82
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
83
|
+
/* harmony export */ "matchingChunk": () => (/* binding */ matchingChunk)
|
|
84
|
+
/* harmony export */ });
|
|
85
|
+
/**
|
|
86
|
+
* @module ol/geom/flat/straightchunk
|
|
87
|
+
*/
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* @param {number} maxAngle Maximum acceptable angle delta between segments.
|
|
91
|
+
* @param {Array<number>} flatCoordinates Flat coordinates.
|
|
92
|
+
* @param {number} offset Offset.
|
|
93
|
+
* @param {number} end End.
|
|
94
|
+
* @param {number} stride Stride.
|
|
95
|
+
* @return {Array<number>} Start and end of the first suitable chunk of the
|
|
96
|
+
* given `flatCoordinates`.
|
|
97
|
+
*/
|
|
98
|
+
function matchingChunk(maxAngle, flatCoordinates, offset, end, stride) {
|
|
99
|
+
let chunkStart = offset;
|
|
100
|
+
let chunkEnd = offset;
|
|
101
|
+
let chunkM = 0;
|
|
102
|
+
let m = 0;
|
|
103
|
+
let start = offset;
|
|
104
|
+
let acos, i, m12, m23, x1, y1, x12, y12, x23, y23;
|
|
105
|
+
for (i = offset; i < end; i += stride) {
|
|
106
|
+
const x2 = flatCoordinates[i];
|
|
107
|
+
const y2 = flatCoordinates[i + 1];
|
|
108
|
+
if (x1 !== undefined) {
|
|
109
|
+
x23 = x2 - x1;
|
|
110
|
+
y23 = y2 - y1;
|
|
111
|
+
m23 = Math.sqrt(x23 * x23 + y23 * y23);
|
|
112
|
+
if (x12 !== undefined) {
|
|
113
|
+
m += m12;
|
|
114
|
+
acos = Math.acos((x12 * x23 + y12 * y23) / (m12 * m23));
|
|
115
|
+
if (acos > maxAngle) {
|
|
116
|
+
if (m > chunkM) {
|
|
117
|
+
chunkM = m;
|
|
118
|
+
chunkStart = start;
|
|
119
|
+
chunkEnd = i;
|
|
120
|
+
}
|
|
121
|
+
m = 0;
|
|
122
|
+
start = i - stride;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
m12 = m23;
|
|
126
|
+
x12 = x23;
|
|
127
|
+
y12 = y23;
|
|
128
|
+
}
|
|
129
|
+
x1 = x2;
|
|
130
|
+
y1 = y2;
|
|
131
|
+
}
|
|
132
|
+
m += m23;
|
|
133
|
+
return m > chunkM ? [start, i] : [chunkStart, chunkEnd];
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
/***/ }),
|
|
138
|
+
|
|
139
|
+
/***/ "./node_modules/ol/render/canvas/TextBuilder.js":
|
|
140
|
+
/*!******************************************************!*\
|
|
141
|
+
!*** ./node_modules/ol/render/canvas/TextBuilder.js ***!
|
|
142
|
+
\******************************************************/
|
|
143
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
144
|
+
|
|
145
|
+
__webpack_require__.r(__webpack_exports__);
|
|
146
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
147
|
+
/* harmony export */ "TEXT_ALIGN": () => (/* binding */ TEXT_ALIGN),
|
|
148
|
+
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
149
|
+
/* harmony export */ });
|
|
150
|
+
/* harmony import */ var _colorlike_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../colorlike.js */ "./node_modules/ol/colorlike.js");
|
|
151
|
+
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../extent.js */ "./node_modules/ol/extent.js");
|
|
152
|
+
/* harmony import */ var _geom_flat_linechunk_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../geom/flat/linechunk.js */ "./node_modules/ol/geom/flat/linechunk.js");
|
|
153
|
+
/* harmony import */ var _geom_flat_straightchunk_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../geom/flat/straightchunk.js */ "./node_modules/ol/geom/flat/straightchunk.js");
|
|
154
|
+
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../util.js */ "./node_modules/ol/util.js");
|
|
155
|
+
/* harmony import */ var _canvas_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../canvas.js */ "./node_modules/ol/render/canvas.js");
|
|
156
|
+
/* harmony import */ var _Builder_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Builder.js */ "./node_modules/ol/render/canvas/Builder.js");
|
|
157
|
+
/* harmony import */ var _Instruction_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Instruction.js */ "./node_modules/ol/render/canvas/Instruction.js");
|
|
158
|
+
/**
|
|
159
|
+
* @module ol/render/canvas/TextBuilder
|
|
160
|
+
*/
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* @const
|
|
171
|
+
* @type {{left: 0, center: 0.5, right: 1, top: 0, middle: 0.5, hanging: 0.2, alphabetic: 0.8, ideographic: 0.8, bottom: 1}}
|
|
172
|
+
*/
|
|
173
|
+
const TEXT_ALIGN = {
|
|
174
|
+
'left': 0,
|
|
175
|
+
'center': 0.5,
|
|
176
|
+
'right': 1,
|
|
177
|
+
'top': 0,
|
|
178
|
+
'middle': 0.5,
|
|
179
|
+
'hanging': 0.2,
|
|
180
|
+
'alphabetic': 0.8,
|
|
181
|
+
'ideographic': 0.8,
|
|
182
|
+
'bottom': 1,
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
class CanvasTextBuilder extends _Builder_js__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
186
|
+
/**
|
|
187
|
+
* @param {number} tolerance Tolerance.
|
|
188
|
+
* @param {import("../../extent.js").Extent} maxExtent Maximum extent.
|
|
189
|
+
* @param {number} resolution Resolution.
|
|
190
|
+
* @param {number} pixelRatio Pixel ratio.
|
|
191
|
+
*/
|
|
192
|
+
constructor(tolerance, maxExtent, resolution, pixelRatio) {
|
|
193
|
+
super(tolerance, maxExtent, resolution, pixelRatio);
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* @private
|
|
197
|
+
* @type {Array<HTMLCanvasElement>}
|
|
198
|
+
*/
|
|
199
|
+
this.labels_ = null;
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* @private
|
|
203
|
+
* @type {string|Array<string>}
|
|
204
|
+
*/
|
|
205
|
+
this.text_ = '';
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* @private
|
|
209
|
+
* @type {number}
|
|
210
|
+
*/
|
|
211
|
+
this.textOffsetX_ = 0;
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* @private
|
|
215
|
+
* @type {number}
|
|
216
|
+
*/
|
|
217
|
+
this.textOffsetY_ = 0;
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* @private
|
|
221
|
+
* @type {boolean|undefined}
|
|
222
|
+
*/
|
|
223
|
+
this.textRotateWithView_ = undefined;
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* @private
|
|
227
|
+
* @type {boolean|undefined}
|
|
228
|
+
*/
|
|
229
|
+
this.textKeepUpright_ = undefined;
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* @private
|
|
233
|
+
* @type {number}
|
|
234
|
+
*/
|
|
235
|
+
this.textRotation_ = 0;
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* @private
|
|
239
|
+
* @type {?import("../canvas.js").FillState}
|
|
240
|
+
*/
|
|
241
|
+
this.textFillState_ = null;
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* @type {!Object<string, import("../canvas.js").FillState>}
|
|
245
|
+
*/
|
|
246
|
+
this.fillStates = {};
|
|
247
|
+
this.fillStates[_canvas_js__WEBPACK_IMPORTED_MODULE_1__.defaultFillStyle] = {fillStyle: _canvas_js__WEBPACK_IMPORTED_MODULE_1__.defaultFillStyle};
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* @private
|
|
251
|
+
* @type {?import("../canvas.js").StrokeState}
|
|
252
|
+
*/
|
|
253
|
+
this.textStrokeState_ = null;
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* @type {!Object<string, import("../canvas.js").StrokeState>}
|
|
257
|
+
*/
|
|
258
|
+
this.strokeStates = {};
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* @private
|
|
262
|
+
* @type {import("../canvas.js").TextState}
|
|
263
|
+
*/
|
|
264
|
+
this.textState_ = /** @type {import("../canvas.js").TextState} */ ({});
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* @type {!Object<string, import("../canvas.js").TextState>}
|
|
268
|
+
*/
|
|
269
|
+
this.textStates = {};
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* @private
|
|
273
|
+
* @type {string}
|
|
274
|
+
*/
|
|
275
|
+
this.textKey_ = '';
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* @private
|
|
279
|
+
* @type {string}
|
|
280
|
+
*/
|
|
281
|
+
this.fillKey_ = '';
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* @private
|
|
285
|
+
* @type {string}
|
|
286
|
+
*/
|
|
287
|
+
this.strokeKey_ = '';
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* @private
|
|
291
|
+
* @type {import('../../style/Style.js').DeclutterMode}
|
|
292
|
+
*/
|
|
293
|
+
this.declutterMode_ = undefined;
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Data shared with an image builder for combined decluttering.
|
|
297
|
+
* @private
|
|
298
|
+
* @type {import("../canvas.js").DeclutterImageWithText}
|
|
299
|
+
*/
|
|
300
|
+
this.declutterImageWithText_ = undefined;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* @return {import("../canvas.js").SerializableInstructions} the serializable instructions.
|
|
305
|
+
* @override
|
|
306
|
+
*/
|
|
307
|
+
finish() {
|
|
308
|
+
const instructions = super.finish();
|
|
309
|
+
instructions.textStates = this.textStates;
|
|
310
|
+
instructions.fillStates = this.fillStates;
|
|
311
|
+
instructions.strokeStates = this.strokeStates;
|
|
312
|
+
return instructions;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* @param {import("../../geom/SimpleGeometry.js").default|import("../Feature.js").default} geometry Geometry.
|
|
317
|
+
* @param {import("../../Feature.js").FeatureLike} feature Feature.
|
|
318
|
+
* @param {number} [index] Render order index.
|
|
319
|
+
* @override
|
|
320
|
+
*/
|
|
321
|
+
drawText(geometry, feature, index) {
|
|
322
|
+
const fillState = this.textFillState_;
|
|
323
|
+
const strokeState = this.textStrokeState_;
|
|
324
|
+
const textState = this.textState_;
|
|
325
|
+
if (this.text_ === '' || !textState || (!fillState && !strokeState)) {
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
const coordinates = this.coordinates;
|
|
330
|
+
let begin = coordinates.length;
|
|
331
|
+
|
|
332
|
+
const geometryType = geometry.getType();
|
|
333
|
+
let flatCoordinates = null;
|
|
334
|
+
let stride = geometry.getStride();
|
|
335
|
+
|
|
336
|
+
if (
|
|
337
|
+
textState.placement === 'line' &&
|
|
338
|
+
(geometryType == 'LineString' ||
|
|
339
|
+
geometryType == 'MultiLineString' ||
|
|
340
|
+
geometryType == 'Polygon' ||
|
|
341
|
+
geometryType == 'MultiPolygon')
|
|
342
|
+
) {
|
|
343
|
+
if (!(0,_extent_js__WEBPACK_IMPORTED_MODULE_2__.intersects)(this.maxExtent, geometry.getExtent())) {
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
let ends;
|
|
347
|
+
flatCoordinates = geometry.getFlatCoordinates();
|
|
348
|
+
if (geometryType == 'LineString') {
|
|
349
|
+
ends = [flatCoordinates.length];
|
|
350
|
+
} else if (geometryType == 'MultiLineString') {
|
|
351
|
+
ends = /** @type {import("../../geom/MultiLineString.js").default} */ (
|
|
352
|
+
geometry
|
|
353
|
+
).getEnds();
|
|
354
|
+
} else if (geometryType == 'Polygon') {
|
|
355
|
+
ends = /** @type {import("../../geom/Polygon.js").default} */ (geometry)
|
|
356
|
+
.getEnds()
|
|
357
|
+
.slice(0, 1);
|
|
358
|
+
} else if (geometryType == 'MultiPolygon') {
|
|
359
|
+
const endss =
|
|
360
|
+
/** @type {import("../../geom/MultiPolygon.js").default} */ (
|
|
361
|
+
geometry
|
|
362
|
+
).getEndss();
|
|
363
|
+
ends = [];
|
|
364
|
+
for (let i = 0, ii = endss.length; i < ii; ++i) {
|
|
365
|
+
ends.push(endss[i][0]);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
this.beginGeometry(geometry, feature, index);
|
|
369
|
+
const repeat = textState.repeat;
|
|
370
|
+
const textAlign = repeat ? undefined : textState.textAlign;
|
|
371
|
+
// No `justify` support for line placement.
|
|
372
|
+
let flatOffset = 0;
|
|
373
|
+
for (let o = 0, oo = ends.length; o < oo; ++o) {
|
|
374
|
+
let chunks;
|
|
375
|
+
if (repeat) {
|
|
376
|
+
chunks = (0,_geom_flat_linechunk_js__WEBPACK_IMPORTED_MODULE_3__.lineChunk)(
|
|
377
|
+
repeat * this.resolution,
|
|
378
|
+
flatCoordinates,
|
|
379
|
+
flatOffset,
|
|
380
|
+
ends[o],
|
|
381
|
+
stride,
|
|
382
|
+
);
|
|
383
|
+
} else {
|
|
384
|
+
chunks = [flatCoordinates.slice(flatOffset, ends[o])];
|
|
385
|
+
}
|
|
386
|
+
for (let c = 0, cc = chunks.length; c < cc; ++c) {
|
|
387
|
+
const chunk = chunks[c];
|
|
388
|
+
let chunkBegin = 0;
|
|
389
|
+
let chunkEnd = chunk.length;
|
|
390
|
+
if (textAlign == undefined) {
|
|
391
|
+
const range = (0,_geom_flat_straightchunk_js__WEBPACK_IMPORTED_MODULE_4__.matchingChunk)(
|
|
392
|
+
textState.maxAngle,
|
|
393
|
+
chunk,
|
|
394
|
+
0,
|
|
395
|
+
chunk.length,
|
|
396
|
+
2,
|
|
397
|
+
);
|
|
398
|
+
chunkBegin = range[0];
|
|
399
|
+
chunkEnd = range[1];
|
|
400
|
+
}
|
|
401
|
+
for (let i = chunkBegin; i < chunkEnd; i += stride) {
|
|
402
|
+
coordinates.push(chunk[i], chunk[i + 1]);
|
|
403
|
+
}
|
|
404
|
+
const end = coordinates.length;
|
|
405
|
+
flatOffset = ends[o];
|
|
406
|
+
this.drawChars_(begin, end);
|
|
407
|
+
begin = end;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
this.endGeometry(feature);
|
|
411
|
+
} else {
|
|
412
|
+
let geometryWidths = textState.overflow ? null : [];
|
|
413
|
+
switch (geometryType) {
|
|
414
|
+
case 'Point':
|
|
415
|
+
case 'MultiPoint':
|
|
416
|
+
flatCoordinates =
|
|
417
|
+
/** @type {import("../../geom/MultiPoint.js").default} */ (
|
|
418
|
+
geometry
|
|
419
|
+
).getFlatCoordinates();
|
|
420
|
+
break;
|
|
421
|
+
case 'LineString':
|
|
422
|
+
flatCoordinates =
|
|
423
|
+
/** @type {import("../../geom/LineString.js").default} */ (
|
|
424
|
+
geometry
|
|
425
|
+
).getFlatMidpoint();
|
|
426
|
+
break;
|
|
427
|
+
case 'Circle':
|
|
428
|
+
flatCoordinates =
|
|
429
|
+
/** @type {import("../../geom/Circle.js").default} */ (
|
|
430
|
+
geometry
|
|
431
|
+
).getCenter();
|
|
432
|
+
break;
|
|
433
|
+
case 'MultiLineString':
|
|
434
|
+
flatCoordinates =
|
|
435
|
+
/** @type {import("../../geom/MultiLineString.js").default} */ (
|
|
436
|
+
geometry
|
|
437
|
+
).getFlatMidpoints();
|
|
438
|
+
stride = 2;
|
|
439
|
+
break;
|
|
440
|
+
case 'Polygon':
|
|
441
|
+
flatCoordinates =
|
|
442
|
+
/** @type {import("../../geom/Polygon.js").default} */ (
|
|
443
|
+
geometry
|
|
444
|
+
).getFlatInteriorPoint();
|
|
445
|
+
if (!textState.overflow) {
|
|
446
|
+
geometryWidths.push(flatCoordinates[2] / this.resolution);
|
|
447
|
+
}
|
|
448
|
+
stride = 3;
|
|
449
|
+
break;
|
|
450
|
+
case 'MultiPolygon':
|
|
451
|
+
const interiorPoints =
|
|
452
|
+
/** @type {import("../../geom/MultiPolygon.js").default} */ (
|
|
453
|
+
geometry
|
|
454
|
+
).getFlatInteriorPoints();
|
|
455
|
+
flatCoordinates = [];
|
|
456
|
+
for (let i = 0, ii = interiorPoints.length; i < ii; i += 3) {
|
|
457
|
+
if (!textState.overflow) {
|
|
458
|
+
geometryWidths.push(interiorPoints[i + 2] / this.resolution);
|
|
459
|
+
}
|
|
460
|
+
flatCoordinates.push(interiorPoints[i], interiorPoints[i + 1]);
|
|
461
|
+
}
|
|
462
|
+
if (flatCoordinates.length === 0) {
|
|
463
|
+
return;
|
|
464
|
+
}
|
|
465
|
+
stride = 2;
|
|
466
|
+
break;
|
|
467
|
+
default:
|
|
468
|
+
}
|
|
469
|
+
const end = this.appendFlatPointCoordinates(flatCoordinates, stride);
|
|
470
|
+
if (end === begin) {
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
473
|
+
if (
|
|
474
|
+
geometryWidths &&
|
|
475
|
+
(end - begin) / 2 !== flatCoordinates.length / stride
|
|
476
|
+
) {
|
|
477
|
+
let beg = begin / 2;
|
|
478
|
+
geometryWidths = geometryWidths.filter((w, i) => {
|
|
479
|
+
const keep =
|
|
480
|
+
coordinates[(beg + i) * 2] === flatCoordinates[i * stride] &&
|
|
481
|
+
coordinates[(beg + i) * 2 + 1] === flatCoordinates[i * stride + 1];
|
|
482
|
+
if (!keep) {
|
|
483
|
+
--beg;
|
|
484
|
+
}
|
|
485
|
+
return keep;
|
|
486
|
+
});
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
this.saveTextStates_();
|
|
490
|
+
|
|
491
|
+
const backgroundFill = textState.backgroundFill
|
|
492
|
+
? this.createFill(this.fillStyleToState(textState.backgroundFill))
|
|
493
|
+
: null;
|
|
494
|
+
const backgroundStroke = textState.backgroundStroke
|
|
495
|
+
? this.createStroke(this.strokeStyleToState(textState.backgroundStroke))
|
|
496
|
+
: null;
|
|
497
|
+
|
|
498
|
+
this.beginGeometry(geometry, feature, index);
|
|
499
|
+
|
|
500
|
+
// adjust padding for negative scale
|
|
501
|
+
let padding = textState.padding;
|
|
502
|
+
if (
|
|
503
|
+
padding != _canvas_js__WEBPACK_IMPORTED_MODULE_1__.defaultPadding &&
|
|
504
|
+
(textState.scale[0] < 0 || textState.scale[1] < 0)
|
|
505
|
+
) {
|
|
506
|
+
let p0 = textState.padding[0];
|
|
507
|
+
let p1 = textState.padding[1];
|
|
508
|
+
let p2 = textState.padding[2];
|
|
509
|
+
let p3 = textState.padding[3];
|
|
510
|
+
if (textState.scale[0] < 0) {
|
|
511
|
+
p1 = -p1;
|
|
512
|
+
p3 = -p3;
|
|
513
|
+
}
|
|
514
|
+
if (textState.scale[1] < 0) {
|
|
515
|
+
p0 = -p0;
|
|
516
|
+
p2 = -p2;
|
|
517
|
+
}
|
|
518
|
+
padding = [p0, p1, p2, p3];
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
// The image is unknown at this stage so we pass null; it will be computed at render time.
|
|
522
|
+
// For clarity, we pass NaN for offsetX, offsetY, width and height, which will be computed at
|
|
523
|
+
// render time.
|
|
524
|
+
const pixelRatio = this.pixelRatio;
|
|
525
|
+
this.instructions.push([
|
|
526
|
+
_Instruction_js__WEBPACK_IMPORTED_MODULE_5__["default"].DRAW_IMAGE,
|
|
527
|
+
begin,
|
|
528
|
+
end,
|
|
529
|
+
null,
|
|
530
|
+
NaN,
|
|
531
|
+
NaN,
|
|
532
|
+
NaN,
|
|
533
|
+
1,
|
|
534
|
+
0,
|
|
535
|
+
0,
|
|
536
|
+
this.textRotateWithView_,
|
|
537
|
+
this.textRotation_,
|
|
538
|
+
[1, 1],
|
|
539
|
+
NaN,
|
|
540
|
+
this.declutterMode_,
|
|
541
|
+
this.declutterImageWithText_,
|
|
542
|
+
padding == _canvas_js__WEBPACK_IMPORTED_MODULE_1__.defaultPadding
|
|
543
|
+
? _canvas_js__WEBPACK_IMPORTED_MODULE_1__.defaultPadding
|
|
544
|
+
: padding.map(function (p) {
|
|
545
|
+
return p * pixelRatio;
|
|
546
|
+
}),
|
|
547
|
+
backgroundFill,
|
|
548
|
+
backgroundStroke,
|
|
549
|
+
this.text_,
|
|
550
|
+
this.textKey_,
|
|
551
|
+
this.strokeKey_,
|
|
552
|
+
this.fillKey_,
|
|
553
|
+
this.textOffsetX_,
|
|
554
|
+
this.textOffsetY_,
|
|
555
|
+
geometryWidths,
|
|
556
|
+
]);
|
|
557
|
+
const scale = 1 / pixelRatio;
|
|
558
|
+
// Set default fill for hit detection background
|
|
559
|
+
const hitDetectionBackgroundFill = backgroundFill
|
|
560
|
+
? backgroundFill.slice(0)
|
|
561
|
+
: null;
|
|
562
|
+
if (hitDetectionBackgroundFill) {
|
|
563
|
+
hitDetectionBackgroundFill[1] = _canvas_js__WEBPACK_IMPORTED_MODULE_1__.defaultFillStyle;
|
|
564
|
+
}
|
|
565
|
+
this.hitDetectionInstructions.push([
|
|
566
|
+
_Instruction_js__WEBPACK_IMPORTED_MODULE_5__["default"].DRAW_IMAGE,
|
|
567
|
+
begin,
|
|
568
|
+
end,
|
|
569
|
+
null,
|
|
570
|
+
NaN,
|
|
571
|
+
NaN,
|
|
572
|
+
NaN,
|
|
573
|
+
1,
|
|
574
|
+
0,
|
|
575
|
+
0,
|
|
576
|
+
this.textRotateWithView_,
|
|
577
|
+
this.textRotation_,
|
|
578
|
+
[scale, scale],
|
|
579
|
+
NaN,
|
|
580
|
+
this.declutterMode_,
|
|
581
|
+
this.declutterImageWithText_,
|
|
582
|
+
padding,
|
|
583
|
+
hitDetectionBackgroundFill,
|
|
584
|
+
backgroundStroke,
|
|
585
|
+
this.text_,
|
|
586
|
+
this.textKey_,
|
|
587
|
+
this.strokeKey_,
|
|
588
|
+
this.fillKey_ ? _canvas_js__WEBPACK_IMPORTED_MODULE_1__.defaultFillStyle : this.fillKey_,
|
|
589
|
+
this.textOffsetX_,
|
|
590
|
+
this.textOffsetY_,
|
|
591
|
+
geometryWidths,
|
|
592
|
+
]);
|
|
593
|
+
|
|
594
|
+
this.endGeometry(feature);
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
/**
|
|
599
|
+
* @private
|
|
600
|
+
*/
|
|
601
|
+
saveTextStates_() {
|
|
602
|
+
const strokeState = this.textStrokeState_;
|
|
603
|
+
const textState = this.textState_;
|
|
604
|
+
const fillState = this.textFillState_;
|
|
605
|
+
|
|
606
|
+
const strokeKey = this.strokeKey_;
|
|
607
|
+
if (strokeState) {
|
|
608
|
+
if (!(strokeKey in this.strokeStates)) {
|
|
609
|
+
this.strokeStates[strokeKey] = {
|
|
610
|
+
strokeStyle: strokeState.strokeStyle,
|
|
611
|
+
lineCap: strokeState.lineCap,
|
|
612
|
+
lineDashOffset: strokeState.lineDashOffset,
|
|
613
|
+
lineWidth: strokeState.lineWidth,
|
|
614
|
+
lineJoin: strokeState.lineJoin,
|
|
615
|
+
miterLimit: strokeState.miterLimit,
|
|
616
|
+
lineDash: strokeState.lineDash,
|
|
617
|
+
};
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
const textKey = this.textKey_;
|
|
621
|
+
if (!(textKey in this.textStates)) {
|
|
622
|
+
this.textStates[textKey] = {
|
|
623
|
+
font: textState.font,
|
|
624
|
+
textAlign: textState.textAlign || _canvas_js__WEBPACK_IMPORTED_MODULE_1__.defaultTextAlign,
|
|
625
|
+
justify: textState.justify,
|
|
626
|
+
textBaseline: textState.textBaseline || _canvas_js__WEBPACK_IMPORTED_MODULE_1__.defaultTextBaseline,
|
|
627
|
+
scale: textState.scale,
|
|
628
|
+
};
|
|
629
|
+
}
|
|
630
|
+
const fillKey = this.fillKey_;
|
|
631
|
+
if (fillState) {
|
|
632
|
+
if (!(fillKey in this.fillStates)) {
|
|
633
|
+
this.fillStates[fillKey] = {
|
|
634
|
+
fillStyle: fillState.fillStyle,
|
|
635
|
+
};
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
/**
|
|
641
|
+
* @private
|
|
642
|
+
* @param {number} begin Begin.
|
|
643
|
+
* @param {number} end End.
|
|
644
|
+
*/
|
|
645
|
+
drawChars_(begin, end) {
|
|
646
|
+
const strokeState = this.textStrokeState_;
|
|
647
|
+
const textState = this.textState_;
|
|
648
|
+
|
|
649
|
+
const strokeKey = this.strokeKey_;
|
|
650
|
+
const textKey = this.textKey_;
|
|
651
|
+
const fillKey = this.fillKey_;
|
|
652
|
+
this.saveTextStates_();
|
|
653
|
+
|
|
654
|
+
const pixelRatio = this.pixelRatio;
|
|
655
|
+
const baseline = TEXT_ALIGN[textState.textBaseline];
|
|
656
|
+
|
|
657
|
+
const offsetY = this.textOffsetY_ * pixelRatio;
|
|
658
|
+
const text = this.text_;
|
|
659
|
+
const strokeWidth = strokeState
|
|
660
|
+
? (strokeState.lineWidth * Math.abs(textState.scale[0])) / 2
|
|
661
|
+
: 0;
|
|
662
|
+
|
|
663
|
+
this.instructions.push([
|
|
664
|
+
_Instruction_js__WEBPACK_IMPORTED_MODULE_5__["default"].DRAW_CHARS,
|
|
665
|
+
begin,
|
|
666
|
+
end,
|
|
667
|
+
baseline,
|
|
668
|
+
textState.overflow,
|
|
669
|
+
fillKey,
|
|
670
|
+
textState.maxAngle,
|
|
671
|
+
pixelRatio,
|
|
672
|
+
offsetY,
|
|
673
|
+
strokeKey,
|
|
674
|
+
strokeWidth * pixelRatio,
|
|
675
|
+
text,
|
|
676
|
+
textKey,
|
|
677
|
+
1,
|
|
678
|
+
this.declutterMode_,
|
|
679
|
+
this.textKeepUpright_,
|
|
680
|
+
]);
|
|
681
|
+
this.hitDetectionInstructions.push([
|
|
682
|
+
_Instruction_js__WEBPACK_IMPORTED_MODULE_5__["default"].DRAW_CHARS,
|
|
683
|
+
begin,
|
|
684
|
+
end,
|
|
685
|
+
baseline,
|
|
686
|
+
textState.overflow,
|
|
687
|
+
fillKey ? _canvas_js__WEBPACK_IMPORTED_MODULE_1__.defaultFillStyle : fillKey,
|
|
688
|
+
textState.maxAngle,
|
|
689
|
+
pixelRatio,
|
|
690
|
+
offsetY,
|
|
691
|
+
strokeKey,
|
|
692
|
+
strokeWidth * pixelRatio,
|
|
693
|
+
text,
|
|
694
|
+
textKey,
|
|
695
|
+
1 / pixelRatio,
|
|
696
|
+
this.declutterMode_,
|
|
697
|
+
this.textKeepUpright_,
|
|
698
|
+
]);
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
/**
|
|
702
|
+
* @param {import("../../style/Text.js").default} textStyle Text style.
|
|
703
|
+
* @param {Object} [sharedData] Shared data.
|
|
704
|
+
* @override
|
|
705
|
+
*/
|
|
706
|
+
setTextStyle(textStyle, sharedData) {
|
|
707
|
+
let textState, fillState, strokeState;
|
|
708
|
+
if (!textStyle) {
|
|
709
|
+
this.text_ = '';
|
|
710
|
+
} else {
|
|
711
|
+
const textFillStyle = textStyle.getFill();
|
|
712
|
+
if (!textFillStyle) {
|
|
713
|
+
fillState = null;
|
|
714
|
+
this.textFillState_ = fillState;
|
|
715
|
+
} else {
|
|
716
|
+
fillState = this.textFillState_;
|
|
717
|
+
if (!fillState) {
|
|
718
|
+
fillState = /** @type {import("../canvas.js").FillState} */ ({});
|
|
719
|
+
this.textFillState_ = fillState;
|
|
720
|
+
}
|
|
721
|
+
fillState.fillStyle = (0,_colorlike_js__WEBPACK_IMPORTED_MODULE_6__.asColorLike)(
|
|
722
|
+
textFillStyle.getColor() || _canvas_js__WEBPACK_IMPORTED_MODULE_1__.defaultFillStyle,
|
|
723
|
+
);
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
const textStrokeStyle = textStyle.getStroke();
|
|
727
|
+
if (!textStrokeStyle) {
|
|
728
|
+
strokeState = null;
|
|
729
|
+
this.textStrokeState_ = strokeState;
|
|
730
|
+
} else {
|
|
731
|
+
strokeState = this.textStrokeState_;
|
|
732
|
+
if (!strokeState) {
|
|
733
|
+
strokeState = /** @type {import("../canvas.js").StrokeState} */ ({});
|
|
734
|
+
this.textStrokeState_ = strokeState;
|
|
735
|
+
}
|
|
736
|
+
const lineDash = textStrokeStyle.getLineDash();
|
|
737
|
+
const lineDashOffset = textStrokeStyle.getLineDashOffset();
|
|
738
|
+
const lineWidth = textStrokeStyle.getWidth();
|
|
739
|
+
const miterLimit = textStrokeStyle.getMiterLimit();
|
|
740
|
+
strokeState.lineCap = textStrokeStyle.getLineCap() || _canvas_js__WEBPACK_IMPORTED_MODULE_1__.defaultLineCap;
|
|
741
|
+
strokeState.lineDash = lineDash ? lineDash.slice() : _canvas_js__WEBPACK_IMPORTED_MODULE_1__.defaultLineDash;
|
|
742
|
+
strokeState.lineDashOffset =
|
|
743
|
+
lineDashOffset === undefined ? _canvas_js__WEBPACK_IMPORTED_MODULE_1__.defaultLineDashOffset : lineDashOffset;
|
|
744
|
+
strokeState.lineJoin = textStrokeStyle.getLineJoin() || _canvas_js__WEBPACK_IMPORTED_MODULE_1__.defaultLineJoin;
|
|
745
|
+
strokeState.lineWidth =
|
|
746
|
+
lineWidth === undefined ? _canvas_js__WEBPACK_IMPORTED_MODULE_1__.defaultLineWidth : lineWidth;
|
|
747
|
+
strokeState.miterLimit =
|
|
748
|
+
miterLimit === undefined ? _canvas_js__WEBPACK_IMPORTED_MODULE_1__.defaultMiterLimit : miterLimit;
|
|
749
|
+
strokeState.strokeStyle = (0,_colorlike_js__WEBPACK_IMPORTED_MODULE_6__.asColorLike)(
|
|
750
|
+
textStrokeStyle.getColor() || _canvas_js__WEBPACK_IMPORTED_MODULE_1__.defaultStrokeStyle,
|
|
751
|
+
);
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
textState = this.textState_;
|
|
755
|
+
const font = textStyle.getFont() || _canvas_js__WEBPACK_IMPORTED_MODULE_1__.defaultFont;
|
|
756
|
+
(0,_canvas_js__WEBPACK_IMPORTED_MODULE_1__.registerFont)(font);
|
|
757
|
+
const textScale = textStyle.getScaleArray();
|
|
758
|
+
textState.overflow = textStyle.getOverflow();
|
|
759
|
+
textState.font = font;
|
|
760
|
+
textState.maxAngle = textStyle.getMaxAngle();
|
|
761
|
+
textState.placement = textStyle.getPlacement();
|
|
762
|
+
textState.textAlign = textStyle.getTextAlign();
|
|
763
|
+
textState.repeat = textStyle.getRepeat();
|
|
764
|
+
textState.justify = textStyle.getJustify();
|
|
765
|
+
textState.textBaseline =
|
|
766
|
+
textStyle.getTextBaseline() || _canvas_js__WEBPACK_IMPORTED_MODULE_1__.defaultTextBaseline;
|
|
767
|
+
textState.backgroundFill = textStyle.getBackgroundFill();
|
|
768
|
+
textState.backgroundStroke = textStyle.getBackgroundStroke();
|
|
769
|
+
textState.padding = textStyle.getPadding() || _canvas_js__WEBPACK_IMPORTED_MODULE_1__.defaultPadding;
|
|
770
|
+
textState.scale = textScale === undefined ? [1, 1] : textScale;
|
|
771
|
+
|
|
772
|
+
const textOffsetX = textStyle.getOffsetX();
|
|
773
|
+
const textOffsetY = textStyle.getOffsetY();
|
|
774
|
+
const textRotateWithView = textStyle.getRotateWithView();
|
|
775
|
+
const textKeepUpright = textStyle.getKeepUpright();
|
|
776
|
+
const textRotation = textStyle.getRotation();
|
|
777
|
+
this.text_ = textStyle.getText() || '';
|
|
778
|
+
this.textOffsetX_ = textOffsetX === undefined ? 0 : textOffsetX;
|
|
779
|
+
this.textOffsetY_ = textOffsetY === undefined ? 0 : textOffsetY;
|
|
780
|
+
this.textRotateWithView_ =
|
|
781
|
+
textRotateWithView === undefined ? false : textRotateWithView;
|
|
782
|
+
this.textKeepUpright_ =
|
|
783
|
+
textKeepUpright === undefined ? true : textKeepUpright;
|
|
784
|
+
this.textRotation_ = textRotation === undefined ? 0 : textRotation;
|
|
785
|
+
|
|
786
|
+
this.strokeKey_ = strokeState
|
|
787
|
+
? (typeof strokeState.strokeStyle == 'string'
|
|
788
|
+
? strokeState.strokeStyle
|
|
789
|
+
: (0,_util_js__WEBPACK_IMPORTED_MODULE_7__.getUid)(strokeState.strokeStyle)) +
|
|
790
|
+
strokeState.lineCap +
|
|
791
|
+
strokeState.lineDashOffset +
|
|
792
|
+
'|' +
|
|
793
|
+
strokeState.lineWidth +
|
|
794
|
+
strokeState.lineJoin +
|
|
795
|
+
strokeState.miterLimit +
|
|
796
|
+
'[' +
|
|
797
|
+
strokeState.lineDash.join() +
|
|
798
|
+
']'
|
|
799
|
+
: '';
|
|
800
|
+
this.textKey_ =
|
|
801
|
+
textState.font +
|
|
802
|
+
textState.scale +
|
|
803
|
+
(textState.textAlign || '?') +
|
|
804
|
+
(textState.repeat || '?') +
|
|
805
|
+
(textState.justify || '?') +
|
|
806
|
+
(textState.textBaseline || '?');
|
|
807
|
+
this.fillKey_ =
|
|
808
|
+
fillState && fillState.fillStyle
|
|
809
|
+
? typeof fillState.fillStyle == 'string'
|
|
810
|
+
? fillState.fillStyle
|
|
811
|
+
: '|' + (0,_util_js__WEBPACK_IMPORTED_MODULE_7__.getUid)(fillState.fillStyle)
|
|
812
|
+
: '';
|
|
813
|
+
}
|
|
814
|
+
this.declutterMode_ = textStyle.getDeclutterMode();
|
|
815
|
+
this.declutterImageWithText_ = sharedData;
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (CanvasTextBuilder);
|
|
820
|
+
|
|
821
|
+
|
|
822
|
+
/***/ })
|
|
823
|
+
|
|
824
|
+
}])
|
|
825
|
+
//# sourceMappingURL=vendors-node_modules_ol_render_canvas_TextBuilder_js.js.map
|