@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.
- package/node_modules_vaadin_map_node_modules_ol_control_MousePosition_js.js +6 -6
- package/node_modules_vaadin_map_node_modules_ol_control_MousePosition_js.js.map +1 -1
- package/node_modules_vaadin_map_node_modules_ol_control_ZoomToExtent_js.js +10 -1
- package/node_modules_vaadin_map_node_modules_ol_control_ZoomToExtent_js.js.map +1 -1
- package/node_modules_vaadin_map_node_modules_ol_events_SnapEvent_js.js +5 -0
- package/node_modules_vaadin_map_node_modules_ol_events_SnapEvent_js.js.map +1 -1
- package/node_modules_vaadin_map_node_modules_ol_featureloader_js.js +9 -8
- package/node_modules_vaadin_map_node_modules_ol_featureloader_js.js.map +1 -1
- package/node_modules_vaadin_map_node_modules_ol_geom_GeometryCollection_js.js +1 -1
- package/node_modules_vaadin_map_node_modules_ol_geom_GeometryCollection_js.js.map +1 -1
- package/node_modules_vaadin_map_node_modules_ol_geom_flat_clip_js.js +172 -0
- package/node_modules_vaadin_map_node_modules_ol_geom_flat_clip_js.js.map +1 -0
- package/node_modules_vaadin_map_node_modules_ol_geom_flat_length_js-_95bd5.js +58 -0
- package/node_modules_vaadin_map_node_modules_ol_geom_flat_length_js-_95bd5.js.map +1 -0
- 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
- package/node_modules_vaadin_map_node_modules_ol_geom_flat_lineoffset_js-node_modules_vaadin_map_node_-304640.js.map +1 -0
- package/node_modules_vaadin_map_node_modules_ol_geom_flat_lineoffset_js-node_modules_vaadin_map_node_-7a9288.js +383 -0
- package/node_modules_vaadin_map_node_modules_ol_geom_flat_lineoffset_js-node_modules_vaadin_map_node_-7a9288.js.map +1 -0
- package/node_modules_vaadin_map_node_modules_ol_geom_flat_lineoffset_js.js +243 -0
- package/node_modules_vaadin_map_node_modules_ol_geom_flat_lineoffset_js.js.map +1 -0
- package/node_modules_vaadin_map_node_modules_ol_geom_flat_textpath_js.js +18 -5
- package/node_modules_vaadin_map_node_modules_ol_geom_flat_textpath_js.js.map +1 -1
- package/node_modules_vaadin_map_node_modules_ol_interaction_DragAndDrop_js.js +8 -8
- package/node_modules_vaadin_map_node_modules_ol_interaction_DragAndDrop_js.js.map +1 -1
- 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
- package/node_modules_vaadin_map_node_modules_ol_render_VectorContext_js.js.map +1 -0
- package/node_modules_vaadin_map_node_modules_ol_render_canvas_LineStringBuilder_js.js +17 -7
- package/node_modules_vaadin_map_node_modules_ol_render_canvas_LineStringBuilder_js.js.map +1 -1
- package/node_modules_vaadin_map_node_modules_ol_render_canvas_ZIndexContext_js-_abc10.js +18 -15
- package/node_modules_vaadin_map_node_modules_ol_render_canvas_ZIndexContext_js-_abc10.js.map +1 -1
- package/node_modules_vaadin_map_node_modules_ol_render_canvas_ZIndexContext_js-_abc11.js +18 -15
- package/node_modules_vaadin_map_node_modules_ol_render_canvas_ZIndexContext_js-_abc11.js.map +1 -1
- package/node_modules_vaadin_map_node_modules_ol_renderer_Layer_js.js +21 -1
- package/node_modules_vaadin_map_node_modules_ol_renderer_Layer_js.js.map +1 -1
- package/node_modules_vaadin_map_node_modules_ol_source_Source_js.js +34 -3
- package/node_modules_vaadin_map_node_modules_ol_source_Source_js.js.map +1 -1
- package/package.json +135 -135
- package/vaadin-bundle.json +1824 -1812
- package/vaadin.js +2725 -1726
- package/vaadin.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_Feature_js.js +30 -16
- package/vendors-node_modules_vaadin_map_node_modules_ol_Feature_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_Overlay_js.js +6 -6
- package/vendors-node_modules_vaadin_map_node_modules_ol_Overlay_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_control_FullScreen_js.js +7 -7
- package/vendors-node_modules_vaadin_map_node_modules_ol_control_FullScreen_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_control_OverviewMap_js.js +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_control_OverviewMap_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_control_ScaleLine_js.js +6 -6
- package/vendors-node_modules_vaadin_map_node_modules_ol_control_ScaleLine_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_control_ZoomSlider_js.js +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_control_ZoomSlider_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_control_js.js +34 -25
- package/vendors-node_modules_vaadin_map_node_modules_ol_control_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Draw_js.js +146 -943
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Draw_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Extent_js.js +111 -34
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Extent_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Link_js.js +3 -3
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Link_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Modify_js.js +1055 -219
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Modify_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Select_js.js +129 -57
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Select_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Snap_js.js +74 -80
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Snap_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Translate_js.js +11 -11
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Translate_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_js.js +54 -54
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_tracing_js.js +801 -0
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_tracing_js.js.map +1 -0
- package/vendors-node_modules_vaadin_map_node_modules_ol_render_Feature_js.js +36 -20
- package/vendors-node_modules_vaadin_map_node_modules_ol_render_Feature_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_BuilderGroup_js.js +17 -279
- package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_BuilderGroup_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_Builder_js.js +16 -7
- package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_Builder_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_ExecutorGroup_js.js +53 -17
- package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_ExecutorGroup_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_Executor_js.js +336 -38
- package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_Executor_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_Immediate_js.js +75 -42
- package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_Immediate_js.js.map +1 -1
- 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
- package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_PolygonBuilder_js.js.map +1 -0
- package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_TextBuilder_js.js +210 -16
- package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_TextBuilder_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_renderer_canvas_Layer_js.js +88 -32
- package/vendors-node_modules_vaadin_map_node_modules_ol_renderer_canvas_Layer_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_renderer_canvas_VectorLayer_js.js +62 -22
- package/vendors-node_modules_vaadin_map_node_modules_ol_renderer_canvas_VectorLayer_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_renderer_vector_js.js +2 -2
- package/vendors-node_modules_vaadin_map_node_modules_ol_renderer_vector_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_source_Vector_js.js +135 -81
- package/vendors-node_modules_vaadin_map_node_modules_ol_source_Vector_js.js.map +1 -1
- package/node_modules_vaadin_map_node_modules_ol_render_VectorContext_js-_279c0.js.map +0 -1
- package/node_modules_vaadin_map_node_modules_ol_render_VectorContext_js-_279c1.js +0 -144
- package/node_modules_vaadin_map_node_modules_ol_render_VectorContext_js-_279c1.js.map +0 -1
- package/node_modules_vaadin_map_node_modules_ol_render_VectorContext_js-node_modules_vaadin_map_node_-a1378d.js.map +0 -1
- package/node_modules_vaadin_map_node_modules_ol_render_canvas_PolygonBuilder_js.js.map +0 -1
- package/node_modules_vaadin_map_node_modules_ol_style_js.js +0 -48
- package/node_modules_vaadin_map_node_modules_ol_style_js.js.map +0 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_geom_js-node_modules_vaadin_map_node_modules_-f0f4bb.js +0 -769
- package/vendors-node_modules_vaadin_map_node_modules_ol_geom_js-node_modules_vaadin_map_node_modules_-f0f4bb.js.map +0 -1
|
@@ -52,6 +52,245 @@ function linearRingLength(flatCoordinates, offset, end, stride) {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
|
|
55
|
+
/***/ }),
|
|
56
|
+
|
|
57
|
+
/***/ "./node_modules/@vaadin/map/node_modules/ol/geom/flat/lineoffset.js":
|
|
58
|
+
/*!**************************************************************************!*\
|
|
59
|
+
!*** ./node_modules/@vaadin/map/node_modules/ol/geom/flat/lineoffset.js ***!
|
|
60
|
+
\**************************************************************************/
|
|
61
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
62
|
+
|
|
63
|
+
__webpack_require__.r(__webpack_exports__);
|
|
64
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
65
|
+
/* harmony export */ "offsetLineString": () => (/* binding */ offsetLineString),
|
|
66
|
+
/* harmony export */ "removeOffsetCycles": () => (/* binding */ removeOffsetCycles)
|
|
67
|
+
/* harmony export */ });
|
|
68
|
+
/* harmony import */ var _coordinate_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../coordinate.js */ "./node_modules/@vaadin/map/node_modules/ol/coordinate.js");
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Offsets a line string to the left / right along its segments direction.
|
|
73
|
+
* Offset is applied to each segment of the line in the direciton of the segment normal (positive offset goes "right" relative to the line direction).
|
|
74
|
+
* For very sharp angles between segments, the function falls back to offsetting along the segment normal direction to avoid excessively long miters.
|
|
75
|
+
*
|
|
76
|
+
* Coordinates and the offset should be in the same units — either pixels or the same spatial reference system as the input line coordinates.
|
|
77
|
+
*
|
|
78
|
+
* @param {Array<number>} flatCoordinates Flat coordinates.
|
|
79
|
+
* @param {number} start Start index.
|
|
80
|
+
* @param {number} end End index.
|
|
81
|
+
* @param {number} stride Stride.
|
|
82
|
+
* @param {number} offset Offset distance along the segment normal direction.
|
|
83
|
+
* Positive values offset to the right relative to the direction of the line.
|
|
84
|
+
* Negative values offset to the left.
|
|
85
|
+
* @param {boolean} isClosedRing If coordinates build a closed circle (in this the first and the last coordinate offsets will consider previous / next ring coordinate)
|
|
86
|
+
* @param {Array<number>} [dest] Destination coordinate array. If not provided a new one will be created
|
|
87
|
+
* @param {number} [destinationStride] Stride of destination coordinates. If unspecified, assumed to be same as the source coordinates stride.
|
|
88
|
+
* @return {Array<number>} Result flat coordinates of the offset line.
|
|
89
|
+
*/
|
|
90
|
+
function offsetLineString(
|
|
91
|
+
flatCoordinates,
|
|
92
|
+
start,
|
|
93
|
+
end,
|
|
94
|
+
stride,
|
|
95
|
+
offset,
|
|
96
|
+
isClosedRing,
|
|
97
|
+
dest,
|
|
98
|
+
destinationStride,
|
|
99
|
+
) {
|
|
100
|
+
dest = dest ?? [];
|
|
101
|
+
destinationStride = destinationStride ?? stride;
|
|
102
|
+
|
|
103
|
+
const secondPointX = flatCoordinates[start + stride];
|
|
104
|
+
const secondPointY = flatCoordinates[start + stride + 1];
|
|
105
|
+
const secondToLastPointX = flatCoordinates[end - 2 * stride];
|
|
106
|
+
const secondToLastPointY = flatCoordinates[end - 2 * stride + 1];
|
|
107
|
+
let x, y, prevX, prevY, nextX, nextY, offsetX, offsetY;
|
|
108
|
+
|
|
109
|
+
let i = 0;
|
|
110
|
+
for (let j = start; j < end; j += stride) {
|
|
111
|
+
// 1. Detect previous and next coordinates of a current vertex
|
|
112
|
+
prevX = x;
|
|
113
|
+
prevY = y;
|
|
114
|
+
nextX = undefined;
|
|
115
|
+
nextY = undefined;
|
|
116
|
+
if (j + stride < end) {
|
|
117
|
+
nextX = flatCoordinates[j + stride];
|
|
118
|
+
nextY = flatCoordinates[j + stride + 1];
|
|
119
|
+
}
|
|
120
|
+
// First coordinate of a closed ring -> previous coordinate is the second to last one
|
|
121
|
+
if (isClosedRing && j === start) {
|
|
122
|
+
prevX = secondToLastPointX;
|
|
123
|
+
prevY = secondToLastPointY;
|
|
124
|
+
}
|
|
125
|
+
// Last coordinate of a closed ring -> next coordinate is the second vertex of a line string (the last one is same as the first one for a closed ring)
|
|
126
|
+
if (isClosedRing && j === end - stride) {
|
|
127
|
+
nextX = secondPointX;
|
|
128
|
+
nextY = secondPointY;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// 2. Current vertex to offset
|
|
132
|
+
x = flatCoordinates[j];
|
|
133
|
+
y = flatCoordinates[j + 1];
|
|
134
|
+
|
|
135
|
+
// 3. Offset the vertex
|
|
136
|
+
[offsetX, offsetY] = offsetLineVertex(
|
|
137
|
+
x,
|
|
138
|
+
y,
|
|
139
|
+
prevX,
|
|
140
|
+
prevY,
|
|
141
|
+
nextX,
|
|
142
|
+
nextY,
|
|
143
|
+
offset,
|
|
144
|
+
);
|
|
145
|
+
dest[i++] = offsetX;
|
|
146
|
+
dest[i++] = offsetY;
|
|
147
|
+
|
|
148
|
+
// 4. Copy over other dimension values if any
|
|
149
|
+
for (let k = 2; k < destinationStride; k++) {
|
|
150
|
+
dest[i++] = flatCoordinates[j + k];
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (dest.length != i) {
|
|
155
|
+
dest.length = i;
|
|
156
|
+
}
|
|
157
|
+
return dest;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Computes the offset of a single vertex of a line string.
|
|
162
|
+
*
|
|
163
|
+
* The function calculates a new vertex coordinate offset along the normal/miter direction of the line at this vertex.
|
|
164
|
+
* Offset is applied along the segment normal (positive offset goes "right" relative to the line direction).
|
|
165
|
+
* It handles first and last vertices (caps) as well as joins between two segments (mitering).
|
|
166
|
+
* For very sharp angles, the function falls back to offsetting along the segment normal direction to avoid excessively long miters.
|
|
167
|
+
*
|
|
168
|
+
* Coordinates and the offset should be in the same units — either pixels or the same spatial reference system as the input line coordinates.
|
|
169
|
+
*
|
|
170
|
+
* @param {number} x Vertex x-coordinate.
|
|
171
|
+
* @param {number} y Vertex y-coordinate.
|
|
172
|
+
* @param {number|undefined} prevX Previous vertex x-coordinate.
|
|
173
|
+
* Pass undefined if computing the offset for the first vertex (no previous vertex).
|
|
174
|
+
* @param {number|undefined} prevY Previous vertex y-coordinate.
|
|
175
|
+
* Pass undefined if computing the offset for the first vertex (no previous vertex).
|
|
176
|
+
* @param {number|undefined} nextX Next vertex x-coordinate.
|
|
177
|
+
* Pass undefined if computing the offset for the last vertex (no next vertex).
|
|
178
|
+
* @param {number|undefined} nextY Next vertex y-coordinate.
|
|
179
|
+
* Pass undefined if computing the offset for the last vertex (no next vertex).
|
|
180
|
+
* @param {number} offset Offset distance along the segment normal direction.
|
|
181
|
+
* Positive values offset to the right relative to the direction from previous to next vertex.
|
|
182
|
+
* Negative values offset to the left.
|
|
183
|
+
* @return {import("../../coordinate.js").Coordinate} Offset vertex coordinate as `[x, y]`.
|
|
184
|
+
*/
|
|
185
|
+
function offsetLineVertex(x, y, prevX, prevY, nextX, nextY, offset) {
|
|
186
|
+
// Compute segment direction
|
|
187
|
+
let nx, ny;
|
|
188
|
+
if (prevX !== undefined && prevY !== undefined) {
|
|
189
|
+
nx = x - prevX;
|
|
190
|
+
ny = y - prevY;
|
|
191
|
+
} else if (nextX !== undefined && nextY !== undefined) {
|
|
192
|
+
nx = nextX - x;
|
|
193
|
+
ny = nextY - y;
|
|
194
|
+
} else {
|
|
195
|
+
// no next, no previous point given -> just assume some default (horizontal) direction
|
|
196
|
+
nx = 1;
|
|
197
|
+
ny = 0;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// Normalize -> tangent
|
|
201
|
+
const len = Math.hypot(nx, ny);
|
|
202
|
+
const tx = nx / len;
|
|
203
|
+
const ty = ny / len;
|
|
204
|
+
|
|
205
|
+
// Rotate tangent 90° -> normal
|
|
206
|
+
nx = -ty;
|
|
207
|
+
ny = tx;
|
|
208
|
+
|
|
209
|
+
// First / last vertex -> offset the point in the direction of the normal vector
|
|
210
|
+
if (prevX === undefined || prevY === undefined) {
|
|
211
|
+
return [x + nx * offset, y + ny * offset];
|
|
212
|
+
}
|
|
213
|
+
if (nextX === undefined || nextY === undefined) {
|
|
214
|
+
return [x + nx * offset, y + ny * offset];
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// Compute join angle - angle between 2 segments of the vertex.
|
|
218
|
+
const joinAngle = (0,_coordinate_js__WEBPACK_IMPORTED_MODULE_0__.angleBetween)([x, y], [prevX, prevY], [nextX, nextY]);
|
|
219
|
+
|
|
220
|
+
// Avoid huge or infinite miter joins for very sharp angles, offset in the segment direction in this case.
|
|
221
|
+
if (Math.cos(joinAngle) > 0.998) {
|
|
222
|
+
return [x + tx * offset, y + ty * offset];
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// Compute join offset direction.
|
|
226
|
+
// We rotate the normal vector by half of the join angle.
|
|
227
|
+
// This gives the direction of the miter at the vertex.
|
|
228
|
+
const cos = Math.cos(joinAngle / 2);
|
|
229
|
+
const sin = Math.sin(joinAngle / 2);
|
|
230
|
+
|
|
231
|
+
// Rotate the normal vector (nx, ny) by half of the join angle.
|
|
232
|
+
// bx/by = bisector direction before normalization
|
|
233
|
+
const bx = sin * nx + cos * ny;
|
|
234
|
+
const by = -cos * nx + sin * ny;
|
|
235
|
+
|
|
236
|
+
// Scale the bisector so that moving along it preserves the correct offset distance.
|
|
237
|
+
// Dividing by sin(half of angle) converts the bisector into the true miter vector.
|
|
238
|
+
// (This expands the miter for sharp angles and shortens it for wide ones.)
|
|
239
|
+
const dx = bx * (1 / sin);
|
|
240
|
+
const dy = by * (1 / sin);
|
|
241
|
+
|
|
242
|
+
// Offset final vertex along miter direction
|
|
243
|
+
return [x + dx * offset, y + dy * offset];
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Removes self-intersection loops (cycles) from an offset line.
|
|
248
|
+
* When a polyline is offset, sharp turns can create self-intersecting loops.
|
|
249
|
+
* This function detects those crossings and splices out the looped portions,
|
|
250
|
+
* replacing them with the intersection point.
|
|
251
|
+
*
|
|
252
|
+
* @param {Array<number>} coords Flat offset coordinates (modified in-place).
|
|
253
|
+
* @param {number} stride Coordinate stride (typically 2).
|
|
254
|
+
* @param {boolean} [closedLine] Whether the original line is closed (first vertex === last vertex).
|
|
255
|
+
* When true, the first and last offset segments are not compared against each other to avoid
|
|
256
|
+
* false loop detection at the closure point.
|
|
257
|
+
* @return {Array<number>} The cleaned coordinate array.
|
|
258
|
+
*/
|
|
259
|
+
function removeOffsetCycles(coords, stride, closedLine = false) {
|
|
260
|
+
for (let i = 0, ii = coords.length - 2; i < ii; i += stride) {
|
|
261
|
+
const jMax =
|
|
262
|
+
closedLine && i === 0
|
|
263
|
+
? coords.length - 3 * stride
|
|
264
|
+
: coords.length - 2 * stride;
|
|
265
|
+
for (let j = jMax; j > i + stride; j -= stride) {
|
|
266
|
+
const p1x = coords[i];
|
|
267
|
+
const p1y = coords[i + 1];
|
|
268
|
+
const p2x = coords[i + stride];
|
|
269
|
+
const p2y = coords[i + stride + 1];
|
|
270
|
+
const p3x = coords[j];
|
|
271
|
+
const p3y = coords[j + 1];
|
|
272
|
+
const p4x = coords[j + stride];
|
|
273
|
+
const p4y = coords[j + stride + 1];
|
|
274
|
+
const d = (p4y - p3y) * (p2x - p1x) - (p4x - p3x) * (p2y - p1y);
|
|
275
|
+
if (d === 0) {
|
|
276
|
+
continue;
|
|
277
|
+
}
|
|
278
|
+
const t = ((p4x - p3x) * (p1y - p3y) - (p4y - p3y) * (p1x - p3x)) / d;
|
|
279
|
+
const u = ((p2x - p1x) * (p1y - p3y) - (p2y - p1y) * (p1x - p3x)) / d;
|
|
280
|
+
if (t > 0 && t < 1 && u > 0 && u < 1) {
|
|
281
|
+
const ix = p1x + t * (p2x - p1x);
|
|
282
|
+
const iy = p1y + t * (p2y - p1y);
|
|
283
|
+
coords[i + stride] = ix;
|
|
284
|
+
coords[i + stride + 1] = iy;
|
|
285
|
+
coords.splice(i + 2 * stride, j - i - stride);
|
|
286
|
+
break;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
return coords;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
|
|
55
294
|
/***/ }),
|
|
56
295
|
|
|
57
296
|
/***/ "./node_modules/@vaadin/map/node_modules/ol/geom/flat/textpath.js":
|
|
@@ -72,6 +311,17 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
72
311
|
|
|
73
312
|
|
|
74
313
|
|
|
314
|
+
let segmenter;
|
|
315
|
+
/**
|
|
316
|
+
* @return {Intl.Segmenter} A grapheme segmenter.
|
|
317
|
+
*/
|
|
318
|
+
function getSegmenter() {
|
|
319
|
+
if (!segmenter) {
|
|
320
|
+
segmenter = new Intl.Segmenter(undefined, {granularity: 'grapheme'});
|
|
321
|
+
}
|
|
322
|
+
return segmenter;
|
|
323
|
+
}
|
|
324
|
+
|
|
75
325
|
/**
|
|
76
326
|
* @param {Array<number>} flatCoordinates Path to put text on.
|
|
77
327
|
* @param {number} offset Start offset of the `flatCoordinates`.
|
|
@@ -179,7 +429,8 @@ function drawTextOnPath(
|
|
|
179
429
|
// rendering across line segments
|
|
180
430
|
text = text.replace(/\n/g, ' '); // ensure rendering in single-line as all calculations below don't handle multi-lines
|
|
181
431
|
|
|
182
|
-
|
|
432
|
+
const segments = Array.from(getSegmenter().segment(text), (s) => s.segment);
|
|
433
|
+
for (let i = 0, ii = segments.length; i < ii;) {
|
|
183
434
|
advance();
|
|
184
435
|
let angle = Math.atan2(y2 - y1, x2 - x1);
|
|
185
436
|
if (reverse) {
|
|
@@ -198,7 +449,8 @@ function drawTextOnPath(
|
|
|
198
449
|
let charLength = 0;
|
|
199
450
|
for (; i < ii; ++i) {
|
|
200
451
|
const index = reverse ? ii - i - 1 : i;
|
|
201
|
-
const len =
|
|
452
|
+
const len =
|
|
453
|
+
scale * measureAndCacheTextWidth(font, segments[index], cache);
|
|
202
454
|
if (
|
|
203
455
|
offset + stride < end &&
|
|
204
456
|
segmentM + segmentLength < startM + charLength + len / 2
|
|
@@ -210,9 +462,9 @@ function drawTextOnPath(
|
|
|
210
462
|
if (i === iStart) {
|
|
211
463
|
continue;
|
|
212
464
|
}
|
|
213
|
-
const chars =
|
|
214
|
-
?
|
|
215
|
-
|
|
465
|
+
const chars = (
|
|
466
|
+
reverse ? segments.slice(ii - i, ii - iStart) : segments.slice(iStart, i)
|
|
467
|
+
).join('');
|
|
216
468
|
interpolate =
|
|
217
469
|
segmentLength === 0
|
|
218
470
|
? 0
|
|
@@ -241,11 +493,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
241
493
|
/* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../array.js */ "./node_modules/@vaadin/map/node_modules/ol/array.js");
|
|
242
494
|
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../extent.js */ "./node_modules/@vaadin/map/node_modules/ol/extent.js");
|
|
243
495
|
/* harmony import */ var _geom_flat_length_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../geom/flat/length.js */ "./node_modules/@vaadin/map/node_modules/ol/geom/flat/length.js");
|
|
496
|
+
/* harmony import */ var _geom_flat_lineoffset_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../geom/flat/lineoffset.js */ "./node_modules/@vaadin/map/node_modules/ol/geom/flat/lineoffset.js");
|
|
244
497
|
/* harmony import */ var _geom_flat_textpath_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../geom/flat/textpath.js */ "./node_modules/@vaadin/map/node_modules/ol/geom/flat/textpath.js");
|
|
245
498
|
/* harmony import */ var _geom_flat_transform_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../geom/flat/transform.js */ "./node_modules/@vaadin/map/node_modules/ol/geom/flat/transform.js");
|
|
246
499
|
/* harmony import */ var _transform_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../transform.js */ "./node_modules/@vaadin/map/node_modules/ol/transform.js");
|
|
247
|
-
/* harmony import */ var _canvas_ZIndexContext_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../canvas/ZIndexContext.js */ "./node_modules/@vaadin/map/node_modules/ol/render/canvas/ZIndexContext.js");
|
|
248
500
|
/* harmony import */ var _canvas_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../canvas.js */ "./node_modules/@vaadin/map/node_modules/ol/render/canvas.js");
|
|
501
|
+
/* harmony import */ var _canvas_ZIndexContext_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../canvas/ZIndexContext.js */ "./node_modules/@vaadin/map/node_modules/ol/render/canvas/ZIndexContext.js");
|
|
249
502
|
/* harmony import */ var _Instruction_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./Instruction.js */ "./node_modules/@vaadin/map/node_modules/ol/render/canvas/Instruction.js");
|
|
250
503
|
/* harmony import */ var _TextBuilder_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TextBuilder.js */ "./node_modules/@vaadin/map/node_modules/ol/render/canvas/TextBuilder.js");
|
|
251
504
|
/**
|
|
@@ -262,6 +515,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
262
515
|
|
|
263
516
|
|
|
264
517
|
|
|
518
|
+
|
|
265
519
|
/**
|
|
266
520
|
* @typedef {import('../../structs/RBush.js').Entry<import('../../Feature.js').FeatureLike>} DeclutterEntry
|
|
267
521
|
*/
|
|
@@ -280,7 +534,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
280
534
|
*/
|
|
281
535
|
|
|
282
536
|
/**
|
|
283
|
-
* @typedef {{0: CanvasRenderingContext2D, 1: import('../../size.js').Size, 2: import("../canvas.js").Label|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement, 3: ImageOrLabelDimensions, 4: number, 5: Array<*>, 6: Array<*>}} ReplayImageOrLabelArgs
|
|
537
|
+
* @typedef {{0: CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D, 1: import('../../size.js').Size, 2: import("../canvas.js").Label|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement, 3: ImageOrLabelDimensions, 4: number, 5: Array<*>, 6: Array<*>}} ReplayImageOrLabelArgs
|
|
284
538
|
*/
|
|
285
539
|
|
|
286
540
|
/**
|
|
@@ -821,7 +1075,7 @@ class Executor {
|
|
|
821
1075
|
|
|
822
1076
|
/**
|
|
823
1077
|
* @private
|
|
824
|
-
* @param {CanvasRenderingContext2D} context Context.
|
|
1078
|
+
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} context Context.
|
|
825
1079
|
*/
|
|
826
1080
|
fill_(context) {
|
|
827
1081
|
const alignAndScale = this.alignAndScaleFill_;
|
|
@@ -833,7 +1087,6 @@ class Executor {
|
|
|
833
1087
|
if (alignAndScale !== 1) {
|
|
834
1088
|
context.scale(alignAndScale, alignAndScale);
|
|
835
1089
|
}
|
|
836
|
-
context.rotate(this.viewRotation_);
|
|
837
1090
|
}
|
|
838
1091
|
context.fill();
|
|
839
1092
|
if (alignAndScale) {
|
|
@@ -843,7 +1096,7 @@ class Executor {
|
|
|
843
1096
|
|
|
844
1097
|
/**
|
|
845
1098
|
* @private
|
|
846
|
-
* @param {CanvasRenderingContext2D} context Context.
|
|
1099
|
+
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} context Context.
|
|
847
1100
|
* @param {Array<*>} instruction Instruction.
|
|
848
1101
|
*/
|
|
849
1102
|
setStrokeStyle_(context, instruction) {
|
|
@@ -899,7 +1152,7 @@ class Executor {
|
|
|
899
1152
|
|
|
900
1153
|
/**
|
|
901
1154
|
* @private
|
|
902
|
-
* @param {CanvasRenderingContext2D} context Context.
|
|
1155
|
+
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} context Context.
|
|
903
1156
|
* @param {import('../../size.js').Size} scaledCanvasSize Scaled canvas size
|
|
904
1157
|
* @param {import("../../transform.js").Transform} transform Transform.
|
|
905
1158
|
* @param {Array<*>} instructions Instructions array.
|
|
@@ -944,8 +1197,10 @@ class Executor {
|
|
|
944
1197
|
const ii = instructions.length; // end of instructions
|
|
945
1198
|
let d = 0; // data index
|
|
946
1199
|
let dd; // end of per-instruction data
|
|
1200
|
+
const offsetCoords = [];
|
|
947
1201
|
let anchorX,
|
|
948
1202
|
anchorY,
|
|
1203
|
+
lineOffsetPx,
|
|
949
1204
|
/** @type {import('../../style/Style.js').DeclutterMode} */
|
|
950
1205
|
declutterMode,
|
|
951
1206
|
prevX,
|
|
@@ -1020,10 +1275,11 @@ class Executor {
|
|
|
1020
1275
|
break;
|
|
1021
1276
|
case _Instruction_js__WEBPACK_IMPORTED_MODULE_7__["default"].CIRCLE:
|
|
1022
1277
|
d = /** @type {number} */ (instruction[1]);
|
|
1278
|
+
lineOffsetPx = /** @type {number} */ instruction[2] ?? 0;
|
|
1023
1279
|
const x1 = pixelCoordinates[d];
|
|
1024
1280
|
const y1 = pixelCoordinates[d + 1];
|
|
1025
|
-
const x2 = pixelCoordinates[d + 2];
|
|
1026
|
-
const y2 = pixelCoordinates[d + 3];
|
|
1281
|
+
const x2 = pixelCoordinates[d + 2] - lineOffsetPx;
|
|
1282
|
+
const y2 = pixelCoordinates[d + 3] - lineOffsetPx;
|
|
1027
1283
|
const dx = x2 - x1;
|
|
1028
1284
|
const dy = y2 - y1;
|
|
1029
1285
|
const r = Math.sqrt(dx * dx + dy * dy);
|
|
@@ -1260,6 +1516,7 @@ class Executor {
|
|
|
1260
1516
|
declutterMode = instruction[14] || 'declutter';
|
|
1261
1517
|
|
|
1262
1518
|
const textKeepUpright = /** @type {boolean} */ (instruction[15]);
|
|
1519
|
+
const offsetX = /** @type {number} */ (instruction[16]);
|
|
1263
1520
|
const textState = this.textStates[textKey];
|
|
1264
1521
|
const font = textState.font;
|
|
1265
1522
|
const textScale = [
|
|
@@ -1309,7 +1566,8 @@ class Executor {
|
|
|
1309
1566
|
label = this.createLabel(chars, textKey, '', strokeKey);
|
|
1310
1567
|
anchorX =
|
|
1311
1568
|
/** @type {number} */ (part[2]) +
|
|
1312
|
-
(textScale[0] < 0 ? -strokeWidth : strokeWidth)
|
|
1569
|
+
(textScale[0] < 0 ? -strokeWidth : strokeWidth) -
|
|
1570
|
+
offsetX;
|
|
1313
1571
|
anchorY =
|
|
1314
1572
|
baseline * label.height +
|
|
1315
1573
|
((0.5 - baseline) * 2 * strokeWidth * textScale[1]) /
|
|
@@ -1356,7 +1614,7 @@ class Executor {
|
|
|
1356
1614
|
part = parts[c]; // x, y, anchorX, rotation, chunk
|
|
1357
1615
|
chars = /** @type {string} */ (part[4]);
|
|
1358
1616
|
label = this.createLabel(chars, textKey, fillKey, '');
|
|
1359
|
-
anchorX = /** @type {number} */ (part[2]);
|
|
1617
|
+
anchorX = /** @type {number} */ (part[2]) - offsetX;
|
|
1360
1618
|
anchorY = baseline * label.height - offsetY;
|
|
1361
1619
|
const dimensions = this.calculateImageOrLabelDimensions_(
|
|
1362
1620
|
label.width,
|
|
@@ -1431,17 +1689,47 @@ class Executor {
|
|
|
1431
1689
|
case _Instruction_js__WEBPACK_IMPORTED_MODULE_7__["default"].MOVE_TO_LINE_TO:
|
|
1432
1690
|
d = /** @type {number} */ (instruction[1]);
|
|
1433
1691
|
dd = /** @type {number} */ (instruction[2]);
|
|
1434
|
-
|
|
1435
|
-
|
|
1692
|
+
lineOffsetPx = /** @type {number|undefined} */ (instruction[3]);
|
|
1693
|
+
|
|
1694
|
+
let lineCoords, lineStart, lineEnd;
|
|
1695
|
+
if (lineOffsetPx) {
|
|
1696
|
+
const isClosedRing =
|
|
1697
|
+
/** @type {boolean|undefined} */ (instruction[4]) ?? false;
|
|
1698
|
+
const isClosedLine =
|
|
1699
|
+
isClosedRing ||
|
|
1700
|
+
(Math.abs(pixelCoordinates[d] - pixelCoordinates[dd - 2]) <
|
|
1701
|
+
1e-6 &&
|
|
1702
|
+
Math.abs(pixelCoordinates[d + 1] - pixelCoordinates[dd - 1]) <
|
|
1703
|
+
1e-6);
|
|
1704
|
+
(0,_geom_flat_lineoffset_js__WEBPACK_IMPORTED_MODULE_10__.offsetLineString)(
|
|
1705
|
+
pixelCoordinates,
|
|
1706
|
+
d,
|
|
1707
|
+
dd,
|
|
1708
|
+
2,
|
|
1709
|
+
lineOffsetPx,
|
|
1710
|
+
isClosedLine,
|
|
1711
|
+
offsetCoords,
|
|
1712
|
+
);
|
|
1713
|
+
(0,_geom_flat_lineoffset_js__WEBPACK_IMPORTED_MODULE_10__.removeOffsetCycles)(offsetCoords, 2, isClosedLine);
|
|
1714
|
+
lineCoords = offsetCoords;
|
|
1715
|
+
lineStart = 0;
|
|
1716
|
+
lineEnd = lineCoords.length;
|
|
1717
|
+
} else {
|
|
1718
|
+
lineCoords = pixelCoordinates;
|
|
1719
|
+
lineStart = d;
|
|
1720
|
+
lineEnd = dd;
|
|
1721
|
+
}
|
|
1722
|
+
x = lineCoords[lineStart];
|
|
1723
|
+
y = lineCoords[lineStart + 1];
|
|
1436
1724
|
context.moveTo(x, y);
|
|
1437
1725
|
prevX = (x + 0.5) | 0;
|
|
1438
1726
|
prevY = (y + 0.5) | 0;
|
|
1439
|
-
for (
|
|
1440
|
-
x =
|
|
1441
|
-
y =
|
|
1727
|
+
for (let k = lineStart + 2; k < lineEnd; k += 2) {
|
|
1728
|
+
x = lineCoords[k];
|
|
1729
|
+
y = lineCoords[k + 1];
|
|
1442
1730
|
roundX = (x + 0.5) | 0;
|
|
1443
1731
|
roundY = (y + 0.5) | 0;
|
|
1444
|
-
if (
|
|
1732
|
+
if (k == lineEnd - 2 || roundX !== prevX || roundY !== prevY) {
|
|
1445
1733
|
context.lineTo(x, y);
|
|
1446
1734
|
prevX = roundX;
|
|
1447
1735
|
prevY = roundY;
|
|
@@ -1459,6 +1747,9 @@ class Executor {
|
|
|
1459
1747
|
context.stroke();
|
|
1460
1748
|
pendingStroke = 0;
|
|
1461
1749
|
}
|
|
1750
|
+
} else if (pendingStroke && instruction[1]) {
|
|
1751
|
+
context.stroke();
|
|
1752
|
+
pendingStroke = 0;
|
|
1462
1753
|
}
|
|
1463
1754
|
|
|
1464
1755
|
/** @type {import("../../colorlike.js").ColorLike} */
|
|
@@ -1466,6 +1757,10 @@ class Executor {
|
|
|
1466
1757
|
++i;
|
|
1467
1758
|
break;
|
|
1468
1759
|
case _Instruction_js__WEBPACK_IMPORTED_MODULE_7__["default"].SET_STROKE_STYLE:
|
|
1760
|
+
if (pendingFill && instruction[1]) {
|
|
1761
|
+
this.fill_(context);
|
|
1762
|
+
pendingFill = 0;
|
|
1763
|
+
}
|
|
1469
1764
|
if (pendingStroke) {
|
|
1470
1765
|
context.stroke();
|
|
1471
1766
|
pendingStroke = 0;
|
|
@@ -1496,7 +1791,7 @@ class Executor {
|
|
|
1496
1791
|
}
|
|
1497
1792
|
|
|
1498
1793
|
/**
|
|
1499
|
-
* @param {CanvasRenderingContext2D} context Context.
|
|
1794
|
+
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} context Context.
|
|
1500
1795
|
* @param {import('../../size.js').Size} scaledCanvasSize Scaled canvas size.
|
|
1501
1796
|
* @param {import("../../transform.js").Transform} transform Transform.
|
|
1502
1797
|
* @param {number} viewRotation View rotation.
|
|
@@ -1525,7 +1820,7 @@ class Executor {
|
|
|
1525
1820
|
}
|
|
1526
1821
|
|
|
1527
1822
|
/**
|
|
1528
|
-
* @param {CanvasRenderingContext2D} context Context.
|
|
1823
|
+
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} context Context.
|
|
1529
1824
|
* @param {import("../../transform.js").Transform} transform Transform.
|
|
1530
1825
|
* @param {number} viewRotation View rotation.
|
|
1531
1826
|
* @param {FeatureCallback<T>} [featureCallback] Feature callback.
|
|
@@ -1576,7 +1871,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1576
1871
|
|
|
1577
1872
|
|
|
1578
1873
|
|
|
1579
|
-
/** @typedef {CanvasRenderingContext2D & {globalAlpha: any}} ZIndexContextProxy */
|
|
1874
|
+
/** @typedef {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D & {globalAlpha: any}} ZIndexContextProxy */
|
|
1580
1875
|
|
|
1581
1876
|
/**
|
|
1582
1877
|
* @extends {CanvasRenderingContext2D}
|
|
@@ -1598,6 +1893,14 @@ class ZIndexContext {
|
|
|
1598
1893
|
*/
|
|
1599
1894
|
this.offset_ = 0;
|
|
1600
1895
|
|
|
1896
|
+
/**
|
|
1897
|
+
* Name of the method last accessed on the proxy, pushed together with its
|
|
1898
|
+
* arguments when the method is actually called.
|
|
1899
|
+
* @private
|
|
1900
|
+
* @type {string|symbol}
|
|
1901
|
+
*/
|
|
1902
|
+
this.pendingMethod_;
|
|
1903
|
+
|
|
1601
1904
|
/**
|
|
1602
1905
|
* @private
|
|
1603
1906
|
* @type {ZIndexContextProxy}
|
|
@@ -1605,14 +1908,11 @@ class ZIndexContext {
|
|
|
1605
1908
|
this.context_ = /** @type {ZIndexContextProxy} */ (
|
|
1606
1909
|
new Proxy((0,_dom_js__WEBPACK_IMPORTED_MODULE_0__.getSharedCanvasContext2D)(), {
|
|
1607
1910
|
get: (target, property) => {
|
|
1608
|
-
if (
|
|
1609
|
-
typeof (/** @type {*} */ ((0,_dom_js__WEBPACK_IMPORTED_MODULE_0__.getSharedCanvasContext2D)())[property]) !==
|
|
1610
|
-
'function'
|
|
1611
|
-
) {
|
|
1911
|
+
if (typeof (/** @type {*} */ (target)[property]) !== 'function') {
|
|
1612
1912
|
// we only accept calling functions on the proxy, not accessing properties
|
|
1613
1913
|
return undefined;
|
|
1614
1914
|
}
|
|
1615
|
-
this.
|
|
1915
|
+
this.pendingMethod_ = property;
|
|
1616
1916
|
return this.pushMethodArgs_;
|
|
1617
1917
|
},
|
|
1618
1918
|
set: (target, property, value) => {
|
|
@@ -1637,13 +1937,13 @@ class ZIndexContext {
|
|
|
1637
1937
|
}
|
|
1638
1938
|
|
|
1639
1939
|
/**
|
|
1640
|
-
*
|
|
1940
|
+
* Pushes the method name captured at access time together with the arguments
|
|
1941
|
+
* passed at call time. Reused across all proxied method calls.
|
|
1641
1942
|
* @param {...*} args Args.
|
|
1642
|
-
* @
|
|
1943
|
+
* @private
|
|
1643
1944
|
*/
|
|
1644
1945
|
pushMethodArgs_ = (...args) => {
|
|
1645
|
-
this.push_(args);
|
|
1646
|
-
return this;
|
|
1946
|
+
this.push_(this.pendingMethod_, args);
|
|
1647
1947
|
};
|
|
1648
1948
|
|
|
1649
1949
|
/**
|
|
@@ -1666,7 +1966,7 @@ class ZIndexContext {
|
|
|
1666
1966
|
}
|
|
1667
1967
|
|
|
1668
1968
|
/**
|
|
1669
|
-
* @param {CanvasRenderingContext2D} context Context.
|
|
1969
|
+
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} context Context.
|
|
1670
1970
|
*/
|
|
1671
1971
|
draw(context) {
|
|
1672
1972
|
this.instructions_.forEach((instructionsAtIndex) => {
|
|
@@ -1679,11 +1979,9 @@ class ZIndexContext {
|
|
|
1679
1979
|
const instructionAtIndex = instructionsAtIndex[++i];
|
|
1680
1980
|
if (typeof (/** @type {*} */ (context)[property]) === 'function') {
|
|
1681
1981
|
/** @type {*} */ (context)[property](...instructionAtIndex);
|
|
1982
|
+
} else if (typeof instructionAtIndex === 'function') {
|
|
1983
|
+
/** @type {*} */ (context)[property] = instructionAtIndex(context);
|
|
1682
1984
|
} else {
|
|
1683
|
-
if (typeof instructionAtIndex === 'function') {
|
|
1684
|
-
/** @type {*} */ (context)[property] = instructionAtIndex(context);
|
|
1685
|
-
continue;
|
|
1686
|
-
}
|
|
1687
1985
|
/** @type {*} */ (context)[property] = instructionAtIndex;
|
|
1688
1986
|
}
|
|
1689
1987
|
}
|