@vaadin/bundles 25.3.0-alpha13 → 25.3.0-alpha14

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.
Files changed (105) hide show
  1. package/node_modules_vaadin_map_node_modules_ol_control_MousePosition_js.js +6 -6
  2. package/node_modules_vaadin_map_node_modules_ol_control_MousePosition_js.js.map +1 -1
  3. package/node_modules_vaadin_map_node_modules_ol_control_ZoomToExtent_js.js +10 -1
  4. package/node_modules_vaadin_map_node_modules_ol_control_ZoomToExtent_js.js.map +1 -1
  5. package/node_modules_vaadin_map_node_modules_ol_events_SnapEvent_js.js +5 -0
  6. package/node_modules_vaadin_map_node_modules_ol_events_SnapEvent_js.js.map +1 -1
  7. package/node_modules_vaadin_map_node_modules_ol_featureloader_js.js +9 -8
  8. package/node_modules_vaadin_map_node_modules_ol_featureloader_js.js.map +1 -1
  9. package/node_modules_vaadin_map_node_modules_ol_geom_GeometryCollection_js.js +1 -1
  10. package/node_modules_vaadin_map_node_modules_ol_geom_GeometryCollection_js.js.map +1 -1
  11. package/node_modules_vaadin_map_node_modules_ol_geom_flat_clip_js.js +172 -0
  12. package/node_modules_vaadin_map_node_modules_ol_geom_flat_clip_js.js.map +1 -0
  13. package/node_modules_vaadin_map_node_modules_ol_geom_flat_length_js-_95bd5.js +58 -0
  14. package/node_modules_vaadin_map_node_modules_ol_geom_flat_length_js-_95bd5.js.map +1 -0
  15. package/{node_modules_vaadin_map_node_modules_ol_render_VectorContext_js-node_modules_vaadin_map_node_-a1378d.js → node_modules_vaadin_map_node_modules_ol_geom_flat_lineoffset_js-node_modules_vaadin_map_node_-304640.js} +244 -5
  16. package/node_modules_vaadin_map_node_modules_ol_geom_flat_lineoffset_js-node_modules_vaadin_map_node_-304640.js.map +1 -0
  17. package/node_modules_vaadin_map_node_modules_ol_geom_flat_lineoffset_js-node_modules_vaadin_map_node_-7a9288.js +383 -0
  18. package/node_modules_vaadin_map_node_modules_ol_geom_flat_lineoffset_js-node_modules_vaadin_map_node_-7a9288.js.map +1 -0
  19. package/node_modules_vaadin_map_node_modules_ol_geom_flat_lineoffset_js.js +243 -0
  20. package/node_modules_vaadin_map_node_modules_ol_geom_flat_lineoffset_js.js.map +1 -0
  21. package/node_modules_vaadin_map_node_modules_ol_geom_flat_textpath_js.js +18 -5
  22. package/node_modules_vaadin_map_node_modules_ol_geom_flat_textpath_js.js.map +1 -1
  23. package/node_modules_vaadin_map_node_modules_ol_interaction_DragAndDrop_js.js +8 -8
  24. package/node_modules_vaadin_map_node_modules_ol_interaction_DragAndDrop_js.js.map +1 -1
  25. package/{node_modules_vaadin_map_node_modules_ol_render_VectorContext_js-_279c0.js → node_modules_vaadin_map_node_modules_ol_render_VectorContext_js.js} +2 -2
  26. package/node_modules_vaadin_map_node_modules_ol_render_VectorContext_js.js.map +1 -0
  27. package/node_modules_vaadin_map_node_modules_ol_render_canvas_LineStringBuilder_js.js +17 -7
  28. package/node_modules_vaadin_map_node_modules_ol_render_canvas_LineStringBuilder_js.js.map +1 -1
  29. package/node_modules_vaadin_map_node_modules_ol_render_canvas_ZIndexContext_js-_abc10.js +18 -15
  30. package/node_modules_vaadin_map_node_modules_ol_render_canvas_ZIndexContext_js-_abc10.js.map +1 -1
  31. package/node_modules_vaadin_map_node_modules_ol_render_canvas_ZIndexContext_js-_abc11.js +18 -15
  32. package/node_modules_vaadin_map_node_modules_ol_render_canvas_ZIndexContext_js-_abc11.js.map +1 -1
  33. package/node_modules_vaadin_map_node_modules_ol_renderer_Layer_js.js +21 -1
  34. package/node_modules_vaadin_map_node_modules_ol_renderer_Layer_js.js.map +1 -1
  35. package/node_modules_vaadin_map_node_modules_ol_source_Source_js.js +34 -3
  36. package/node_modules_vaadin_map_node_modules_ol_source_Source_js.js.map +1 -1
  37. package/package.json +135 -135
  38. package/vaadin-bundle.json +1824 -1812
  39. package/vaadin.js +2725 -1726
  40. package/vaadin.js.map +1 -1
  41. package/vendors-node_modules_vaadin_map_node_modules_ol_Feature_js.js +30 -16
  42. package/vendors-node_modules_vaadin_map_node_modules_ol_Feature_js.js.map +1 -1
  43. package/vendors-node_modules_vaadin_map_node_modules_ol_Overlay_js.js +6 -6
  44. package/vendors-node_modules_vaadin_map_node_modules_ol_Overlay_js.js.map +1 -1
  45. package/vendors-node_modules_vaadin_map_node_modules_ol_control_FullScreen_js.js +7 -7
  46. package/vendors-node_modules_vaadin_map_node_modules_ol_control_FullScreen_js.js.map +1 -1
  47. package/vendors-node_modules_vaadin_map_node_modules_ol_control_OverviewMap_js.js +1 -1
  48. package/vendors-node_modules_vaadin_map_node_modules_ol_control_OverviewMap_js.js.map +1 -1
  49. package/vendors-node_modules_vaadin_map_node_modules_ol_control_ScaleLine_js.js +6 -6
  50. package/vendors-node_modules_vaadin_map_node_modules_ol_control_ScaleLine_js.js.map +1 -1
  51. package/vendors-node_modules_vaadin_map_node_modules_ol_control_ZoomSlider_js.js +1 -1
  52. package/vendors-node_modules_vaadin_map_node_modules_ol_control_ZoomSlider_js.js.map +1 -1
  53. package/vendors-node_modules_vaadin_map_node_modules_ol_control_js.js +34 -25
  54. package/vendors-node_modules_vaadin_map_node_modules_ol_control_js.js.map +1 -1
  55. package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Draw_js.js +146 -943
  56. package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Draw_js.js.map +1 -1
  57. package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Extent_js.js +111 -34
  58. package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Extent_js.js.map +1 -1
  59. package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Link_js.js +3 -3
  60. package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Link_js.js.map +1 -1
  61. package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Modify_js.js +1055 -219
  62. package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Modify_js.js.map +1 -1
  63. package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Select_js.js +129 -57
  64. package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Select_js.js.map +1 -1
  65. package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Snap_js.js +74 -80
  66. package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Snap_js.js.map +1 -1
  67. package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Translate_js.js +11 -11
  68. package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Translate_js.js.map +1 -1
  69. package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_js.js +54 -54
  70. package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_js.js.map +1 -1
  71. package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_tracing_js.js +801 -0
  72. package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_tracing_js.js.map +1 -0
  73. package/vendors-node_modules_vaadin_map_node_modules_ol_render_Feature_js.js +36 -20
  74. package/vendors-node_modules_vaadin_map_node_modules_ol_render_Feature_js.js.map +1 -1
  75. package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_BuilderGroup_js.js +17 -279
  76. package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_BuilderGroup_js.js.map +1 -1
  77. package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_Builder_js.js +16 -7
  78. package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_Builder_js.js.map +1 -1
  79. package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_ExecutorGroup_js.js +53 -17
  80. package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_ExecutorGroup_js.js.map +1 -1
  81. package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_Executor_js.js +336 -38
  82. package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_Executor_js.js.map +1 -1
  83. package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_Immediate_js.js +75 -42
  84. package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_Immediate_js.js.map +1 -1
  85. package/{node_modules_vaadin_map_node_modules_ol_render_canvas_PolygonBuilder_js.js → vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_PolygonBuilder_js.js} +77 -11
  86. package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_PolygonBuilder_js.js.map +1 -0
  87. package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_TextBuilder_js.js +210 -16
  88. package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_TextBuilder_js.js.map +1 -1
  89. package/vendors-node_modules_vaadin_map_node_modules_ol_renderer_canvas_Layer_js.js +88 -32
  90. package/vendors-node_modules_vaadin_map_node_modules_ol_renderer_canvas_Layer_js.js.map +1 -1
  91. package/vendors-node_modules_vaadin_map_node_modules_ol_renderer_canvas_VectorLayer_js.js +62 -22
  92. package/vendors-node_modules_vaadin_map_node_modules_ol_renderer_canvas_VectorLayer_js.js.map +1 -1
  93. package/vendors-node_modules_vaadin_map_node_modules_ol_renderer_vector_js.js +2 -2
  94. package/vendors-node_modules_vaadin_map_node_modules_ol_renderer_vector_js.js.map +1 -1
  95. package/vendors-node_modules_vaadin_map_node_modules_ol_source_Vector_js.js +135 -81
  96. package/vendors-node_modules_vaadin_map_node_modules_ol_source_Vector_js.js.map +1 -1
  97. package/node_modules_vaadin_map_node_modules_ol_render_VectorContext_js-_279c0.js.map +0 -1
  98. package/node_modules_vaadin_map_node_modules_ol_render_VectorContext_js-_279c1.js +0 -144
  99. package/node_modules_vaadin_map_node_modules_ol_render_VectorContext_js-_279c1.js.map +0 -1
  100. package/node_modules_vaadin_map_node_modules_ol_render_VectorContext_js-node_modules_vaadin_map_node_-a1378d.js.map +0 -1
  101. package/node_modules_vaadin_map_node_modules_ol_render_canvas_PolygonBuilder_js.js.map +0 -1
  102. package/node_modules_vaadin_map_node_modules_ol_style_js.js +0 -48
  103. package/node_modules_vaadin_map_node_modules_ol_style_js.js.map +0 -1
  104. package/vendors-node_modules_vaadin_map_node_modules_ol_geom_js-node_modules_vaadin_map_node_modules_-f0f4bb.js +0 -769
  105. package/vendors-node_modules_vaadin_map_node_modules_ol_geom_js-node_modules_vaadin_map_node_modules_-f0f4bb.js.map +0 -1
@@ -1,4 +1,4 @@
1
- (self["webpackChunk_vaadin_bundles"] = self["webpackChunk_vaadin_bundles"] || []).push([["node_modules_vaadin_map_node_modules_ol_render_canvas_PolygonBuilder_js"],{
1
+ (self["webpackChunk_vaadin_bundles"] = self["webpackChunk_vaadin_bundles"] || []).push([["vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_PolygonBuilder_js"],{
2
2
 
3
3
  /***/ "./node_modules/@vaadin/map/node_modules/ol/render/canvas/PolygonBuilder.js":
4
4
  /*!**********************************************************************************!*\
@@ -38,10 +38,11 @@ class CanvasPolygonBuilder extends _Builder_js__WEBPACK_IMPORTED_MODULE_0__["def
38
38
  * @param {number} offset Offset.
39
39
  * @param {Array<number>} ends Ends.
40
40
  * @param {number} stride Stride.
41
+ * @param {number} [strokeOffset] Stroke Offset in pixels.
41
42
  * @private
42
43
  * @return {number} End.
43
44
  */
44
- drawFlatCoordinatess_(flatCoordinates, offset, ends, stride) {
45
+ drawFlatCoordinatess_(flatCoordinates, offset, ends, stride, strokeOffset) {
45
46
  const state = this.state;
46
47
  const fill = state.fillStyle !== undefined;
47
48
  const stroke = state.strokeStyle !== undefined;
@@ -59,13 +60,20 @@ class CanvasPolygonBuilder extends _Builder_js__WEBPACK_IMPORTED_MODULE_0__["def
59
60
  true,
60
61
  !stroke,
61
62
  );
62
- const moveToLineToInstruction = [
63
+ this.instructions.push([
63
64
  _Instruction_js__WEBPACK_IMPORTED_MODULE_1__["default"].MOVE_TO_LINE_TO,
64
65
  myBegin,
65
66
  myEnd,
66
- ];
67
- this.instructions.push(moveToLineToInstruction);
68
- this.hitDetectionInstructions.push(moveToLineToInstruction);
67
+ strokeOffset * this.pixelRatio,
68
+ true,
69
+ ]);
70
+ this.hitDetectionInstructions.push([
71
+ _Instruction_js__WEBPACK_IMPORTED_MODULE_1__["default"].MOVE_TO_LINE_TO,
72
+ myBegin,
73
+ myEnd,
74
+ strokeOffset,
75
+ true,
76
+ ]);
69
77
  if (stroke) {
70
78
  // Performance optimization: only call closePath() when we have a stroke.
71
79
  // Otherwise the ring is closed already (see appendFlatLineCoordinates above).
@@ -95,9 +103,18 @@ class CanvasPolygonBuilder extends _Builder_js__WEBPACK_IMPORTED_MODULE_0__["def
95
103
  const state = this.state;
96
104
  const fillStyle = state.fillStyle;
97
105
  const strokeStyle = state.strokeStyle;
106
+ const strokeOffset = state.strokeOffset;
98
107
  if (fillStyle === undefined && strokeStyle === undefined) {
99
108
  return;
100
109
  }
110
+
111
+ if (
112
+ this.handleStrokeOffset_(() =>
113
+ this.drawCircle(circleGeometry, feature, index),
114
+ )
115
+ ) {
116
+ return;
117
+ }
101
118
  this.setFillStrokeStyles_();
102
119
  this.beginGeometry(circleGeometry, feature, index);
103
120
  if (state.fillStyle !== undefined) {
@@ -109,7 +126,7 @@ class CanvasPolygonBuilder extends _Builder_js__WEBPACK_IMPORTED_MODULE_0__["def
109
126
  if (state.strokeStyle !== undefined) {
110
127
  this.hitDetectionInstructions.push([
111
128
  _Instruction_js__WEBPACK_IMPORTED_MODULE_1__["default"].SET_STROKE_STYLE,
112
- state.strokeStyle,
129
+ _canvas_js__WEBPACK_IMPORTED_MODULE_2__.defaultStrokeStyle,
113
130
  state.lineWidth,
114
131
  state.lineCap,
115
132
  state.lineJoin,
@@ -129,7 +146,7 @@ class CanvasPolygonBuilder extends _Builder_js__WEBPACK_IMPORTED_MODULE_0__["def
129
146
  false,
130
147
  false,
131
148
  );
132
- const circleInstruction = [_Instruction_js__WEBPACK_IMPORTED_MODULE_1__["default"].CIRCLE, myBegin];
149
+ const circleInstruction = [_Instruction_js__WEBPACK_IMPORTED_MODULE_1__["default"].CIRCLE, myBegin, strokeOffset];
133
150
  this.instructions.push(_Instruction_js__WEBPACK_IMPORTED_MODULE_1__.beginPathInstruction, circleInstruction);
134
151
  this.hitDetectionInstructions.push(_Instruction_js__WEBPACK_IMPORTED_MODULE_1__.beginPathInstruction, circleInstruction);
135
152
  if (state.fillStyle !== undefined) {
@@ -153,9 +170,18 @@ class CanvasPolygonBuilder extends _Builder_js__WEBPACK_IMPORTED_MODULE_0__["def
153
170
  const state = this.state;
154
171
  const fillStyle = state.fillStyle;
155
172
  const strokeStyle = state.strokeStyle;
173
+ const strokeOffset = state.strokeOffset;
156
174
  if (fillStyle === undefined && strokeStyle === undefined) {
157
175
  return;
158
176
  }
177
+ if (
178
+ this.handleStrokeOffset_(() =>
179
+ this.drawPolygon(polygonGeometry, feature, index),
180
+ )
181
+ ) {
182
+ return;
183
+ }
184
+
159
185
  this.setFillStrokeStyles_();
160
186
  this.beginGeometry(polygonGeometry, feature, index);
161
187
  if (state.fillStyle !== undefined) {
@@ -167,7 +193,7 @@ class CanvasPolygonBuilder extends _Builder_js__WEBPACK_IMPORTED_MODULE_0__["def
167
193
  if (state.strokeStyle !== undefined) {
168
194
  this.hitDetectionInstructions.push([
169
195
  _Instruction_js__WEBPACK_IMPORTED_MODULE_1__["default"].SET_STROKE_STYLE,
170
- state.strokeStyle,
196
+ _canvas_js__WEBPACK_IMPORTED_MODULE_2__.defaultStrokeStyle,
171
197
  state.lineWidth,
172
198
  state.lineCap,
173
199
  state.lineJoin,
@@ -184,6 +210,7 @@ class CanvasPolygonBuilder extends _Builder_js__WEBPACK_IMPORTED_MODULE_0__["def
184
210
  0,
185
211
  /** @type {Array<number>} */ (ends),
186
212
  stride,
213
+ strokeOffset,
187
214
  );
188
215
  this.endGeometry(feature);
189
216
  }
@@ -198,9 +225,17 @@ class CanvasPolygonBuilder extends _Builder_js__WEBPACK_IMPORTED_MODULE_0__["def
198
225
  const state = this.state;
199
226
  const fillStyle = state.fillStyle;
200
227
  const strokeStyle = state.strokeStyle;
228
+ const strokeOffset = state.strokeOffset;
201
229
  if (fillStyle === undefined && strokeStyle === undefined) {
202
230
  return;
203
231
  }
232
+ if (
233
+ this.handleStrokeOffset_(() =>
234
+ this.drawMultiPolygon(multiPolygonGeometry, feature, index),
235
+ )
236
+ ) {
237
+ return;
238
+ }
204
239
  this.setFillStrokeStyles_();
205
240
  this.beginGeometry(multiPolygonGeometry, feature, index);
206
241
  if (state.fillStyle !== undefined) {
@@ -212,7 +247,7 @@ class CanvasPolygonBuilder extends _Builder_js__WEBPACK_IMPORTED_MODULE_0__["def
212
247
  if (state.strokeStyle !== undefined) {
213
248
  this.hitDetectionInstructions.push([
214
249
  _Instruction_js__WEBPACK_IMPORTED_MODULE_1__["default"].SET_STROKE_STYLE,
215
- state.strokeStyle,
250
+ _canvas_js__WEBPACK_IMPORTED_MODULE_2__.defaultStrokeStyle,
216
251
  state.lineWidth,
217
252
  state.lineCap,
218
253
  state.lineJoin,
@@ -231,6 +266,7 @@ class CanvasPolygonBuilder extends _Builder_js__WEBPACK_IMPORTED_MODULE_0__["def
231
266
  offset,
232
267
  endss[i],
233
268
  stride,
269
+ strokeOffset,
234
270
  );
235
271
  }
236
272
  this.endGeometry(feature);
@@ -265,6 +301,36 @@ class CanvasPolygonBuilder extends _Builder_js__WEBPACK_IMPORTED_MODULE_0__["def
265
301
  this.updateFillStyle(state, this.createFill);
266
302
  this.updateStrokeStyle(state, this.applyStroke);
267
303
  }
304
+
305
+ handleStrokeOffset_(drawGeometryCallback) {
306
+ const state = this.state;
307
+ const fillStyle = state.fillStyle;
308
+ const strokeStyle = state.strokeStyle;
309
+ const strokeOffset = state.strokeOffset;
310
+
311
+ // In case both fill style and stroke style are defined and the stroke style has an offset,
312
+ // the stroke and fill should be done in separate steps, because offset stroke shape will
313
+ // be different from the original shape used for the fill.
314
+ if (
315
+ Math.abs(strokeOffset) > 0 &&
316
+ fillStyle !== undefined &&
317
+ strokeStyle !== undefined
318
+ ) {
319
+ // First do only fill
320
+ state.strokeStyle = undefined;
321
+ state.strokeOffset = 0;
322
+ drawGeometryCallback();
323
+ // Now separately do the stroke
324
+ state.fillStyle = undefined;
325
+ state.strokeStyle = strokeStyle;
326
+ state.strokeOffset = strokeOffset;
327
+ drawGeometryCallback();
328
+ // Reset the state to the original
329
+ state.fillStyle = fillStyle;
330
+ return true;
331
+ }
332
+ return false;
333
+ }
268
334
  }
269
335
 
270
336
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (CanvasPolygonBuilder);
@@ -273,4 +339,4 @@ class CanvasPolygonBuilder extends _Builder_js__WEBPACK_IMPORTED_MODULE_0__["def
273
339
  /***/ })
274
340
 
275
341
  }])
276
- //# sourceMappingURL=node_modules_vaadin_map_node_modules_ol_render_canvas_PolygonBuilder_js.js.map
342
+ //# sourceMappingURL=vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_PolygonBuilder_js.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_PolygonBuilder_js.js","mappings":";;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACiD;AAM3B;AACmB;AAMf;;AAE1B,mCAAmC,mDAAa;AAChD;AACA,aAAa,QAAQ;AACrB,aAAa,kCAAkC;AAC/C,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA,aAAa,eAAe;AAC5B,aAAa,QAAQ;AACrB,aAAa,eAAe;AAC5B,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB;AACA,cAAc,QAAQ;AACtB;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,iEAAoB;AAC/C,uCAAuC,iEAAoB;AAC3D,oBAAoB,aAAa;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,uEAAiC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,uEAAiC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,iEAAoB;AACnD,2CAA2C,iEAAoB;AAC/D;AACA;AACA;AACA;AACA,6BAA6B,4DAAe;AAC5C,yCAAyC,4DAAe;AACxD;AACA;AACA,6BAA6B,8DAAiB;AAC9C,yCAAyC,8DAAiB;AAC1D;AACA;AACA;;AAEA;AACA,aAAa,wCAAwC;AACrD,aAAa,oCAAoC;AACjD,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,sEAAgC;AACxC,QAAQ,wDAAgB;AACxB;AACA;AACA;AACA;AACA,QAAQ,wEAAkC;AAC1C,QAAQ,0DAAkB;AAC1B;AACA;AACA;AACA;AACA,QAAQ,uDAAe;AACvB,QAAQ,6DAAqB;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,8DAAwB;AACvD,2BAA2B,iEAAoB;AAC/C,uCAAuC,iEAAoB;AAC3D;AACA,6BAA6B,4DAAe;AAC5C,yCAAyC,4DAAe;AACxD;AACA;AACA,6BAA6B,8DAAiB;AAC9C,yCAAyC,8DAAiB;AAC1D;AACA;AACA;;AAEA;AACA,aAAa,yEAAyE;AACtF,aAAa,wCAAwC;AACrD,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,QAAQ,sEAAgC;AACxC,QAAQ,wDAAgB;AACxB;AACA;AACA;AACA;AACA,QAAQ,wEAAkC;AAC1C,QAAQ,0DAAkB;AAC1B;AACA;AACA;AACA;AACA,QAAQ,uDAAe;AACvB,QAAQ,6DAAqB;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,eAAe;AAChC;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,8CAA8C;AAC3D,aAAa,wCAAwC;AACrD,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,sEAAgC;AACxC,QAAQ,wDAAgB;AACxB;AACA;AACA;AACA;AACA,QAAQ,wEAAkC;AAC1C,QAAQ,0DAAkB;AAC1B;AACA;AACA;AACA;AACA,QAAQ,uDAAe;AACvB,QAAQ,6DAAqB;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,QAAQ;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,iDAAiD;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C,QAAQ;AACvD,yBAAyB,4DAAI;AAC7B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iEAAe,oBAAoB,EAAC","sources":["webpack://@vaadin/bundles/./node_modules/@vaadin/map/node_modules/ol/render/canvas/PolygonBuilder.js"],"sourcesContent":["/**\n * @module ol/render/canvas/PolygonBuilder\n */\nimport {snap} from '../../geom/flat/simplify.js';\nimport {\n defaultFillStyle,\n defaultLineDash,\n defaultLineDashOffset,\n defaultStrokeStyle,\n} from '../canvas.js';\nimport CanvasBuilder from './Builder.js';\nimport CanvasInstruction, {\n beginPathInstruction,\n closePathInstruction,\n fillInstruction,\n strokeInstruction,\n} from './Instruction.js';\n\nclass CanvasPolygonBuilder extends CanvasBuilder {\n /**\n * @param {number} tolerance Tolerance.\n * @param {import(\"../../extent.js\").Extent} maxExtent Maximum extent.\n * @param {number} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n */\n constructor(tolerance, maxExtent, resolution, pixelRatio) {\n super(tolerance, maxExtent, resolution, pixelRatio);\n }\n\n /**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<number>} ends Ends.\n * @param {number} stride Stride.\n * @param {number} [strokeOffset] Stroke Offset in pixels.\n * @private\n * @return {number} End.\n */\n drawFlatCoordinatess_(flatCoordinates, offset, ends, stride, strokeOffset) {\n const state = this.state;\n const fill = state.fillStyle !== undefined;\n const stroke = state.strokeStyle !== undefined;\n const numEnds = ends.length;\n this.instructions.push(beginPathInstruction);\n this.hitDetectionInstructions.push(beginPathInstruction);\n for (let i = 0; i < numEnds; ++i) {\n const end = ends[i];\n const myBegin = this.coordinates.length;\n const myEnd = this.appendFlatLineCoordinates(\n flatCoordinates,\n offset,\n end,\n stride,\n true,\n !stroke,\n );\n this.instructions.push([\n CanvasInstruction.MOVE_TO_LINE_TO,\n myBegin,\n myEnd,\n strokeOffset * this.pixelRatio,\n true,\n ]);\n this.hitDetectionInstructions.push([\n CanvasInstruction.MOVE_TO_LINE_TO,\n myBegin,\n myEnd,\n strokeOffset,\n true,\n ]);\n if (stroke) {\n // Performance optimization: only call closePath() when we have a stroke.\n // Otherwise the ring is closed already (see appendFlatLineCoordinates above).\n this.instructions.push(closePathInstruction);\n this.hitDetectionInstructions.push(closePathInstruction);\n }\n offset = end;\n }\n if (fill) {\n this.instructions.push(fillInstruction);\n this.hitDetectionInstructions.push(fillInstruction);\n }\n if (stroke) {\n this.instructions.push(strokeInstruction);\n this.hitDetectionInstructions.push(strokeInstruction);\n }\n return offset;\n }\n\n /**\n * @param {import(\"../../geom/Circle.js\").default} circleGeometry Circle geometry.\n * @param {import(\"../../Feature.js\").default} feature Feature.\n * @param {number} [index] Render order index.\n * @override\n */\n drawCircle(circleGeometry, feature, index) {\n const state = this.state;\n const fillStyle = state.fillStyle;\n const strokeStyle = state.strokeStyle;\n const strokeOffset = state.strokeOffset;\n if (fillStyle === undefined && strokeStyle === undefined) {\n return;\n }\n\n if (\n this.handleStrokeOffset_(() =>\n this.drawCircle(circleGeometry, feature, index),\n )\n ) {\n return;\n }\n this.setFillStrokeStyles_();\n this.beginGeometry(circleGeometry, feature, index);\n if (state.fillStyle !== undefined) {\n this.hitDetectionInstructions.push([\n CanvasInstruction.SET_FILL_STYLE,\n defaultFillStyle,\n ]);\n }\n if (state.strokeStyle !== undefined) {\n this.hitDetectionInstructions.push([\n CanvasInstruction.SET_STROKE_STYLE,\n defaultStrokeStyle,\n state.lineWidth,\n state.lineCap,\n state.lineJoin,\n state.miterLimit,\n defaultLineDash,\n defaultLineDashOffset,\n ]);\n }\n const flatCoordinates = circleGeometry.getFlatCoordinates();\n const stride = circleGeometry.getStride();\n const myBegin = this.coordinates.length;\n this.appendFlatLineCoordinates(\n flatCoordinates,\n 0,\n flatCoordinates.length,\n stride,\n false,\n false,\n );\n const circleInstruction = [CanvasInstruction.CIRCLE, myBegin, strokeOffset];\n this.instructions.push(beginPathInstruction, circleInstruction);\n this.hitDetectionInstructions.push(beginPathInstruction, circleInstruction);\n if (state.fillStyle !== undefined) {\n this.instructions.push(fillInstruction);\n this.hitDetectionInstructions.push(fillInstruction);\n }\n if (state.strokeStyle !== undefined) {\n this.instructions.push(strokeInstruction);\n this.hitDetectionInstructions.push(strokeInstruction);\n }\n this.endGeometry(feature);\n }\n\n /**\n * @param {import(\"../../geom/Polygon.js\").default|import(\"../Feature.js\").default} polygonGeometry Polygon geometry.\n * @param {import(\"../../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n * @override\n */\n drawPolygon(polygonGeometry, feature, index) {\n const state = this.state;\n const fillStyle = state.fillStyle;\n const strokeStyle = state.strokeStyle;\n const strokeOffset = state.strokeOffset;\n if (fillStyle === undefined && strokeStyle === undefined) {\n return;\n }\n if (\n this.handleStrokeOffset_(() =>\n this.drawPolygon(polygonGeometry, feature, index),\n )\n ) {\n return;\n }\n\n this.setFillStrokeStyles_();\n this.beginGeometry(polygonGeometry, feature, index);\n if (state.fillStyle !== undefined) {\n this.hitDetectionInstructions.push([\n CanvasInstruction.SET_FILL_STYLE,\n defaultFillStyle,\n ]);\n }\n if (state.strokeStyle !== undefined) {\n this.hitDetectionInstructions.push([\n CanvasInstruction.SET_STROKE_STYLE,\n defaultStrokeStyle,\n state.lineWidth,\n state.lineCap,\n state.lineJoin,\n state.miterLimit,\n defaultLineDash,\n defaultLineDashOffset,\n ]);\n }\n const ends = polygonGeometry.getEnds();\n const flatCoordinates = polygonGeometry.getOrientedFlatCoordinates();\n const stride = polygonGeometry.getStride();\n this.drawFlatCoordinatess_(\n flatCoordinates,\n 0,\n /** @type {Array<number>} */ (ends),\n stride,\n strokeOffset,\n );\n this.endGeometry(feature);\n }\n\n /**\n * @param {import(\"../../geom/MultiPolygon.js\").default} multiPolygonGeometry MultiPolygon geometry.\n * @param {import(\"../../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n * @override\n */\n drawMultiPolygon(multiPolygonGeometry, feature, index) {\n const state = this.state;\n const fillStyle = state.fillStyle;\n const strokeStyle = state.strokeStyle;\n const strokeOffset = state.strokeOffset;\n if (fillStyle === undefined && strokeStyle === undefined) {\n return;\n }\n if (\n this.handleStrokeOffset_(() =>\n this.drawMultiPolygon(multiPolygonGeometry, feature, index),\n )\n ) {\n return;\n }\n this.setFillStrokeStyles_();\n this.beginGeometry(multiPolygonGeometry, feature, index);\n if (state.fillStyle !== undefined) {\n this.hitDetectionInstructions.push([\n CanvasInstruction.SET_FILL_STYLE,\n defaultFillStyle,\n ]);\n }\n if (state.strokeStyle !== undefined) {\n this.hitDetectionInstructions.push([\n CanvasInstruction.SET_STROKE_STYLE,\n defaultStrokeStyle,\n state.lineWidth,\n state.lineCap,\n state.lineJoin,\n state.miterLimit,\n defaultLineDash,\n defaultLineDashOffset,\n ]);\n }\n const endss = multiPolygonGeometry.getEndss();\n const flatCoordinates = multiPolygonGeometry.getOrientedFlatCoordinates();\n const stride = multiPolygonGeometry.getStride();\n let offset = 0;\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n offset = this.drawFlatCoordinatess_(\n flatCoordinates,\n offset,\n endss[i],\n stride,\n strokeOffset,\n );\n }\n this.endGeometry(feature);\n }\n\n /**\n * @return {import(\"../canvas.js\").SerializableInstructions} the serializable instructions.\n * @override\n */\n finish() {\n this.reverseHitDetectionInstructions();\n this.state = null;\n // We want to preserve topology when drawing polygons. Polygons are\n // simplified using quantization and point elimination. However, we might\n // have received a mix of quantized and non-quantized geometries, so ensure\n // that all are quantized by quantizing all coordinates in the batch.\n const tolerance = this.tolerance;\n if (tolerance !== 0) {\n const coordinates = this.coordinates;\n for (let i = 0, ii = coordinates.length; i < ii; ++i) {\n coordinates[i] = snap(coordinates[i], tolerance);\n }\n }\n return super.finish();\n }\n\n /**\n * @private\n */\n setFillStrokeStyles_() {\n const state = this.state;\n this.updateFillStyle(state, this.createFill);\n this.updateStrokeStyle(state, this.applyStroke);\n }\n\n handleStrokeOffset_(drawGeometryCallback) {\n const state = this.state;\n const fillStyle = state.fillStyle;\n const strokeStyle = state.strokeStyle;\n const strokeOffset = state.strokeOffset;\n\n // In case both fill style and stroke style are defined and the stroke style has an offset,\n // the stroke and fill should be done in separate steps, because offset stroke shape will\n // be different from the original shape used for the fill.\n if (\n Math.abs(strokeOffset) > 0 &&\n fillStyle !== undefined &&\n strokeStyle !== undefined\n ) {\n // First do only fill\n state.strokeStyle = undefined;\n state.strokeOffset = 0;\n drawGeometryCallback();\n // Now separately do the stroke\n state.fillStyle = undefined;\n state.strokeStyle = strokeStyle;\n state.strokeOffset = strokeOffset;\n drawGeometryCallback();\n // Reset the state to the original\n state.fillStyle = fillStyle;\n return true;\n }\n return false;\n }\n}\n\nexport default CanvasPolygonBuilder;\n"],"names":[],"sourceRoot":""}
@@ -1,5 +1,173 @@
1
1
  (self["webpackChunk_vaadin_bundles"] = self["webpackChunk_vaadin_bundles"] || []).push([["vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_TextBuilder_js"],{
2
2
 
3
+ /***/ "./node_modules/@vaadin/map/node_modules/ol/geom/flat/clip.js":
4
+ /*!********************************************************************!*\
5
+ !*** ./node_modules/@vaadin/map/node_modules/ol/geom/flat/clip.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 */ "clipFlatLineStrings": () => (/* binding */ clipFlatLineStrings)
12
+ /* harmony export */ });
13
+ /**
14
+ * @module ol/geom/flat/clip
15
+ */
16
+
17
+ /**
18
+ * Start parameter of the portion of the last clipped segment that is inside the
19
+ * extent. Set by {@link clipSegment}, read right after a `true` return to avoid
20
+ * allocating a result array per segment.
21
+ * @type {number}
22
+ */
23
+ let clipSegmentStart = 0;
24
+
25
+ /**
26
+ * End parameter of the portion of the last clipped segment that is inside the
27
+ * extent. See {@link clipSegmentStart}.
28
+ * @type {number}
29
+ */
30
+ let clipSegmentEnd = 1;
31
+
32
+ /**
33
+ * Clip a segment to a rectangular extent. On a `true` return, the inside
34
+ * portion is `[clipSegmentStart, clipSegmentEnd]` in segment parameters. No
35
+ * allocations are made, so the result globals must be read before the next
36
+ * call.
37
+ * @param {number} minX Minimum X.
38
+ * @param {number} minY Minimum Y.
39
+ * @param {number} maxX Maximum X.
40
+ * @param {number} maxY Maximum Y.
41
+ * @param {number} x0 Segment start X.
42
+ * @param {number} y0 Segment start Y.
43
+ * @param {number} x1 Segment end X.
44
+ * @param {number} y1 Segment end Y.
45
+ * @return {boolean} The segment intersects the extent.
46
+ */
47
+ function clipSegment(minX, minY, maxX, maxY, x0, y0, x1, y1) {
48
+ const dx = x1 - x0;
49
+ const dy = y1 - y0;
50
+ let t0 = 0;
51
+ let t1 = 1;
52
+
53
+ // X slab.
54
+ if (dx === 0) {
55
+ if (x0 < minX || x0 > maxX) {
56
+ return false;
57
+ }
58
+ } else {
59
+ let ta = (minX - x0) / dx;
60
+ let tb = (maxX - x0) / dx;
61
+ if (ta > tb) {
62
+ const tmp = ta;
63
+ ta = tb;
64
+ tb = tmp;
65
+ }
66
+ if (ta > t0) {
67
+ t0 = ta;
68
+ }
69
+ if (tb < t1) {
70
+ t1 = tb;
71
+ }
72
+ if (t0 > t1) {
73
+ return false;
74
+ }
75
+ }
76
+
77
+ // Y slab.
78
+ if (dy === 0) {
79
+ if (y0 < minY || y0 > maxY) {
80
+ return false;
81
+ }
82
+ } else {
83
+ let ta = (minY - y0) / dy;
84
+ let tb = (maxY - y0) / dy;
85
+ if (ta > tb) {
86
+ const tmp = ta;
87
+ ta = tb;
88
+ tb = tmp;
89
+ }
90
+ if (ta > t0) {
91
+ t0 = ta;
92
+ }
93
+ if (tb < t1) {
94
+ t1 = tb;
95
+ }
96
+ if (t0 > t1) {
97
+ return false;
98
+ }
99
+ }
100
+
101
+ clipSegmentStart = t0;
102
+ clipSegmentEnd = t1;
103
+ return true;
104
+ }
105
+
106
+ /**
107
+ * Clip flat line strings to the given extent. Parts outside the extent are
108
+ * dropped and a vertex is inserted where a segment crosses the boundary. A line
109
+ * that leaves and re-enters the extent is split into separate parts so that
110
+ * positions derived from the result (e.g. labels placed along the line) stay
111
+ * within the extent. Output coordinates have a stride of 2.
112
+ * @param {Array<number>} flatCoordinates Flat coordinates.
113
+ * @param {Array<number>} ends Ends.
114
+ * @param {number} stride Stride.
115
+ * @param {import("../../extent.js").Extent} extent Extent to clip to.
116
+ * @return {{flatCoordinates: Array<number>, ends: Array<number>}} Clipped flat
117
+ * coordinates and ends.
118
+ */
119
+ function clipFlatLineStrings(flatCoordinates, ends, stride, extent) {
120
+ const minX = extent[0];
121
+ const minY = extent[1];
122
+ const maxX = extent[2];
123
+ const maxY = extent[3];
124
+ const dest = [];
125
+ const destEnds = [];
126
+ let open = false;
127
+ let lastX, lastY;
128
+ let offset = 0;
129
+ for (let e = 0, ee = ends.length; e < ee; ++e) {
130
+ const end = ends[e];
131
+ let prevX = flatCoordinates[offset];
132
+ let prevY = flatCoordinates[offset + 1];
133
+ let lineHasLast = false;
134
+ for (let i = offset + stride; i < end; i += stride) {
135
+ const curX = flatCoordinates[i];
136
+ const curY = flatCoordinates[i + 1];
137
+ if (clipSegment(minX, minY, maxX, maxY, prevX, prevY, curX, curY)) {
138
+ const dx = curX - prevX;
139
+ const dy = curY - prevY;
140
+ const ax = prevX + clipSegmentStart * dx;
141
+ const ay = prevY + clipSegmentStart * dy;
142
+ const bx = prevX + clipSegmentEnd * dx;
143
+ const by = prevY + clipSegmentEnd * dy;
144
+ if (open && lineHasLast && ax === lastX && ay === lastY) {
145
+ dest.push(bx, by);
146
+ } else {
147
+ if (open) {
148
+ destEnds.push(dest.length);
149
+ }
150
+ dest.push(ax, ay, bx, by);
151
+ open = true;
152
+ }
153
+ lastX = bx;
154
+ lastY = by;
155
+ lineHasLast = true;
156
+ }
157
+ prevX = curX;
158
+ prevY = curY;
159
+ }
160
+ offset = end;
161
+ }
162
+ if (open) {
163
+ destEnds.push(dest.length);
164
+ }
165
+ return {flatCoordinates: dest, ends: destEnds};
166
+ }
167
+
168
+
169
+ /***/ }),
170
+
3
171
  /***/ "./node_modules/@vaadin/map/node_modules/ol/geom/flat/linechunk.js":
4
172
  /*!*************************************************************************!*\
5
173
  !*** ./node_modules/@vaadin/map/node_modules/ol/geom/flat/linechunk.js ***!
@@ -147,14 +315,15 @@ __webpack_require__.r(__webpack_exports__);
147
315
  /* harmony export */ "TEXT_ALIGN": () => (/* binding */ TEXT_ALIGN),
148
316
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
149
317
  /* harmony export */ });
150
- /* harmony import */ var _colorlike_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../colorlike.js */ "./node_modules/@vaadin/map/node_modules/ol/colorlike.js");
318
+ /* harmony import */ var _colorlike_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../colorlike.js */ "./node_modules/@vaadin/map/node_modules/ol/colorlike.js");
151
319
  /* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../extent.js */ "./node_modules/@vaadin/map/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/@vaadin/map/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/@vaadin/map/node_modules/ol/geom/flat/straightchunk.js");
154
- /* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../util.js */ "./node_modules/@vaadin/map/node_modules/ol/util.js");
320
+ /* harmony import */ var _geom_flat_clip_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../geom/flat/clip.js */ "./node_modules/@vaadin/map/node_modules/ol/geom/flat/clip.js");
321
+ /* harmony import */ var _geom_flat_linechunk_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../geom/flat/linechunk.js */ "./node_modules/@vaadin/map/node_modules/ol/geom/flat/linechunk.js");
322
+ /* harmony import */ var _geom_flat_straightchunk_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../geom/flat/straightchunk.js */ "./node_modules/@vaadin/map/node_modules/ol/geom/flat/straightchunk.js");
323
+ /* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../util.js */ "./node_modules/@vaadin/map/node_modules/ol/util.js");
155
324
  /* harmony import */ var _canvas_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../canvas.js */ "./node_modules/@vaadin/map/node_modules/ol/render/canvas.js");
156
325
  /* harmony import */ var _Builder_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Builder.js */ "./node_modules/@vaadin/map/node_modules/ol/render/canvas/Builder.js");
157
- /* harmony import */ var _Instruction_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Instruction.js */ "./node_modules/@vaadin/map/node_modules/ol/render/canvas/Instruction.js");
326
+ /* harmony import */ var _Instruction_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Instruction.js */ "./node_modules/@vaadin/map/node_modules/ol/render/canvas/Instruction.js");
158
327
  /**
159
328
  * @module ol/render/canvas/TextBuilder
160
329
  */
@@ -166,6 +335,7 @@ __webpack_require__.r(__webpack_exports__);
166
335
 
167
336
 
168
337
 
338
+
169
339
  /**
170
340
  * @const
171
341
  * @type {{left: 0, center: 0.5, right: 1, top: 0, middle: 0.5, hanging: 0.2, alphabetic: 0.8, ideographic: 0.8, bottom: 1}}
@@ -340,7 +510,8 @@ class CanvasTextBuilder extends _Builder_js__WEBPACK_IMPORTED_MODULE_0__["defaul
340
510
  geometryType == 'Polygon' ||
341
511
  geometryType == 'MultiPolygon')
342
512
  ) {
343
- if (!(0,_extent_js__WEBPACK_IMPORTED_MODULE_2__.intersects)(this.maxExtent, geometry.getExtent())) {
513
+ const geometryExtent = geometry.getExtent();
514
+ if (!(0,_extent_js__WEBPACK_IMPORTED_MODULE_2__.intersects)(this.maxExtent, geometryExtent)) {
344
515
  return;
345
516
  }
346
517
  let ends;
@@ -365,6 +536,26 @@ class CanvasTextBuilder extends _Builder_js__WEBPACK_IMPORTED_MODULE_0__["defaul
365
536
  ends.push(endss[i][0]);
366
537
  }
367
538
  }
539
+ if (
540
+ (geometryType == 'LineString' || geometryType == 'MultiLineString') &&
541
+ !(0,_extent_js__WEBPACK_IMPORTED_MODULE_2__.containsExtent)(this.getBufferedMaxExtent(), geometryExtent)
542
+ ) {
543
+ // Clip the line to the rendered extent so the label is anchored within
544
+ // the rendered area instead of along the full geometry, whose center
545
+ // can lie outside it.
546
+ const clipped = (0,_geom_flat_clip_js__WEBPACK_IMPORTED_MODULE_3__.clipFlatLineStrings)(
547
+ flatCoordinates,
548
+ ends,
549
+ stride,
550
+ this.getBufferedMaxExtent(),
551
+ );
552
+ flatCoordinates = clipped.flatCoordinates;
553
+ ends = clipped.ends;
554
+ stride = 2;
555
+ if (ends.length === 0) {
556
+ return;
557
+ }
558
+ }
368
559
  this.beginGeometry(geometry, feature, index);
369
560
  const repeat = textState.repeat;
370
561
  const textAlign = repeat ? undefined : textState.textAlign;
@@ -373,7 +564,7 @@ class CanvasTextBuilder extends _Builder_js__WEBPACK_IMPORTED_MODULE_0__["defaul
373
564
  for (let o = 0, oo = ends.length; o < oo; ++o) {
374
565
  let chunks;
375
566
  if (repeat) {
376
- chunks = (0,_geom_flat_linechunk_js__WEBPACK_IMPORTED_MODULE_3__.lineChunk)(
567
+ chunks = (0,_geom_flat_linechunk_js__WEBPACK_IMPORTED_MODULE_4__.lineChunk)(
377
568
  repeat * this.resolution,
378
569
  flatCoordinates,
379
570
  flatOffset,
@@ -388,7 +579,7 @@ class CanvasTextBuilder extends _Builder_js__WEBPACK_IMPORTED_MODULE_0__["defaul
388
579
  let chunkBegin = 0;
389
580
  let chunkEnd = chunk.length;
390
581
  if (textAlign == undefined) {
391
- const range = (0,_geom_flat_straightchunk_js__WEBPACK_IMPORTED_MODULE_4__.matchingChunk)(
582
+ const range = (0,_geom_flat_straightchunk_js__WEBPACK_IMPORTED_MODULE_5__.matchingChunk)(
392
583
  textState.maxAngle,
393
584
  chunk,
394
585
  0,
@@ -523,7 +714,7 @@ class CanvasTextBuilder extends _Builder_js__WEBPACK_IMPORTED_MODULE_0__["defaul
523
714
  // render time.
524
715
  const pixelRatio = this.pixelRatio;
525
716
  this.instructions.push([
526
- _Instruction_js__WEBPACK_IMPORTED_MODULE_5__["default"].DRAW_IMAGE,
717
+ _Instruction_js__WEBPACK_IMPORTED_MODULE_6__["default"].DRAW_IMAGE,
527
718
  begin,
528
719
  end,
529
720
  null,
@@ -563,7 +754,7 @@ class CanvasTextBuilder extends _Builder_js__WEBPACK_IMPORTED_MODULE_0__["defaul
563
754
  hitDetectionBackgroundFill[1] = _canvas_js__WEBPACK_IMPORTED_MODULE_1__.defaultFillStyle;
564
755
  }
565
756
  this.hitDetectionInstructions.push([
566
- _Instruction_js__WEBPACK_IMPORTED_MODULE_5__["default"].DRAW_IMAGE,
757
+ _Instruction_js__WEBPACK_IMPORTED_MODULE_6__["default"].DRAW_IMAGE,
567
758
  begin,
568
759
  end,
569
760
  null,
@@ -654,6 +845,7 @@ class CanvasTextBuilder extends _Builder_js__WEBPACK_IMPORTED_MODULE_0__["defaul
654
845
  const pixelRatio = this.pixelRatio;
655
846
  const baseline = TEXT_ALIGN[textState.textBaseline];
656
847
 
848
+ const offsetX = this.textOffsetX_ * pixelRatio;
657
849
  const offsetY = this.textOffsetY_ * pixelRatio;
658
850
  const text = this.text_;
659
851
  const strokeWidth = strokeState
@@ -661,7 +853,7 @@ class CanvasTextBuilder extends _Builder_js__WEBPACK_IMPORTED_MODULE_0__["defaul
661
853
  : 0;
662
854
 
663
855
  this.instructions.push([
664
- _Instruction_js__WEBPACK_IMPORTED_MODULE_5__["default"].DRAW_CHARS,
856
+ _Instruction_js__WEBPACK_IMPORTED_MODULE_6__["default"].DRAW_CHARS,
665
857
  begin,
666
858
  end,
667
859
  baseline,
@@ -677,9 +869,10 @@ class CanvasTextBuilder extends _Builder_js__WEBPACK_IMPORTED_MODULE_0__["defaul
677
869
  1,
678
870
  this.declutterMode_,
679
871
  this.textKeepUpright_,
872
+ offsetX,
680
873
  ]);
681
874
  this.hitDetectionInstructions.push([
682
- _Instruction_js__WEBPACK_IMPORTED_MODULE_5__["default"].DRAW_CHARS,
875
+ _Instruction_js__WEBPACK_IMPORTED_MODULE_6__["default"].DRAW_CHARS,
683
876
  begin,
684
877
  end,
685
878
  baseline,
@@ -695,6 +888,7 @@ class CanvasTextBuilder extends _Builder_js__WEBPACK_IMPORTED_MODULE_0__["defaul
695
888
  1 / pixelRatio,
696
889
  this.declutterMode_,
697
890
  this.textKeepUpright_,
891
+ offsetX,
698
892
  ]);
699
893
  }
700
894
 
@@ -718,7 +912,7 @@ class CanvasTextBuilder extends _Builder_js__WEBPACK_IMPORTED_MODULE_0__["defaul
718
912
  fillState = /** @type {import("../canvas.js").FillState} */ ({});
719
913
  this.textFillState_ = fillState;
720
914
  }
721
- fillState.fillStyle = (0,_colorlike_js__WEBPACK_IMPORTED_MODULE_6__.asColorLike)(
915
+ fillState.fillStyle = (0,_colorlike_js__WEBPACK_IMPORTED_MODULE_7__.asColorLike)(
722
916
  textFillStyle.getColor() || _canvas_js__WEBPACK_IMPORTED_MODULE_1__.defaultFillStyle,
723
917
  );
724
918
  }
@@ -746,7 +940,7 @@ class CanvasTextBuilder extends _Builder_js__WEBPACK_IMPORTED_MODULE_0__["defaul
746
940
  lineWidth === undefined ? _canvas_js__WEBPACK_IMPORTED_MODULE_1__.defaultLineWidth : lineWidth;
747
941
  strokeState.miterLimit =
748
942
  miterLimit === undefined ? _canvas_js__WEBPACK_IMPORTED_MODULE_1__.defaultMiterLimit : miterLimit;
749
- strokeState.strokeStyle = (0,_colorlike_js__WEBPACK_IMPORTED_MODULE_6__.asColorLike)(
943
+ strokeState.strokeStyle = (0,_colorlike_js__WEBPACK_IMPORTED_MODULE_7__.asColorLike)(
750
944
  textStrokeStyle.getColor() || _canvas_js__WEBPACK_IMPORTED_MODULE_1__.defaultStrokeStyle,
751
945
  );
752
946
  }
@@ -786,7 +980,7 @@ class CanvasTextBuilder extends _Builder_js__WEBPACK_IMPORTED_MODULE_0__["defaul
786
980
  this.strokeKey_ = strokeState
787
981
  ? (typeof strokeState.strokeStyle == 'string'
788
982
  ? strokeState.strokeStyle
789
- : (0,_util_js__WEBPACK_IMPORTED_MODULE_7__.getUid)(strokeState.strokeStyle)) +
983
+ : (0,_util_js__WEBPACK_IMPORTED_MODULE_8__.getUid)(strokeState.strokeStyle)) +
790
984
  strokeState.lineCap +
791
985
  strokeState.lineDashOffset +
792
986
  '|' +
@@ -808,7 +1002,7 @@ class CanvasTextBuilder extends _Builder_js__WEBPACK_IMPORTED_MODULE_0__["defaul
808
1002
  fillState && fillState.fillStyle
809
1003
  ? typeof fillState.fillStyle == 'string'
810
1004
  ? fillState.fillStyle
811
- : '|' + (0,_util_js__WEBPACK_IMPORTED_MODULE_7__.getUid)(fillState.fillStyle)
1005
+ : '|' + (0,_util_js__WEBPACK_IMPORTED_MODULE_8__.getUid)(fillState.fillStyle)
812
1006
  : '';
813
1007
  }
814
1008
  this.declutterMode_ = textStyle.getDeclutterMode();