@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node_modules_vaadin_map_node_modules_ol_geom_flat_lineoffset_js.js","mappings":";;;;;;;;;;;;;;AAAiD;;AAEjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,eAAe;AAC1B,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB;AACA;AACA,WAAW,SAAS;AACpB,WAAW,eAAe;AAC1B,WAAW,QAAQ;AACnB,YAAY,eAAe;AAC3B;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,sBAAsB,SAAS;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,oBAAoB,uBAAuB;AAC3C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,kBAAkB;AAC7B;AACA,WAAW,kBAAkB;AAC7B;AACA,WAAW,kBAAkB;AAC7B;AACA,WAAW,kBAAkB;AAC7B;AACA,WAAW,QAAQ;AACnB;AACA;AACA,YAAY,0CAA0C;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,oBAAoB,4DAAY;;AAEhC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,eAAe;AAC1B,WAAW,QAAQ;AACnB,WAAW,SAAS;AACpB;AACA;AACA,YAAY,eAAe;AAC3B;AACO;AACP,0CAA0C,QAAQ;AAClD;AACA;AACA;AACA;AACA,uBAAuB,gBAAgB;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","sources":["webpack://@vaadin/bundles/./node_modules/@vaadin/map/node_modules/ol/geom/flat/lineoffset.js"],"sourcesContent":["import {angleBetween} from '../../coordinate.js';\n\n/**\n * Offsets a line string to the left / right along its segments direction.\n * 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).\n * For very sharp angles between segments, the function falls back to offsetting along the segment normal direction to avoid excessively long miters.\n *\n * Coordinates and the offset should be in the same units — either pixels or the same spatial reference system as the input line coordinates.\n *\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} start Start index.\n * @param {number} end End index.\n * @param {number} stride Stride.\n * @param {number} offset Offset distance along the segment normal direction.\n * Positive values offset to the right relative to the direction of the line.\n * Negative values offset to the left.\n * @param {boolean} isClosedRing If coordinates build a closed circle (in this the first and the last coordinate offsets will consider previous / next ring coordinate)\n * @param {Array<number>} [dest] Destination coordinate array. If not provided a new one will be created\n * @param {number} [destinationStride] Stride of destination coordinates. If unspecified, assumed to be same as the source coordinates stride.\n * @return {Array<number>} Result flat coordinates of the offset line.\n */\nexport function offsetLineString(\n flatCoordinates,\n start,\n end,\n stride,\n offset,\n isClosedRing,\n dest,\n destinationStride,\n) {\n dest = dest ?? [];\n destinationStride = destinationStride ?? stride;\n\n const secondPointX = flatCoordinates[start + stride];\n const secondPointY = flatCoordinates[start + stride + 1];\n const secondToLastPointX = flatCoordinates[end - 2 * stride];\n const secondToLastPointY = flatCoordinates[end - 2 * stride + 1];\n let x, y, prevX, prevY, nextX, nextY, offsetX, offsetY;\n\n let i = 0;\n for (let j = start; j < end; j += stride) {\n // 1. Detect previous and next coordinates of a current vertex\n prevX = x;\n prevY = y;\n nextX = undefined;\n nextY = undefined;\n if (j + stride < end) {\n nextX = flatCoordinates[j + stride];\n nextY = flatCoordinates[j + stride + 1];\n }\n // First coordinate of a closed ring -> previous coordinate is the second to last one\n if (isClosedRing && j === start) {\n prevX = secondToLastPointX;\n prevY = secondToLastPointY;\n }\n // 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)\n if (isClosedRing && j === end - stride) {\n nextX = secondPointX;\n nextY = secondPointY;\n }\n\n // 2. Current vertex to offset\n x = flatCoordinates[j];\n y = flatCoordinates[j + 1];\n\n // 3. Offset the vertex\n [offsetX, offsetY] = offsetLineVertex(\n x,\n y,\n prevX,\n prevY,\n nextX,\n nextY,\n offset,\n );\n dest[i++] = offsetX;\n dest[i++] = offsetY;\n\n // 4. Copy over other dimension values if any\n for (let k = 2; k < destinationStride; k++) {\n dest[i++] = flatCoordinates[j + k];\n }\n }\n\n if (dest.length != i) {\n dest.length = i;\n }\n return dest;\n}\n\n/**\n * Computes the offset of a single vertex of a line string.\n *\n * The function calculates a new vertex coordinate offset along the normal/miter direction of the line at this vertex.\n * Offset is applied along the segment normal (positive offset goes \"right\" relative to the line direction).\n * It handles first and last vertices (caps) as well as joins between two segments (mitering).\n * For very sharp angles, the function falls back to offsetting along the segment normal direction to avoid excessively long miters.\n *\n * Coordinates and the offset should be in the same units — either pixels or the same spatial reference system as the input line coordinates.\n *\n * @param {number} x Vertex x-coordinate.\n * @param {number} y Vertex y-coordinate.\n * @param {number|undefined} prevX Previous vertex x-coordinate.\n * Pass undefined if computing the offset for the first vertex (no previous vertex).\n * @param {number|undefined} prevY Previous vertex y-coordinate.\n * Pass undefined if computing the offset for the first vertex (no previous vertex).\n * @param {number|undefined} nextX Next vertex x-coordinate.\n * Pass undefined if computing the offset for the last vertex (no next vertex).\n * @param {number|undefined} nextY Next vertex y-coordinate.\n * Pass undefined if computing the offset for the last vertex (no next vertex).\n * @param {number} offset Offset distance along the segment normal direction.\n * Positive values offset to the right relative to the direction from previous to next vertex.\n * Negative values offset to the left.\n * @return {import(\"../../coordinate.js\").Coordinate} Offset vertex coordinate as `[x, y]`.\n */\nfunction offsetLineVertex(x, y, prevX, prevY, nextX, nextY, offset) {\n // Compute segment direction\n let nx, ny;\n if (prevX !== undefined && prevY !== undefined) {\n nx = x - prevX;\n ny = y - prevY;\n } else if (nextX !== undefined && nextY !== undefined) {\n nx = nextX - x;\n ny = nextY - y;\n } else {\n // no next, no previous point given -> just assume some default (horizontal) direction\n nx = 1;\n ny = 0;\n }\n\n // Normalize -> tangent\n const len = Math.hypot(nx, ny);\n const tx = nx / len;\n const ty = ny / len;\n\n // Rotate tangent 90° -> normal\n nx = -ty;\n ny = tx;\n\n // First / last vertex -> offset the point in the direction of the normal vector\n if (prevX === undefined || prevY === undefined) {\n return [x + nx * offset, y + ny * offset];\n }\n if (nextX === undefined || nextY === undefined) {\n return [x + nx * offset, y + ny * offset];\n }\n\n // Compute join angle - angle between 2 segments of the vertex.\n const joinAngle = angleBetween([x, y], [prevX, prevY], [nextX, nextY]);\n\n // Avoid huge or infinite miter joins for very sharp angles, offset in the segment direction in this case.\n if (Math.cos(joinAngle) > 0.998) {\n return [x + tx * offset, y + ty * offset];\n }\n\n // Compute join offset direction.\n // We rotate the normal vector by half of the join angle.\n // This gives the direction of the miter at the vertex.\n const cos = Math.cos(joinAngle / 2);\n const sin = Math.sin(joinAngle / 2);\n\n // Rotate the normal vector (nx, ny) by half of the join angle.\n // bx/by = bisector direction before normalization\n const bx = sin * nx + cos * ny;\n const by = -cos * nx + sin * ny;\n\n // Scale the bisector so that moving along it preserves the correct offset distance.\n // Dividing by sin(half of angle) converts the bisector into the true miter vector.\n // (This expands the miter for sharp angles and shortens it for wide ones.)\n const dx = bx * (1 / sin);\n const dy = by * (1 / sin);\n\n // Offset final vertex along miter direction\n return [x + dx * offset, y + dy * offset];\n}\n\n/**\n * Removes self-intersection loops (cycles) from an offset line.\n * When a polyline is offset, sharp turns can create self-intersecting loops.\n * This function detects those crossings and splices out the looped portions,\n * replacing them with the intersection point.\n *\n * @param {Array<number>} coords Flat offset coordinates (modified in-place).\n * @param {number} stride Coordinate stride (typically 2).\n * @param {boolean} [closedLine] Whether the original line is closed (first vertex === last vertex).\n * When true, the first and last offset segments are not compared against each other to avoid\n * false loop detection at the closure point.\n * @return {Array<number>} The cleaned coordinate array.\n */\nexport function removeOffsetCycles(coords, stride, closedLine = false) {\n for (let i = 0, ii = coords.length - 2; i < ii; i += stride) {\n const jMax =\n closedLine && i === 0\n ? coords.length - 3 * stride\n : coords.length - 2 * stride;\n for (let j = jMax; j > i + stride; j -= stride) {\n const p1x = coords[i];\n const p1y = coords[i + 1];\n const p2x = coords[i + stride];\n const p2y = coords[i + stride + 1];\n const p3x = coords[j];\n const p3y = coords[j + 1];\n const p4x = coords[j + stride];\n const p4y = coords[j + stride + 1];\n const d = (p4y - p3y) * (p2x - p1x) - (p4x - p3x) * (p2y - p1y);\n if (d === 0) {\n continue;\n }\n const t = ((p4x - p3x) * (p1y - p3y) - (p4y - p3y) * (p1x - p3x)) / d;\n const u = ((p2x - p1x) * (p1y - p3y) - (p2y - p1y) * (p1x - p3x)) / d;\n if (t > 0 && t < 1 && u > 0 && u < 1) {\n const ix = p1x + t * (p2x - p1x);\n const iy = p1y + t * (p2y - p1y);\n coords[i + stride] = ix;\n coords[i + stride + 1] = iy;\n coords.splice(i + 2 * stride, j - i - stride);\n break;\n }\n }\n }\n return coords;\n}\n"],"names":[],"sourceRoot":""}
|
|
@@ -18,6 +18,17 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
|
+
let segmenter;
|
|
22
|
+
/**
|
|
23
|
+
* @return {Intl.Segmenter} A grapheme segmenter.
|
|
24
|
+
*/
|
|
25
|
+
function getSegmenter() {
|
|
26
|
+
if (!segmenter) {
|
|
27
|
+
segmenter = new Intl.Segmenter(undefined, {granularity: 'grapheme'});
|
|
28
|
+
}
|
|
29
|
+
return segmenter;
|
|
30
|
+
}
|
|
31
|
+
|
|
21
32
|
/**
|
|
22
33
|
* @param {Array<number>} flatCoordinates Path to put text on.
|
|
23
34
|
* @param {number} offset Start offset of the `flatCoordinates`.
|
|
@@ -125,7 +136,8 @@ function drawTextOnPath(
|
|
|
125
136
|
// rendering across line segments
|
|
126
137
|
text = text.replace(/\n/g, ' '); // ensure rendering in single-line as all calculations below don't handle multi-lines
|
|
127
138
|
|
|
128
|
-
|
|
139
|
+
const segments = Array.from(getSegmenter().segment(text), (s) => s.segment);
|
|
140
|
+
for (let i = 0, ii = segments.length; i < ii;) {
|
|
129
141
|
advance();
|
|
130
142
|
let angle = Math.atan2(y2 - y1, x2 - x1);
|
|
131
143
|
if (reverse) {
|
|
@@ -144,7 +156,8 @@ function drawTextOnPath(
|
|
|
144
156
|
let charLength = 0;
|
|
145
157
|
for (; i < ii; ++i) {
|
|
146
158
|
const index = reverse ? ii - i - 1 : i;
|
|
147
|
-
const len =
|
|
159
|
+
const len =
|
|
160
|
+
scale * measureAndCacheTextWidth(font, segments[index], cache);
|
|
148
161
|
if (
|
|
149
162
|
offset + stride < end &&
|
|
150
163
|
segmentM + segmentLength < startM + charLength + len / 2
|
|
@@ -156,9 +169,9 @@ function drawTextOnPath(
|
|
|
156
169
|
if (i === iStart) {
|
|
157
170
|
continue;
|
|
158
171
|
}
|
|
159
|
-
const chars =
|
|
160
|
-
?
|
|
161
|
-
|
|
172
|
+
const chars = (
|
|
173
|
+
reverse ? segments.slice(ii - i, ii - iStart) : segments.slice(iStart, i)
|
|
174
|
+
).join('');
|
|
162
175
|
interpolate =
|
|
163
176
|
segmentLength === 0
|
|
164
177
|
? 0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node_modules_vaadin_map_node_modules_ol_geom_flat_textpath_js.js","mappings":";;;;;;;;;;;;;;AAAA;AACA;AACA;AACmC;AACG;;AAEtC;AACA,WAAW,eAAe;AAC1B,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,yDAAyD;AACpE,WAAW,QAAQ;AACnB,WAAW,wBAAwB;AACnC,WAAW,QAAQ;AACnB,WAAW,SAAS;AACpB,YAAY,sBAAsB;AAClC;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA,iBAAiB,8CAAI;AACrB,iBAAiB,8CAAI;;AAErB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,8CAAI;AACnB,eAAe,8CAAI;;AAEnB;AACA;AACA;AACA;AACA;AACA,MAAM,qDAAM;AACZ;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mCAAmC;;AAEnC,
|
|
1
|
+
{"version":3,"file":"node_modules_vaadin_map_node_modules_ol_geom_flat_textpath_js.js","mappings":";;;;;;;;;;;;;;AAAA;AACA;AACA;AACmC;AACG;;AAEtC;AACA;AACA,YAAY,gBAAgB;AAC5B;AACA;AACA;AACA,+CAA+C,wBAAwB;AACvE;AACA;AACA;;AAEA;AACA,WAAW,eAAe;AAC1B,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,yDAAyD;AACpE,WAAW,QAAQ;AACnB,WAAW,wBAAwB;AACnC,WAAW,QAAQ;AACnB,WAAW,SAAS;AACpB,YAAY,sBAAsB;AAClC;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA,iBAAiB,8CAAI;AACrB,iBAAiB,8CAAI;;AAErB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,8CAAI;AACnB,eAAe,8CAAI;;AAEnB;AACA;AACA;AACA;AACA;AACA,MAAM,qDAAM;AACZ;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mCAAmC;;AAEnC;AACA,wCAAwC,OAAO;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,8CAAI;AAClB,cAAc,8CAAI;AAClB;AACA;AACA;AACA;AACA","sources":["webpack://@vaadin/bundles/./node_modules/@vaadin/map/node_modules/ol/geom/flat/textpath.js"],"sourcesContent":["/**\n * @module ol/geom/flat/textpath\n */\nimport {lerp} from '../../math.js';\nimport {rotate} from './transform.js';\n\nlet segmenter;\n/**\n * @return {Intl.Segmenter} A grapheme segmenter.\n */\nfunction getSegmenter() {\n if (!segmenter) {\n segmenter = new Intl.Segmenter(undefined, {granularity: 'grapheme'});\n }\n return segmenter;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Path to put text on.\n * @param {number} offset Start offset of the `flatCoordinates`.\n * @param {number} end End offset of the `flatCoordinates`.\n * @param {number} stride Stride.\n * @param {string} text Text to place on the path.\n * @param {number} startM m along the path where the text starts.\n * @param {number} maxAngle Max angle between adjacent chars in radians.\n * @param {number} scale The product of the text scale and the device pixel ratio.\n * @param {function(string, string, Object<string, number>):number} measureAndCacheTextWidth Measure and cache text width.\n * @param {string} font The font.\n * @param {Object<string, number>} cache A cache of measured widths.\n * @param {number} rotation Rotation to apply to the flatCoordinates to determine whether text needs to be reversed.\n * @param {boolean} keepUpright Whether the text needs to be kept upright\n * @return {Array<Array<*>>|null} The result array (or null if `maxAngle` was\n * exceeded). Entries of the array are x, y, anchorX, angle, chunk.\n */\nexport function drawTextOnPath(\n flatCoordinates,\n offset,\n end,\n stride,\n text,\n startM,\n maxAngle,\n scale,\n measureAndCacheTextWidth,\n font,\n cache,\n rotation,\n keepUpright = true,\n) {\n let x2 = flatCoordinates[offset];\n let y2 = flatCoordinates[offset + 1];\n let x1 = 0;\n let y1 = 0;\n let segmentLength = 0;\n let segmentM = 0;\n\n function advance() {\n x1 = x2;\n y1 = y2;\n offset += stride;\n x2 = flatCoordinates[offset];\n y2 = flatCoordinates[offset + 1];\n segmentM += segmentLength;\n segmentLength = Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));\n }\n do {\n advance();\n } while (offset < end - stride && segmentM + segmentLength < startM);\n\n let interpolate =\n segmentLength === 0 ? 0 : (startM - segmentM) / segmentLength;\n const beginX = lerp(x1, x2, interpolate);\n const beginY = lerp(y1, y2, interpolate);\n\n const startOffset = offset - stride;\n const startLength = segmentM;\n const endM = startM + scale * measureAndCacheTextWidth(font, text, cache);\n while (offset < end - stride && segmentM + segmentLength < endM) {\n advance();\n }\n interpolate = segmentLength === 0 ? 0 : (endM - segmentM) / segmentLength;\n const endX = lerp(x1, x2, interpolate);\n const endY = lerp(y1, y2, interpolate);\n\n // Keep text upright if the option is selected\n let reverse = false;\n if (keepUpright) {\n if (rotation) {\n const flat = [beginX, beginY, endX, endY];\n rotate(flat, 0, 4, 2, rotation, flat, flat);\n reverse = flat[0] > flat[2];\n } else {\n reverse = beginX > endX;\n }\n }\n\n const PI = Math.PI;\n const result = [];\n const singleSegment = startOffset + stride === offset;\n\n offset = startOffset;\n segmentLength = 0;\n segmentM = startLength;\n x2 = flatCoordinates[offset];\n y2 = flatCoordinates[offset + 1];\n\n let previousAngle;\n // All on the same segment\n if (singleSegment) {\n advance();\n\n previousAngle = Math.atan2(y2 - y1, x2 - x1);\n if (reverse) {\n previousAngle += previousAngle > 0 ? -PI : PI;\n }\n const x = (endX + beginX) / 2;\n const y = (endY + beginY) / 2;\n result[0] = [x, y, (endM - startM) / 2, previousAngle, text];\n return result;\n }\n\n // rendering across line segments\n text = text.replace(/\\n/g, ' '); // ensure rendering in single-line as all calculations below don't handle multi-lines\n\n const segments = Array.from(getSegmenter().segment(text), (s) => s.segment);\n for (let i = 0, ii = segments.length; i < ii;) {\n advance();\n let angle = Math.atan2(y2 - y1, x2 - x1);\n if (reverse) {\n angle += angle > 0 ? -PI : PI;\n }\n if (previousAngle !== undefined) {\n let delta = angle - previousAngle;\n delta += delta > PI ? -2 * PI : delta < -PI ? 2 * PI : 0;\n if (Math.abs(delta) > maxAngle) {\n return null;\n }\n }\n previousAngle = angle;\n\n const iStart = i;\n let charLength = 0;\n for (; i < ii; ++i) {\n const index = reverse ? ii - i - 1 : i;\n const len =\n scale * measureAndCacheTextWidth(font, segments[index], cache);\n if (\n offset + stride < end &&\n segmentM + segmentLength < startM + charLength + len / 2\n ) {\n break;\n }\n charLength += len;\n }\n if (i === iStart) {\n continue;\n }\n const chars = (\n reverse ? segments.slice(ii - i, ii - iStart) : segments.slice(iStart, i)\n ).join('');\n interpolate =\n segmentLength === 0\n ? 0\n : (startM + charLength / 2 - segmentM) / segmentLength;\n const x = lerp(x1, x2, interpolate);\n const y = lerp(y1, y2, interpolate);\n result.push([x, y, charLength / 2, angle, chars]);\n startM += charLength;\n }\n return result;\n}\n"],"names":[],"sourceRoot":""}
|
|
@@ -11,9 +11,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
11
11
|
/* harmony export */ "DragAndDropEvent": () => (/* binding */ DragAndDropEvent),
|
|
12
12
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
13
13
|
/* harmony export */ });
|
|
14
|
+
/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../events.js */ "./node_modules/@vaadin/map/node_modules/ol/events.js");
|
|
14
15
|
/* harmony import */ var _events_Event_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../events/Event.js */ "./node_modules/@vaadin/map/node_modules/ol/events/Event.js");
|
|
15
16
|
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../events/EventType.js */ "./node_modules/@vaadin/map/node_modules/ol/events/EventType.js");
|
|
16
|
-
/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../events.js */ "./node_modules/@vaadin/map/node_modules/ol/events.js");
|
|
17
17
|
/* harmony import */ var _functions_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../functions.js */ "./node_modules/@vaadin/map/node_modules/ol/functions.js");
|
|
18
18
|
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../proj.js */ "./node_modules/@vaadin/map/node_modules/ol/proj.js");
|
|
19
19
|
/* harmony import */ var _Interaction_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Interaction.js */ "./node_modules/@vaadin/map/node_modules/ol/interaction/Interaction.js");
|
|
@@ -94,11 +94,11 @@ class DragAndDropEvent extends _events_Event_js__WEBPACK_IMPORTED_MODULE_1__["de
|
|
|
94
94
|
|
|
95
95
|
/***
|
|
96
96
|
* @template Return
|
|
97
|
-
* @typedef {import("../Observable").OnSignature<import("../Observable").EventTypes, import("../events/Event.js").default, Return> &
|
|
98
|
-
* import("../Observable").OnSignature<import("../ObjectEventType").Types|
|
|
99
|
-
* 'change:active', import("../Object").ObjectEvent, Return> &
|
|
100
|
-
* import("../Observable").OnSignature<'addfeatures', DragAndDropEvent, Return> &
|
|
101
|
-
* import("../Observable").CombinedOnSignature<import("../Observable").EventTypes|import("../ObjectEventType").Types|
|
|
97
|
+
* @typedef {import("../Observable.js").OnSignature<import("../Observable.js").EventTypes, import("../events/Event.js").default, Return> &
|
|
98
|
+
* import("../Observable.js").OnSignature<import("../ObjectEventType.js").Types|
|
|
99
|
+
* 'change:active', import("../Object.js").ObjectEvent, Return> &
|
|
100
|
+
* import("../Observable.js").OnSignature<'addfeatures', DragAndDropEvent, Return> &
|
|
101
|
+
* import("../Observable.js").CombinedOnSignature<import("../Observable.js").EventTypes|import("../ObjectEventType.js").Types|
|
|
102
102
|
* 'change:active'|'addfeatures', Return>} DragAndDropOnSignature
|
|
103
103
|
*/
|
|
104
104
|
|
|
@@ -122,12 +122,12 @@ class DragAndDrop extends _Interaction_js__WEBPACK_IMPORTED_MODULE_2__["default"
|
|
|
122
122
|
});
|
|
123
123
|
|
|
124
124
|
/***
|
|
125
|
-
* @type {DragAndDropOnSignature<import("../events").EventsKey>}
|
|
125
|
+
* @type {DragAndDropOnSignature<import("../events.js").EventsKey>}
|
|
126
126
|
*/
|
|
127
127
|
this.on;
|
|
128
128
|
|
|
129
129
|
/***
|
|
130
|
-
* @type {DragAndDropOnSignature<import("../events").EventsKey>}
|
|
130
|
+
* @type {DragAndDropOnSignature<import("../events.js").EventsKey>}
|
|
131
131
|
*/
|
|
132
132
|
this.once;
|
|
133
133
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node_modules_vaadin_map_node_modules_ol_interaction_DragAndDrop_js.js","mappings":";;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;;AAEuC;AACQ;AACI;AACd;AAC8B;AACxB;;AAE3C;AACA,aAAa,QAAQ;AACrB,cAAc,6FAA6F;AAC3G;AACA,cAAc,uCAAuC;AACrD;AACA;AACA;AACA;AACA,cAAc,qCAAqC;AACnD,cAAc,aAAa;AAC3B;;AAEA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,sBAAsB,qDAAqD;AAC3E;AACA;AACO,+BAA+B,wDAAK;AAC3C;AACA,aAAa,sBAAsB;AACnC,aAAa,MAAM;AACnB,aAAa,wCAAwC;AACrD,aAAa,yCAAyC;AACtD;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,+CAA+C;AAC/C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,uDAAW;AACrC;AACA,aAAa,SAAS;AACtB;AACA;AACA;;AAEA;AACA,mBAAmB,+CAAI;AACvB,KAAK;;AAEL;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA,oDAAoD,QAAQ;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA,QAAQ,6CAAa;AACrB;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,2DAAiB;AACpC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,yCAAyC,QAAQ;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,kDAAM,WAAW,iEAAc;AACvC,QAAQ,kDAAM,WAAW,sEAAmB;AAC5C,QAAQ,kDAAM,WAAW,qEAAkB;AAC3C,QAAQ,kDAAM,WAAW,iEAAc;AACvC;AACA;AACA;;AAEA;AACA;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,6BAA6B;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,wCAAwC;AACrD,aAAa,QAAQ;AACrB,aAAa,4CAA4C;AACzD;AACA,cAAc,wCAAwC;AACtD;AACA;AACA;AACA;AACA,mBAAmB,wCAAwC;AAC3D;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mCAAmC,qDAAa;AAChD;AACA;AACA;;AAEA;AACA,aAAa,WAAW;AACxB;AACA;AACA;AACA,uCAAuC,QAAQ;AAC/C;AACA;AACA;AACA,QAAQ,iEAAc;AACtB;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;;AAEA;AACA,aAAa,WAAW;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iEAAe,WAAW,EAAC","sources":["webpack://@vaadin/bundles/./node_modules/@vaadin/map/node_modules/ol/interaction/DragAndDrop.js"],"sourcesContent":["/**\n * @module ol/interaction/DragAndDrop\n */\n// FIXME should handle all geo-referenced data, not just vector data\n\nimport Event from '../events/Event.js';\nimport EventType from '../events/EventType.js';\nimport {listen, unlistenByKey} from '../events.js';\nimport {TRUE} from '../functions.js';\nimport {get as getProjection, getUserProjection} from '../proj.js';\nimport Interaction from './Interaction.js';\n\n/**\n * @typedef {Object} Options\n * @property {Array<typeof import(\"../format/Feature.js\").default|import(\"../format/Feature.js\").default>} [formatConstructors] Format constructors\n * (and/or formats pre-constructed with options).\n * @property {import(\"../source/Vector.js\").default} [source] Optional vector source where features will be added. If a source is provided\n * all existing features will be removed and new features will be added when\n * they are dropped on the target. If you want to add features to a vector\n * source without removing the existing features (append only), instead of\n * providing the source option listen for the \"addfeatures\" event.\n * @property {import(\"../proj.js\").ProjectionLike} [projection] Target projection. By default, the map's view's projection is used.\n * @property {HTMLElement} [target] The element that is used as the drop target, default is the viewport element.\n */\n\n/**\n * @enum {string}\n */\nconst DragAndDropEventType = {\n /**\n * Triggered when features are added\n * @event DragAndDropEvent#addfeatures\n * @api\n */\n ADD_FEATURES: 'addfeatures',\n};\n\n/**\n * @classdesc\n * Events emitted by {@link module:ol/interaction/DragAndDrop~DragAndDrop} instances are instances\n * of this type.\n */\nexport class DragAndDropEvent extends Event {\n /**\n * @param {DragAndDropEventType} type Type.\n * @param {File} file File.\n * @param {Array<import(\"../Feature.js\").default>} [features] Features.\n * @param {import(\"../proj/Projection.js\").default} [projection] Projection.\n */\n constructor(type, file, features, projection) {\n super(type);\n\n /**\n * The features parsed from dropped data.\n * @type {Array<import(\"../Feature.js\").FeatureLike>|undefined}\n * @api\n */\n this.features = features;\n\n /**\n * The dropped file.\n * @type {File}\n * @api\n */\n this.file = file;\n\n /**\n * The feature projection.\n * @type {import(\"../proj/Projection.js\").default|undefined}\n * @api\n */\n this.projection = projection;\n }\n}\n\n/***\n * @template Return\n * @typedef {import(\"../Observable\").OnSignature<import(\"../Observable\").EventTypes, import(\"../events/Event.js\").default, Return> &\n * import(\"../Observable\").OnSignature<import(\"../ObjectEventType\").Types|\n * 'change:active', import(\"../Object\").ObjectEvent, Return> &\n * import(\"../Observable\").OnSignature<'addfeatures', DragAndDropEvent, Return> &\n * import(\"../Observable\").CombinedOnSignature<import(\"../Observable\").EventTypes|import(\"../ObjectEventType\").Types|\n * 'change:active'|'addfeatures', Return>} DragAndDropOnSignature\n */\n\n/**\n * @classdesc\n * Handles input of vector data by drag and drop.\n *\n * @api\n *\n * @fires DragAndDropEvent\n */\nclass DragAndDrop extends Interaction {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super({\n handleEvent: TRUE,\n });\n\n /***\n * @type {DragAndDropOnSignature<import(\"../events\").EventsKey>}\n */\n this.on;\n\n /***\n * @type {DragAndDropOnSignature<import(\"../events\").EventsKey>}\n */\n this.once;\n\n /***\n * @type {DragAndDropOnSignature<void>}\n */\n this.un;\n\n /**\n * @private\n * @type {boolean}\n */\n this.readAsBuffer_ = false;\n\n /**\n * @private\n * @type {Array<import(\"../format/Feature.js\").default>}\n */\n this.formats_ = [];\n const formatConstructors = options.formatConstructors\n ? options.formatConstructors\n : [];\n for (let i = 0, ii = formatConstructors.length; i < ii; ++i) {\n let format = formatConstructors[i];\n if (typeof format === 'function') {\n format = new format();\n }\n this.formats_.push(format);\n this.readAsBuffer_ =\n this.readAsBuffer_ || format.getType() === 'arraybuffer';\n }\n\n /**\n * @private\n * @type {import(\"../proj/Projection.js\").default}\n */\n this.projection_ = options.projection\n ? getProjection(options.projection)\n : null;\n\n /**\n * @private\n * @type {?Array<import(\"../events.js\").EventsKey>}\n */\n this.dropListenKeys_ = null;\n\n /**\n * @private\n * @type {import(\"../source/Vector.js\").default}\n */\n this.source_ = options.source || null;\n\n /**\n * @private\n * @type {HTMLElement|null}\n */\n this.target = options.target ? options.target : null;\n }\n\n /**\n * @param {File} file File.\n * @param {Event} event Load event.\n * @private\n */\n handleResult_(file, event) {\n const result = event.target.result;\n const map = this.getMap();\n let projection = this.projection_;\n if (!projection) {\n projection = getUserProjection();\n if (!projection) {\n const view = map.getView();\n projection = view.getProjection();\n }\n }\n\n let text;\n const formats = this.formats_;\n for (let i = 0, ii = formats.length; i < ii; ++i) {\n const format = formats[i];\n let input = result;\n if (this.readAsBuffer_ && format.getType() !== 'arraybuffer') {\n if (text === undefined) {\n text = new TextDecoder().decode(result);\n }\n input = text;\n }\n const features = this.tryReadFeatures_(format, input, {\n featureProjection: projection,\n });\n if (features && features.length > 0) {\n if (this.source_) {\n this.source_.clear();\n this.source_.addFeatures(features);\n }\n this.dispatchEvent(\n new DragAndDropEvent(\n DragAndDropEventType.ADD_FEATURES,\n file,\n features,\n projection,\n ),\n );\n break;\n }\n }\n }\n\n /**\n * @private\n */\n registerListeners_() {\n const map = this.getMap();\n if (map) {\n const dropArea = this.target ? this.target : map.getViewport();\n this.dropListenKeys_ = [\n listen(dropArea, EventType.DROP, this.handleDrop, this),\n listen(dropArea, EventType.DRAGENTER, this.handleStop, this),\n listen(dropArea, EventType.DRAGOVER, this.handleStop, this),\n listen(dropArea, EventType.DROP, this.handleStop, this),\n ];\n }\n }\n\n /**\n * Activate or deactivate the interaction.\n * @param {boolean} active Active.\n * @observable\n * @api\n * @override\n */\n setActive(active) {\n if (!this.getActive() && active) {\n this.registerListeners_();\n }\n if (this.getActive() && !active) {\n this.unregisterListeners_();\n }\n super.setActive(active);\n }\n\n /**\n * Remove the interaction from its current map and attach it to the new map.\n * Subclasses may set up event handlers to get notified about changes to\n * the map here.\n * @param {import(\"../Map.js\").default} map Map.\n * @override\n */\n setMap(map) {\n this.unregisterListeners_();\n super.setMap(map);\n if (this.getActive()) {\n this.registerListeners_();\n }\n }\n\n /**\n * @param {import(\"../format/Feature.js\").default} format Format.\n * @param {string} text Text.\n * @param {import(\"../format/Feature.js\").ReadOptions} options Read options.\n * @private\n * @return {Array<import(\"../Feature.js\").default>} Features.\n */\n tryReadFeatures_(format, text, options) {\n try {\n return (\n /** @type {Array<import(\"../Feature.js\").default>} */\n (format.readFeatures(text, options))\n );\n } catch {\n return null;\n }\n }\n\n /**\n * @private\n */\n unregisterListeners_() {\n if (this.dropListenKeys_) {\n this.dropListenKeys_.forEach(unlistenByKey);\n this.dropListenKeys_ = null;\n }\n }\n\n /**\n * @param {DragEvent} event Event.\n */\n handleDrop(event) {\n const files = event.dataTransfer.files;\n for (let i = 0, ii = files.length; i < ii; ++i) {\n const file = files.item(i);\n const reader = new FileReader();\n reader.addEventListener(\n EventType.LOAD,\n this.handleResult_.bind(this, file),\n );\n if (this.readAsBuffer_) {\n reader.readAsArrayBuffer(file);\n } else {\n reader.readAsText(file);\n }\n }\n }\n\n /**\n * @param {DragEvent} event Event.\n */\n handleStop(event) {\n event.stopPropagation();\n event.preventDefault();\n event.dataTransfer.dropEffect = 'copy';\n }\n}\n\nexport default DragAndDrop;\n"],"names":[],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"node_modules_vaadin_map_node_modules_ol_interaction_DragAndDrop_js.js","mappings":";;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;;AAEmD;AACZ;AACQ;AACV;AAC8B;AACxB;;AAE3C;AACA,aAAa,QAAQ;AACrB,cAAc,6FAA6F;AAC3G;AACA,cAAc,uCAAuC;AACrD;AACA;AACA;AACA;AACA,cAAc,qCAAqC;AACnD,cAAc,aAAa;AAC3B;;AAEA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,sBAAsB,qDAAqD;AAC3E;AACA;AACO,+BAA+B,wDAAK;AAC3C;AACA,aAAa,sBAAsB;AACnC,aAAa,MAAM;AACnB,aAAa,wCAAwC;AACrD,aAAa,yCAAyC;AACtD;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,+CAA+C;AAC/C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,uDAAW;AACrC;AACA,aAAa,SAAS;AACtB;AACA;AACA;;AAEA;AACA,mBAAmB,+CAAI;AACvB,KAAK;;AAEL;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA,oDAAoD,QAAQ;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA,QAAQ,6CAAa;AACrB;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,2DAAiB;AACpC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,yCAAyC,QAAQ;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,kDAAM,WAAW,iEAAc;AACvC,QAAQ,kDAAM,WAAW,sEAAmB;AAC5C,QAAQ,kDAAM,WAAW,qEAAkB;AAC3C,QAAQ,kDAAM,WAAW,iEAAc;AACvC;AACA;AACA;;AAEA;AACA;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,6BAA6B;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,wCAAwC;AACrD,aAAa,QAAQ;AACrB,aAAa,4CAA4C;AACzD;AACA,cAAc,wCAAwC;AACtD;AACA;AACA;AACA;AACA,mBAAmB,wCAAwC;AAC3D;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mCAAmC,qDAAa;AAChD;AACA;AACA;;AAEA;AACA,aAAa,WAAW;AACxB;AACA;AACA;AACA,uCAAuC,QAAQ;AAC/C;AACA;AACA;AACA,QAAQ,iEAAc;AACtB;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;;AAEA;AACA,aAAa,WAAW;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iEAAe,WAAW,EAAC","sources":["webpack://@vaadin/bundles/./node_modules/@vaadin/map/node_modules/ol/interaction/DragAndDrop.js"],"sourcesContent":["/**\n * @module ol/interaction/DragAndDrop\n */\n// FIXME should handle all geo-referenced data, not just vector data\n\nimport {listen, unlistenByKey} from '../events.js';\nimport Event from '../events/Event.js';\nimport EventType from '../events/EventType.js';\nimport {TRUE} from '../functions.js';\nimport {get as getProjection, getUserProjection} from '../proj.js';\nimport Interaction from './Interaction.js';\n\n/**\n * @typedef {Object} Options\n * @property {Array<typeof import(\"../format/Feature.js\").default|import(\"../format/Feature.js\").default>} [formatConstructors] Format constructors\n * (and/or formats pre-constructed with options).\n * @property {import(\"../source/Vector.js\").default} [source] Optional vector source where features will be added. If a source is provided\n * all existing features will be removed and new features will be added when\n * they are dropped on the target. If you want to add features to a vector\n * source without removing the existing features (append only), instead of\n * providing the source option listen for the \"addfeatures\" event.\n * @property {import(\"../proj.js\").ProjectionLike} [projection] Target projection. By default, the map's view's projection is used.\n * @property {HTMLElement} [target] The element that is used as the drop target, default is the viewport element.\n */\n\n/**\n * @enum {string}\n */\nconst DragAndDropEventType = {\n /**\n * Triggered when features are added\n * @event DragAndDropEvent#addfeatures\n * @api\n */\n ADD_FEATURES: 'addfeatures',\n};\n\n/**\n * @classdesc\n * Events emitted by {@link module:ol/interaction/DragAndDrop~DragAndDrop} instances are instances\n * of this type.\n */\nexport class DragAndDropEvent extends Event {\n /**\n * @param {DragAndDropEventType} type Type.\n * @param {File} file File.\n * @param {Array<import(\"../Feature.js\").default>} [features] Features.\n * @param {import(\"../proj/Projection.js\").default} [projection] Projection.\n */\n constructor(type, file, features, projection) {\n super(type);\n\n /**\n * The features parsed from dropped data.\n * @type {Array<import(\"../Feature.js\").FeatureLike>|undefined}\n * @api\n */\n this.features = features;\n\n /**\n * The dropped file.\n * @type {File}\n * @api\n */\n this.file = file;\n\n /**\n * The feature projection.\n * @type {import(\"../proj/Projection.js\").default|undefined}\n * @api\n */\n this.projection = projection;\n }\n}\n\n/***\n * @template Return\n * @typedef {import(\"../Observable.js\").OnSignature<import(\"../Observable.js\").EventTypes, import(\"../events/Event.js\").default, Return> &\n * import(\"../Observable.js\").OnSignature<import(\"../ObjectEventType.js\").Types|\n * 'change:active', import(\"../Object.js\").ObjectEvent, Return> &\n * import(\"../Observable.js\").OnSignature<'addfeatures', DragAndDropEvent, Return> &\n * import(\"../Observable.js\").CombinedOnSignature<import(\"../Observable.js\").EventTypes|import(\"../ObjectEventType.js\").Types|\n * 'change:active'|'addfeatures', Return>} DragAndDropOnSignature\n */\n\n/**\n * @classdesc\n * Handles input of vector data by drag and drop.\n *\n * @api\n *\n * @fires DragAndDropEvent\n */\nclass DragAndDrop extends Interaction {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super({\n handleEvent: TRUE,\n });\n\n /***\n * @type {DragAndDropOnSignature<import(\"../events.js\").EventsKey>}\n */\n this.on;\n\n /***\n * @type {DragAndDropOnSignature<import(\"../events.js\").EventsKey>}\n */\n this.once;\n\n /***\n * @type {DragAndDropOnSignature<void>}\n */\n this.un;\n\n /**\n * @private\n * @type {boolean}\n */\n this.readAsBuffer_ = false;\n\n /**\n * @private\n * @type {Array<import(\"../format/Feature.js\").default>}\n */\n this.formats_ = [];\n const formatConstructors = options.formatConstructors\n ? options.formatConstructors\n : [];\n for (let i = 0, ii = formatConstructors.length; i < ii; ++i) {\n let format = formatConstructors[i];\n if (typeof format === 'function') {\n format = new format();\n }\n this.formats_.push(format);\n this.readAsBuffer_ =\n this.readAsBuffer_ || format.getType() === 'arraybuffer';\n }\n\n /**\n * @private\n * @type {import(\"../proj/Projection.js\").default}\n */\n this.projection_ = options.projection\n ? getProjection(options.projection)\n : null;\n\n /**\n * @private\n * @type {?Array<import(\"../events.js\").EventsKey>}\n */\n this.dropListenKeys_ = null;\n\n /**\n * @private\n * @type {import(\"../source/Vector.js\").default}\n */\n this.source_ = options.source || null;\n\n /**\n * @private\n * @type {HTMLElement|null}\n */\n this.target = options.target ? options.target : null;\n }\n\n /**\n * @param {File} file File.\n * @param {Event} event Load event.\n * @private\n */\n handleResult_(file, event) {\n const result = event.target.result;\n const map = this.getMap();\n let projection = this.projection_;\n if (!projection) {\n projection = getUserProjection();\n if (!projection) {\n const view = map.getView();\n projection = view.getProjection();\n }\n }\n\n let text;\n const formats = this.formats_;\n for (let i = 0, ii = formats.length; i < ii; ++i) {\n const format = formats[i];\n let input = result;\n if (this.readAsBuffer_ && format.getType() !== 'arraybuffer') {\n if (text === undefined) {\n text = new TextDecoder().decode(result);\n }\n input = text;\n }\n const features = this.tryReadFeatures_(format, input, {\n featureProjection: projection,\n });\n if (features && features.length > 0) {\n if (this.source_) {\n this.source_.clear();\n this.source_.addFeatures(features);\n }\n this.dispatchEvent(\n new DragAndDropEvent(\n DragAndDropEventType.ADD_FEATURES,\n file,\n features,\n projection,\n ),\n );\n break;\n }\n }\n }\n\n /**\n * @private\n */\n registerListeners_() {\n const map = this.getMap();\n if (map) {\n const dropArea = this.target ? this.target : map.getViewport();\n this.dropListenKeys_ = [\n listen(dropArea, EventType.DROP, this.handleDrop, this),\n listen(dropArea, EventType.DRAGENTER, this.handleStop, this),\n listen(dropArea, EventType.DRAGOVER, this.handleStop, this),\n listen(dropArea, EventType.DROP, this.handleStop, this),\n ];\n }\n }\n\n /**\n * Activate or deactivate the interaction.\n * @param {boolean} active Active.\n * @observable\n * @api\n * @override\n */\n setActive(active) {\n if (!this.getActive() && active) {\n this.registerListeners_();\n }\n if (this.getActive() && !active) {\n this.unregisterListeners_();\n }\n super.setActive(active);\n }\n\n /**\n * Remove the interaction from its current map and attach it to the new map.\n * Subclasses may set up event handlers to get notified about changes to\n * the map here.\n * @param {import(\"../Map.js\").default} map Map.\n * @override\n */\n setMap(map) {\n this.unregisterListeners_();\n super.setMap(map);\n if (this.getActive()) {\n this.registerListeners_();\n }\n }\n\n /**\n * @param {import(\"../format/Feature.js\").default} format Format.\n * @param {string} text Text.\n * @param {import(\"../format/Feature.js\").ReadOptions} options Read options.\n * @private\n * @return {Array<import(\"../Feature.js\").default>} Features.\n */\n tryReadFeatures_(format, text, options) {\n try {\n return (\n /** @type {Array<import(\"../Feature.js\").default>} */\n (format.readFeatures(text, options))\n );\n } catch {\n return null;\n }\n }\n\n /**\n * @private\n */\n unregisterListeners_() {\n if (this.dropListenKeys_) {\n this.dropListenKeys_.forEach(unlistenByKey);\n this.dropListenKeys_ = null;\n }\n }\n\n /**\n * @param {DragEvent} event Event.\n */\n handleDrop(event) {\n const files = event.dataTransfer.files;\n for (let i = 0, ii = files.length; i < ii; ++i) {\n const file = files.item(i);\n const reader = new FileReader();\n reader.addEventListener(\n EventType.LOAD,\n this.handleResult_.bind(this, file),\n );\n if (this.readAsBuffer_) {\n reader.readAsArrayBuffer(file);\n } else {\n reader.readAsText(file);\n }\n }\n }\n\n /**\n * @param {DragEvent} event Event.\n */\n handleStop(event) {\n event.stopPropagation();\n event.preventDefault();\n event.dataTransfer.dropEffect = 'copy';\n }\n}\n\nexport default DragAndDrop;\n"],"names":[],"sourceRoot":""}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(self["webpackChunk_vaadin_bundles"] = self["webpackChunk_vaadin_bundles"] || []).push([["node_modules_vaadin_map_node_modules_ol_render_VectorContext_js
|
|
1
|
+
(self["webpackChunk_vaadin_bundles"] = self["webpackChunk_vaadin_bundles"] || []).push([["node_modules_vaadin_map_node_modules_ol_render_VectorContext_js"],{
|
|
2
2
|
|
|
3
3
|
/***/ "./node_modules/@vaadin/map/node_modules/ol/render/VectorContext.js":
|
|
4
4
|
/*!**************************************************************************!*\
|
|
@@ -141,4 +141,4 @@ class VectorContext {
|
|
|
141
141
|
/***/ })
|
|
142
142
|
|
|
143
143
|
}])
|
|
144
|
-
//# sourceMappingURL=node_modules_vaadin_map_node_modules_ol_render_VectorContext_js
|
|
144
|
+
//# sourceMappingURL=node_modules_vaadin_map_node_modules_ol_render_VectorContext_js.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node_modules_vaadin_map_node_modules_ol_render_VectorContext_js.js","mappings":";;;;;;;;;;;;AAAA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,6CAA6C;AAC1D,aAAa,qCAAqC;AAClD,aAAa,UAAU;AACvB,aAAa,UAAU;AACvB,aAAa,QAAQ;AACrB;AACA;;AAEA;AACA;AACA;AACA,aAAa,uCAAuC;AACpD;AACA;;AAEA;AACA;AACA;AACA,aAAa,qCAAqC;AAClD;AACA;;AAEA;AACA,aAAa,qCAAqC;AAClD,aAAa,iCAAiC;AAC9C,aAAa,QAAQ;AACrB;AACA;;AAEA;AACA,aAAa,iCAAiC;AAC9C,aAAa,qCAAqC;AAClD,aAAa,QAAQ;AACrB;AACA;;AAEA;AACA,aAAa,iDAAiD;AAC9D,aAAa,iCAAiC;AAC9C,aAAa,QAAQ;AACrB;AACA;;AAEA;AACA,aAAa,wEAAwE;AACrF,aAAa,qCAAqC;AAClD,aAAa,QAAQ;AACrB;AACA;;AAEA;AACA,aAAa,6EAA6E;AAC1F,aAAa,qCAAqC;AAClD,aAAa,QAAQ;AACrB;AACA;;AAEA;AACA,aAAa,wEAAwE;AACrF,aAAa,qCAAqC;AAClD,aAAa,QAAQ;AACrB;AACA;;AAEA;AACA,aAAa,2CAA2C;AACxD,aAAa,qCAAqC;AAClD,aAAa,QAAQ;AACrB;AACA;;AAEA;AACA,aAAa,mEAAmE;AAChF,aAAa,qCAAqC;AAClD,aAAa,QAAQ;AACrB;AACA;;AAEA;AACA,aAAa,qEAAqE;AAClF,aAAa,qCAAqC;AAClD,aAAa,QAAQ;AACrB;AACA;;AAEA;AACA,aAAa,4EAA4E;AACzF,aAAa,qCAAqC;AAClD,aAAa,QAAQ;AACrB;AACA;;AAEA;AACA,aAAa,oCAAoC;AACjD,aAAa,sCAAsC;AACnD;AACA;;AAEA;AACA,aAAa,qCAAqC;AAClD,aAAa,sDAAsD;AACnE;AACA;;AAEA;AACA,aAAa,oCAAoC;AACjD,aAAa,sDAAsD;AACnE;AACA;AACA;;AAEA,iEAAe,aAAa,EAAC","sources":["webpack://@vaadin/bundles/./node_modules/@vaadin/map/node_modules/ol/render/VectorContext.js"],"sourcesContent":["/**\n * @module ol/render/VectorContext\n */\n\n/**\n * @classdesc\n * Context for drawing geometries. A vector context is available on render\n * events and does not need to be constructed directly.\n * @api\n */\nclass VectorContext {\n /**\n * Render a geometry with a custom renderer.\n *\n * @param {import(\"../geom/SimpleGeometry.js\").default} geometry Geometry.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {Function} renderer Renderer.\n * @param {Function} hitDetectionRenderer Renderer.\n * @param {number} [index] Render order index.\n */\n drawCustom(geometry, feature, renderer, hitDetectionRenderer, index) {}\n\n /**\n * Render a geometry.\n *\n * @param {import(\"../geom/Geometry.js\").default} geometry The geometry to render.\n */\n drawGeometry(geometry) {}\n\n /**\n * Set the rendering style.\n *\n * @param {import(\"../style/Style.js\").default} style The rendering style.\n */\n setStyle(style) {}\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 */\n drawCircle(circleGeometry, feature, index) {}\n\n /**\n * @param {import(\"../Feature.js\").default} feature Feature.\n * @param {import(\"../style/Style.js\").default} style Style.\n * @param {number} [index] Render order index.\n */\n drawFeature(feature, style, index) {}\n\n /**\n * @param {import(\"../geom/GeometryCollection.js\").default} geometryCollectionGeometry Geometry collection.\n * @param {import(\"../Feature.js\").default} feature Feature.\n * @param {number} [index] Render order index.\n */\n drawGeometryCollection(geometryCollectionGeometry, feature, index) {}\n\n /**\n * @param {import(\"../geom/LineString.js\").default|import(\"./Feature.js\").default} lineStringGeometry Line string geometry.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n */\n drawLineString(lineStringGeometry, feature, index) {}\n\n /**\n * @param {import(\"../geom/MultiLineString.js\").default|import(\"./Feature.js\").default} multiLineStringGeometry MultiLineString geometry.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n */\n drawMultiLineString(multiLineStringGeometry, feature, index) {}\n\n /**\n * @param {import(\"../geom/MultiPoint.js\").default|import(\"./Feature.js\").default} multiPointGeometry MultiPoint geometry.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n */\n drawMultiPoint(multiPointGeometry, feature, index) {}\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 */\n drawMultiPolygon(multiPolygonGeometry, feature, index) {}\n\n /**\n * @param {import(\"../geom/Point.js\").default|import(\"./Feature.js\").default} pointGeometry Point geometry.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n */\n drawPoint(pointGeometry, feature, index) {}\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 */\n drawPolygon(polygonGeometry, feature, index) {}\n\n /**\n * @param {import(\"../geom/SimpleGeometry.js\").default|import(\"./Feature.js\").default} geometry Geometry.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n */\n drawText(geometry, feature, index) {}\n\n /**\n * @param {import(\"../style/Fill.js\").default} fillStyle Fill style.\n * @param {import(\"../style/Stroke.js\").default} strokeStyle Stroke style.\n */\n setFillStrokeStyle(fillStyle, strokeStyle) {}\n\n /**\n * @param {import(\"../style/Image.js\").default} imageStyle Image style.\n * @param {import(\"../render/canvas.js\").DeclutterImageWithText} [declutterImageWithText] Shared data for combined decluttering with a text style.\n */\n setImageStyle(imageStyle, declutterImageWithText) {}\n\n /**\n * @param {import(\"../style/Text.js\").default} textStyle Text style.\n * @param {import(\"../render/canvas.js\").DeclutterImageWithText} [declutterImageWithText] Shared data for combined decluttering with an image style.\n */\n setTextStyle(textStyle, declutterImageWithText) {}\n}\n\nexport default VectorContext;\n"],"names":[],"sourceRoot":""}
|
|
@@ -36,10 +36,11 @@ class CanvasLineStringBuilder extends _Builder_js__WEBPACK_IMPORTED_MODULE_0__["
|
|
|
36
36
|
* @param {number} offset Offset.
|
|
37
37
|
* @param {number} end End.
|
|
38
38
|
* @param {number} stride Stride.
|
|
39
|
+
* @param {number} [strokeOffset] Stroke Offset in pixels.
|
|
39
40
|
* @private
|
|
40
41
|
* @return {number} end.
|
|
41
42
|
*/
|
|
42
|
-
drawFlatCoordinates_(flatCoordinates, offset, end, stride) {
|
|
43
|
+
drawFlatCoordinates_(flatCoordinates, offset, end, stride, strokeOffset) {
|
|
43
44
|
const myBegin = this.coordinates.length;
|
|
44
45
|
const myEnd = this.appendFlatLineCoordinates(
|
|
45
46
|
flatCoordinates,
|
|
@@ -49,13 +50,18 @@ class CanvasLineStringBuilder extends _Builder_js__WEBPACK_IMPORTED_MODULE_0__["
|
|
|
49
50
|
false,
|
|
50
51
|
false,
|
|
51
52
|
);
|
|
52
|
-
|
|
53
|
+
this.instructions.push([
|
|
53
54
|
_Instruction_js__WEBPACK_IMPORTED_MODULE_1__["default"].MOVE_TO_LINE_TO,
|
|
54
55
|
myBegin,
|
|
55
56
|
myEnd,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
this.hitDetectionInstructions.push(
|
|
57
|
+
strokeOffset * this.pixelRatio,
|
|
58
|
+
]);
|
|
59
|
+
this.hitDetectionInstructions.push([
|
|
60
|
+
_Instruction_js__WEBPACK_IMPORTED_MODULE_1__["default"].MOVE_TO_LINE_TO,
|
|
61
|
+
myBegin,
|
|
62
|
+
myEnd,
|
|
63
|
+
strokeOffset,
|
|
64
|
+
]);
|
|
59
65
|
return end;
|
|
60
66
|
}
|
|
61
67
|
|
|
@@ -69,6 +75,7 @@ class CanvasLineStringBuilder extends _Builder_js__WEBPACK_IMPORTED_MODULE_0__["
|
|
|
69
75
|
const state = this.state;
|
|
70
76
|
const strokeStyle = state.strokeStyle;
|
|
71
77
|
const lineWidth = state.lineWidth;
|
|
78
|
+
const strokeOffset = state.strokeOffset;
|
|
72
79
|
if (strokeStyle === undefined || lineWidth === undefined) {
|
|
73
80
|
return;
|
|
74
81
|
}
|
|
@@ -77,7 +84,7 @@ class CanvasLineStringBuilder extends _Builder_js__WEBPACK_IMPORTED_MODULE_0__["
|
|
|
77
84
|
this.hitDetectionInstructions.push(
|
|
78
85
|
[
|
|
79
86
|
_Instruction_js__WEBPACK_IMPORTED_MODULE_1__["default"].SET_STROKE_STYLE,
|
|
80
|
-
|
|
87
|
+
_canvas_js__WEBPACK_IMPORTED_MODULE_2__.defaultStrokeStyle,
|
|
81
88
|
state.lineWidth,
|
|
82
89
|
state.lineCap,
|
|
83
90
|
state.lineJoin,
|
|
@@ -94,6 +101,7 @@ class CanvasLineStringBuilder extends _Builder_js__WEBPACK_IMPORTED_MODULE_0__["
|
|
|
94
101
|
0,
|
|
95
102
|
flatCoordinates.length,
|
|
96
103
|
stride,
|
|
104
|
+
strokeOffset,
|
|
97
105
|
);
|
|
98
106
|
this.hitDetectionInstructions.push(_Instruction_js__WEBPACK_IMPORTED_MODULE_1__.strokeInstruction);
|
|
99
107
|
this.endGeometry(feature);
|
|
@@ -109,6 +117,7 @@ class CanvasLineStringBuilder extends _Builder_js__WEBPACK_IMPORTED_MODULE_0__["
|
|
|
109
117
|
const state = this.state;
|
|
110
118
|
const strokeStyle = state.strokeStyle;
|
|
111
119
|
const lineWidth = state.lineWidth;
|
|
120
|
+
const strokeOffset = state.strokeOffset;
|
|
112
121
|
if (strokeStyle === undefined || lineWidth === undefined) {
|
|
113
122
|
return;
|
|
114
123
|
}
|
|
@@ -117,7 +126,7 @@ class CanvasLineStringBuilder extends _Builder_js__WEBPACK_IMPORTED_MODULE_0__["
|
|
|
117
126
|
this.hitDetectionInstructions.push(
|
|
118
127
|
[
|
|
119
128
|
_Instruction_js__WEBPACK_IMPORTED_MODULE_1__["default"].SET_STROKE_STYLE,
|
|
120
|
-
|
|
129
|
+
_canvas_js__WEBPACK_IMPORTED_MODULE_2__.defaultStrokeStyle,
|
|
121
130
|
state.lineWidth,
|
|
122
131
|
state.lineCap,
|
|
123
132
|
state.lineJoin,
|
|
@@ -137,6 +146,7 @@ class CanvasLineStringBuilder extends _Builder_js__WEBPACK_IMPORTED_MODULE_0__["
|
|
|
137
146
|
offset,
|
|
138
147
|
/** @type {number} */ (ends[i]),
|
|
139
148
|
stride,
|
|
149
|
+
strokeOffset,
|
|
140
150
|
);
|
|
141
151
|
}
|
|
142
152
|
this.hitDetectionInstructions.push(_Instruction_js__WEBPACK_IMPORTED_MODULE_1__.strokeInstruction);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node_modules_vaadin_map_node_modules_ol_render_canvas_LineStringBuilder_js.js","mappings":";;;;;;;;;;;;;;;AAAA;AACA;AACA;
|
|
1
|
+
{"version":3,"file":"node_modules_vaadin_map_node_modules_ol_render_canvas_LineStringBuilder_js.js","mappings":";;;;;;;;;;;;;;;AAAA;AACA;AACA;AAKsB;AACmB;AAIf;;AAE1B,sCAAsC,mDAAa;AACnD;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,QAAQ;AACrB,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB;AACA,cAAc,QAAQ;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,uEAAiC;AACvC;AACA;AACA;AACA;AACA;AACA,MAAM,uEAAiC;AACvC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,4EAA4E;AACzF,aAAa,wCAAwC;AACrD,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,wEAAkC;AAC1C,QAAQ,0DAAkB;AAC1B;AACA;AACA;AACA;AACA,QAAQ,uDAAe;AACvB,QAAQ,6DAAqB;AAC7B;AACA,MAAM,iEAAoB;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,8DAAiB;AACxD;AACA;;AAEA;AACA,aAAa,iFAAiF;AAC9F,aAAa,wCAAwC;AACrD,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,wEAAkC;AAC1C,QAAQ,0DAAkB;AAC1B;AACA;AACA;AACA;AACA,QAAQ,uDAAe;AACvB,QAAQ,6DAAqB;AAC7B;AACA,MAAM,iEAAoB;AAC1B;AACA;AACA;AACA;AACA;AACA,sCAAsC,QAAQ;AAC9C;AACA;AACA;AACA,mBAAmB,QAAQ;AAC3B;AACA;AACA;AACA;AACA,uCAAuC,8DAAiB;AACxD;AACA;;AAEA;AACA,cAAc,iDAAiD;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,8DAAiB;AAC9C;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,wCAAwC;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,8DAAiB;AAC9C;AACA;AACA;AACA;AACA,2BAA2B,iEAAoB;AAC/C;AACA;;AAEA,iEAAe,uBAAuB,EAAC","sources":["webpack://@vaadin/bundles/./node_modules/@vaadin/map/node_modules/ol/render/canvas/LineStringBuilder.js"],"sourcesContent":["/**\n * @module ol/render/canvas/LineStringBuilder\n */\nimport {\n defaultLineDash,\n defaultLineDashOffset,\n defaultStrokeStyle,\n} from '../canvas.js';\nimport CanvasBuilder from './Builder.js';\nimport CanvasInstruction, {\n beginPathInstruction,\n strokeInstruction,\n} from './Instruction.js';\n\nclass CanvasLineStringBuilder 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 {number} end End.\n * @param {number} stride Stride.\n * @param {number} [strokeOffset] Stroke Offset in pixels.\n * @private\n * @return {number} end.\n */\n drawFlatCoordinates_(flatCoordinates, offset, end, stride, strokeOffset) {\n const myBegin = this.coordinates.length;\n const myEnd = this.appendFlatLineCoordinates(\n flatCoordinates,\n offset,\n end,\n stride,\n false,\n false,\n );\n this.instructions.push([\n CanvasInstruction.MOVE_TO_LINE_TO,\n myBegin,\n myEnd,\n strokeOffset * this.pixelRatio,\n ]);\n this.hitDetectionInstructions.push([\n CanvasInstruction.MOVE_TO_LINE_TO,\n myBegin,\n myEnd,\n strokeOffset,\n ]);\n return end;\n }\n\n /**\n * @param {import(\"../../geom/LineString.js\").default|import(\"../Feature.js\").default} lineStringGeometry Line string geometry.\n * @param {import(\"../../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n * @override\n */\n drawLineString(lineStringGeometry, feature, index) {\n const state = this.state;\n const strokeStyle = state.strokeStyle;\n const lineWidth = state.lineWidth;\n const strokeOffset = state.strokeOffset;\n if (strokeStyle === undefined || lineWidth === undefined) {\n return;\n }\n this.updateStrokeStyle(state, this.applyStroke);\n this.beginGeometry(lineStringGeometry, feature, index);\n this.hitDetectionInstructions.push(\n [\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 beginPathInstruction,\n );\n const flatCoordinates = lineStringGeometry.getFlatCoordinates();\n const stride = lineStringGeometry.getStride();\n this.drawFlatCoordinates_(\n flatCoordinates,\n 0,\n flatCoordinates.length,\n stride,\n strokeOffset,\n );\n this.hitDetectionInstructions.push(strokeInstruction);\n this.endGeometry(feature);\n }\n\n /**\n * @param {import(\"../../geom/MultiLineString.js\").default|import(\"../Feature.js\").default} multiLineStringGeometry MultiLineString geometry.\n * @param {import(\"../../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n * @override\n */\n drawMultiLineString(multiLineStringGeometry, feature, index) {\n const state = this.state;\n const strokeStyle = state.strokeStyle;\n const lineWidth = state.lineWidth;\n const strokeOffset = state.strokeOffset;\n if (strokeStyle === undefined || lineWidth === undefined) {\n return;\n }\n this.updateStrokeStyle(state, this.applyStroke);\n this.beginGeometry(multiLineStringGeometry, feature, index);\n this.hitDetectionInstructions.push(\n [\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 beginPathInstruction,\n );\n const ends = multiLineStringGeometry.getEnds();\n const flatCoordinates = multiLineStringGeometry.getFlatCoordinates();\n const stride = multiLineStringGeometry.getStride();\n let offset = 0;\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n offset = this.drawFlatCoordinates_(\n flatCoordinates,\n offset,\n /** @type {number} */ (ends[i]),\n stride,\n strokeOffset,\n );\n }\n this.hitDetectionInstructions.push(strokeInstruction);\n this.endGeometry(feature);\n }\n\n /**\n * @return {import(\"../canvas.js\").SerializableInstructions} the serializable instructions.\n * @override\n */\n finish() {\n const state = this.state;\n if (\n state.lastStroke != undefined &&\n state.lastStroke != this.coordinates.length\n ) {\n this.instructions.push(strokeInstruction);\n }\n this.reverseHitDetectionInstructions();\n this.state = null;\n return super.finish();\n }\n\n /**\n * @param {import(\"../canvas.js\").FillStrokeState} state State.\n * @override\n */\n applyStroke(state) {\n if (\n state.lastStroke != undefined &&\n state.lastStroke != this.coordinates.length\n ) {\n this.instructions.push(strokeInstruction);\n state.lastStroke = this.coordinates.length;\n }\n state.lastStroke = 0;\n super.applyStroke(state);\n this.instructions.push(beginPathInstruction);\n }\n}\n\nexport default CanvasLineStringBuilder;\n"],"names":[],"sourceRoot":""}
|
|
@@ -17,7 +17,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
/** @typedef {CanvasRenderingContext2D & {globalAlpha: any}} ZIndexContextProxy */
|
|
20
|
+
/** @typedef {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D & {globalAlpha: any}} ZIndexContextProxy */
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* @extends {CanvasRenderingContext2D}
|
|
@@ -39,6 +39,14 @@ class ZIndexContext {
|
|
|
39
39
|
*/
|
|
40
40
|
this.offset_ = 0;
|
|
41
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Name of the method last accessed on the proxy, pushed together with its
|
|
44
|
+
* arguments when the method is actually called.
|
|
45
|
+
* @private
|
|
46
|
+
* @type {string|symbol}
|
|
47
|
+
*/
|
|
48
|
+
this.pendingMethod_;
|
|
49
|
+
|
|
42
50
|
/**
|
|
43
51
|
* @private
|
|
44
52
|
* @type {ZIndexContextProxy}
|
|
@@ -46,14 +54,11 @@ class ZIndexContext {
|
|
|
46
54
|
this.context_ = /** @type {ZIndexContextProxy} */ (
|
|
47
55
|
new Proxy((0,_dom_js__WEBPACK_IMPORTED_MODULE_0__.getSharedCanvasContext2D)(), {
|
|
48
56
|
get: (target, property) => {
|
|
49
|
-
if (
|
|
50
|
-
typeof (/** @type {*} */ ((0,_dom_js__WEBPACK_IMPORTED_MODULE_0__.getSharedCanvasContext2D)())[property]) !==
|
|
51
|
-
'function'
|
|
52
|
-
) {
|
|
57
|
+
if (typeof (/** @type {*} */ (target)[property]) !== 'function') {
|
|
53
58
|
// we only accept calling functions on the proxy, not accessing properties
|
|
54
59
|
return undefined;
|
|
55
60
|
}
|
|
56
|
-
this.
|
|
61
|
+
this.pendingMethod_ = property;
|
|
57
62
|
return this.pushMethodArgs_;
|
|
58
63
|
},
|
|
59
64
|
set: (target, property, value) => {
|
|
@@ -78,13 +83,13 @@ class ZIndexContext {
|
|
|
78
83
|
}
|
|
79
84
|
|
|
80
85
|
/**
|
|
81
|
-
*
|
|
86
|
+
* Pushes the method name captured at access time together with the arguments
|
|
87
|
+
* passed at call time. Reused across all proxied method calls.
|
|
82
88
|
* @param {...*} args Args.
|
|
83
|
-
* @
|
|
89
|
+
* @private
|
|
84
90
|
*/
|
|
85
91
|
pushMethodArgs_ = (...args) => {
|
|
86
|
-
this.push_(args);
|
|
87
|
-
return this;
|
|
92
|
+
this.push_(this.pendingMethod_, args);
|
|
88
93
|
};
|
|
89
94
|
|
|
90
95
|
/**
|
|
@@ -107,7 +112,7 @@ class ZIndexContext {
|
|
|
107
112
|
}
|
|
108
113
|
|
|
109
114
|
/**
|
|
110
|
-
* @param {CanvasRenderingContext2D} context Context.
|
|
115
|
+
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} context Context.
|
|
111
116
|
*/
|
|
112
117
|
draw(context) {
|
|
113
118
|
this.instructions_.forEach((instructionsAtIndex) => {
|
|
@@ -120,11 +125,9 @@ class ZIndexContext {
|
|
|
120
125
|
const instructionAtIndex = instructionsAtIndex[++i];
|
|
121
126
|
if (typeof (/** @type {*} */ (context)[property]) === 'function') {
|
|
122
127
|
/** @type {*} */ (context)[property](...instructionAtIndex);
|
|
128
|
+
} else if (typeof instructionAtIndex === 'function') {
|
|
129
|
+
/** @type {*} */ (context)[property] = instructionAtIndex(context);
|
|
123
130
|
} else {
|
|
124
|
-
if (typeof instructionAtIndex === 'function') {
|
|
125
|
-
/** @type {*} */ (context)[property] = instructionAtIndex(context);
|
|
126
|
-
continue;
|
|
127
|
-
}
|
|
128
131
|
/** @type {*} */ (context)[property] = instructionAtIndex;
|
|
129
132
|
}
|
|
130
133
|
}
|
package/node_modules_vaadin_map_node_modules_ol_render_canvas_ZIndexContext_js-_abc10.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node_modules_vaadin_map_node_modules_ol_render_canvas_ZIndexContext_js-_abc10.js","mappings":";;;;;;;;;;;;;AAAA;AACA;AACA;;AAEsD;;AAEtD,cAAc,
|
|
1
|
+
{"version":3,"file":"node_modules_vaadin_map_node_modules_ol_render_canvas_ZIndexContext_js-_abc10.js","mappings":";;;;;;;;;;;;;AAAA;AACA;AACA;;AAEsD;;AAEtD,cAAc,8DAA8D,mBAAmB;;AAE/F;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA,+BAA+B,oBAAoB;AACnD,gBAAgB,iEAAwB;AACxC;AACA,iCAAiC,GAAG;AACpC;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA;;AAEA;AACA,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,0CAA0C;AACvD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,cAAc,oBAAoB;AAClC;AACA;AACA;AACA;;AAEA;AACA,aAAa,4DAA4D;AACzE;AACA;AACA;AACA,uDAAuD,QAAQ;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,GAAG;AAClC,qBAAqB,GAAG;AACxB,UAAU;AACV,qBAAqB,GAAG;AACxB,UAAU;AACV,qBAAqB,GAAG;AACxB;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iEAAe,aAAa,EAAC","sources":["webpack://@vaadin/bundles/./node_modules/@vaadin/map/node_modules/ol/render/canvas/ZIndexContext.js"],"sourcesContent":["/**\n * @module ol/render/canvas/ZIndexContext\n */\n\nimport {getSharedCanvasContext2D} from '../../dom.js';\n\n/** @typedef {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D & {globalAlpha: any}} ZIndexContextProxy */\n\n/**\n * @extends {CanvasRenderingContext2D}\n */\nclass ZIndexContext {\n constructor() {\n /**\n * @private\n * @type {Array<Array<*>>}\n */\n this.instructions_ = [];\n /**\n * @type {number}\n */\n this.zIndex = 0;\n /**\n * @private\n * @type {number}\n */\n this.offset_ = 0;\n\n /**\n * Name of the method last accessed on the proxy, pushed together with its\n * arguments when the method is actually called.\n * @private\n * @type {string|symbol}\n */\n this.pendingMethod_;\n\n /**\n * @private\n * @type {ZIndexContextProxy}\n */\n this.context_ = /** @type {ZIndexContextProxy} */ (\n new Proxy(getSharedCanvasContext2D(), {\n get: (target, property) => {\n if (typeof (/** @type {*} */ (target)[property]) !== 'function') {\n // we only accept calling functions on the proxy, not accessing properties\n return undefined;\n }\n this.pendingMethod_ = property;\n return this.pushMethodArgs_;\n },\n set: (target, property, value) => {\n this.push_(property, value);\n return true;\n },\n })\n );\n }\n\n /**\n * @param {...*} args Arguments to push to the instructions array.\n * @private\n */\n push_(...args) {\n const instructions = this.instructions_;\n const index = this.zIndex + this.offset_;\n if (!instructions[index]) {\n instructions[index] = [];\n }\n instructions[index].push(...args);\n }\n\n /**\n * Pushes the method name captured at access time together with the arguments\n * passed at call time. Reused across all proxied method calls.\n * @param {...*} args Args.\n * @private\n */\n pushMethodArgs_ = (...args) => {\n this.push_(this.pendingMethod_, args);\n };\n\n /**\n * Push a function that renders to the context directly.\n * @param {function(CanvasRenderingContext2D): void} render Function.\n */\n pushFunction(render) {\n this.push_(render);\n }\n\n /**\n * Get a proxy for CanvasRenderingContext2D which does not support getting state\n * (e.g. `context.globalAlpha`, which will return `undefined`). To set state, if it relies on a\n * previous state (e.g. `context.globalAlpha = context.globalAlpha / 2`), set a function,\n * e.g. `context.globalAlpha = (context) => context.globalAlpha / 2`.\n * @return {ZIndexContextProxy} Context.\n */\n getContext() {\n return this.context_;\n }\n\n /**\n * @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} context Context.\n */\n draw(context) {\n this.instructions_.forEach((instructionsAtIndex) => {\n for (let i = 0, ii = instructionsAtIndex.length; i < ii; ++i) {\n const property = instructionsAtIndex[i];\n if (typeof property === 'function') {\n property(context);\n continue;\n }\n const instructionAtIndex = instructionsAtIndex[++i];\n if (typeof (/** @type {*} */ (context)[property]) === 'function') {\n /** @type {*} */ (context)[property](...instructionAtIndex);\n } else if (typeof instructionAtIndex === 'function') {\n /** @type {*} */ (context)[property] = instructionAtIndex(context);\n } else {\n /** @type {*} */ (context)[property] = instructionAtIndex;\n }\n }\n });\n }\n\n clear() {\n this.instructions_.length = 0;\n this.zIndex = 0;\n this.offset_ = 0;\n }\n\n /**\n * Offsets the zIndex by the highest current zIndex. Useful for rendering multiple worlds or tiles, to\n * avoid conflicting context.clip() or context.save()/restore() calls.\n */\n offset() {\n this.offset_ = this.instructions_.length;\n this.zIndex = 0;\n }\n}\n\nexport default ZIndexContext;\n"],"names":[],"sourceRoot":""}
|
|
@@ -17,7 +17,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
/** @typedef {CanvasRenderingContext2D & {globalAlpha: any}} ZIndexContextProxy */
|
|
20
|
+
/** @typedef {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D & {globalAlpha: any}} ZIndexContextProxy */
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* @extends {CanvasRenderingContext2D}
|
|
@@ -39,6 +39,14 @@ class ZIndexContext {
|
|
|
39
39
|
*/
|
|
40
40
|
this.offset_ = 0;
|
|
41
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Name of the method last accessed on the proxy, pushed together with its
|
|
44
|
+
* arguments when the method is actually called.
|
|
45
|
+
* @private
|
|
46
|
+
* @type {string|symbol}
|
|
47
|
+
*/
|
|
48
|
+
this.pendingMethod_;
|
|
49
|
+
|
|
42
50
|
/**
|
|
43
51
|
* @private
|
|
44
52
|
* @type {ZIndexContextProxy}
|
|
@@ -46,14 +54,11 @@ class ZIndexContext {
|
|
|
46
54
|
this.context_ = /** @type {ZIndexContextProxy} */ (
|
|
47
55
|
new Proxy((0,_dom_js__WEBPACK_IMPORTED_MODULE_0__.getSharedCanvasContext2D)(), {
|
|
48
56
|
get: (target, property) => {
|
|
49
|
-
if (
|
|
50
|
-
typeof (/** @type {*} */ ((0,_dom_js__WEBPACK_IMPORTED_MODULE_0__.getSharedCanvasContext2D)())[property]) !==
|
|
51
|
-
'function'
|
|
52
|
-
) {
|
|
57
|
+
if (typeof (/** @type {*} */ (target)[property]) !== 'function') {
|
|
53
58
|
// we only accept calling functions on the proxy, not accessing properties
|
|
54
59
|
return undefined;
|
|
55
60
|
}
|
|
56
|
-
this.
|
|
61
|
+
this.pendingMethod_ = property;
|
|
57
62
|
return this.pushMethodArgs_;
|
|
58
63
|
},
|
|
59
64
|
set: (target, property, value) => {
|
|
@@ -78,13 +83,13 @@ class ZIndexContext {
|
|
|
78
83
|
}
|
|
79
84
|
|
|
80
85
|
/**
|
|
81
|
-
*
|
|
86
|
+
* Pushes the method name captured at access time together with the arguments
|
|
87
|
+
* passed at call time. Reused across all proxied method calls.
|
|
82
88
|
* @param {...*} args Args.
|
|
83
|
-
* @
|
|
89
|
+
* @private
|
|
84
90
|
*/
|
|
85
91
|
pushMethodArgs_ = (...args) => {
|
|
86
|
-
this.push_(args);
|
|
87
|
-
return this;
|
|
92
|
+
this.push_(this.pendingMethod_, args);
|
|
88
93
|
};
|
|
89
94
|
|
|
90
95
|
/**
|
|
@@ -107,7 +112,7 @@ class ZIndexContext {
|
|
|
107
112
|
}
|
|
108
113
|
|
|
109
114
|
/**
|
|
110
|
-
* @param {CanvasRenderingContext2D} context Context.
|
|
115
|
+
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} context Context.
|
|
111
116
|
*/
|
|
112
117
|
draw(context) {
|
|
113
118
|
this.instructions_.forEach((instructionsAtIndex) => {
|
|
@@ -120,11 +125,9 @@ class ZIndexContext {
|
|
|
120
125
|
const instructionAtIndex = instructionsAtIndex[++i];
|
|
121
126
|
if (typeof (/** @type {*} */ (context)[property]) === 'function') {
|
|
122
127
|
/** @type {*} */ (context)[property](...instructionAtIndex);
|
|
128
|
+
} else if (typeof instructionAtIndex === 'function') {
|
|
129
|
+
/** @type {*} */ (context)[property] = instructionAtIndex(context);
|
|
123
130
|
} else {
|
|
124
|
-
if (typeof instructionAtIndex === 'function') {
|
|
125
|
-
/** @type {*} */ (context)[property] = instructionAtIndex(context);
|
|
126
|
-
continue;
|
|
127
|
-
}
|
|
128
131
|
/** @type {*} */ (context)[property] = instructionAtIndex;
|
|
129
132
|
}
|
|
130
133
|
}
|
package/node_modules_vaadin_map_node_modules_ol_render_canvas_ZIndexContext_js-_abc11.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node_modules_vaadin_map_node_modules_ol_render_canvas_ZIndexContext_js-_abc11.js","mappings":";;;;;;;;;;;;;AAAA;AACA;AACA;;AAEsD;;AAEtD,cAAc,
|
|
1
|
+
{"version":3,"file":"node_modules_vaadin_map_node_modules_ol_render_canvas_ZIndexContext_js-_abc11.js","mappings":";;;;;;;;;;;;;AAAA;AACA;AACA;;AAEsD;;AAEtD,cAAc,8DAA8D,mBAAmB;;AAE/F;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA,+BAA+B,oBAAoB;AACnD,gBAAgB,iEAAwB;AACxC;AACA,iCAAiC,GAAG;AACpC;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA;;AAEA;AACA,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,0CAA0C;AACvD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,cAAc,oBAAoB;AAClC;AACA;AACA;AACA;;AAEA;AACA,aAAa,4DAA4D;AACzE;AACA;AACA;AACA,uDAAuD,QAAQ;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,GAAG;AAClC,qBAAqB,GAAG;AACxB,UAAU;AACV,qBAAqB,GAAG;AACxB,UAAU;AACV,qBAAqB,GAAG;AACxB;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iEAAe,aAAa,EAAC","sources":["webpack://@vaadin/bundles/./node_modules/@vaadin/map/node_modules/ol/render/canvas/ZIndexContext.js"],"sourcesContent":["/**\n * @module ol/render/canvas/ZIndexContext\n */\n\nimport {getSharedCanvasContext2D} from '../../dom.js';\n\n/** @typedef {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D & {globalAlpha: any}} ZIndexContextProxy */\n\n/**\n * @extends {CanvasRenderingContext2D}\n */\nclass ZIndexContext {\n constructor() {\n /**\n * @private\n * @type {Array<Array<*>>}\n */\n this.instructions_ = [];\n /**\n * @type {number}\n */\n this.zIndex = 0;\n /**\n * @private\n * @type {number}\n */\n this.offset_ = 0;\n\n /**\n * Name of the method last accessed on the proxy, pushed together with its\n * arguments when the method is actually called.\n * @private\n * @type {string|symbol}\n */\n this.pendingMethod_;\n\n /**\n * @private\n * @type {ZIndexContextProxy}\n */\n this.context_ = /** @type {ZIndexContextProxy} */ (\n new Proxy(getSharedCanvasContext2D(), {\n get: (target, property) => {\n if (typeof (/** @type {*} */ (target)[property]) !== 'function') {\n // we only accept calling functions on the proxy, not accessing properties\n return undefined;\n }\n this.pendingMethod_ = property;\n return this.pushMethodArgs_;\n },\n set: (target, property, value) => {\n this.push_(property, value);\n return true;\n },\n })\n );\n }\n\n /**\n * @param {...*} args Arguments to push to the instructions array.\n * @private\n */\n push_(...args) {\n const instructions = this.instructions_;\n const index = this.zIndex + this.offset_;\n if (!instructions[index]) {\n instructions[index] = [];\n }\n instructions[index].push(...args);\n }\n\n /**\n * Pushes the method name captured at access time together with the arguments\n * passed at call time. Reused across all proxied method calls.\n * @param {...*} args Args.\n * @private\n */\n pushMethodArgs_ = (...args) => {\n this.push_(this.pendingMethod_, args);\n };\n\n /**\n * Push a function that renders to the context directly.\n * @param {function(CanvasRenderingContext2D): void} render Function.\n */\n pushFunction(render) {\n this.push_(render);\n }\n\n /**\n * Get a proxy for CanvasRenderingContext2D which does not support getting state\n * (e.g. `context.globalAlpha`, which will return `undefined`). To set state, if it relies on a\n * previous state (e.g. `context.globalAlpha = context.globalAlpha / 2`), set a function,\n * e.g. `context.globalAlpha = (context) => context.globalAlpha / 2`.\n * @return {ZIndexContextProxy} Context.\n */\n getContext() {\n return this.context_;\n }\n\n /**\n * @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} context Context.\n */\n draw(context) {\n this.instructions_.forEach((instructionsAtIndex) => {\n for (let i = 0, ii = instructionsAtIndex.length; i < ii; ++i) {\n const property = instructionsAtIndex[i];\n if (typeof property === 'function') {\n property(context);\n continue;\n }\n const instructionAtIndex = instructionsAtIndex[++i];\n if (typeof (/** @type {*} */ (context)[property]) === 'function') {\n /** @type {*} */ (context)[property](...instructionAtIndex);\n } else if (typeof instructionAtIndex === 'function') {\n /** @type {*} */ (context)[property] = instructionAtIndex(context);\n } else {\n /** @type {*} */ (context)[property] = instructionAtIndex;\n }\n }\n });\n }\n\n clear() {\n this.instructions_.length = 0;\n this.zIndex = 0;\n this.offset_ = 0;\n }\n\n /**\n * Offsets the zIndex by the highest current zIndex. Useful for rendering multiple worlds or tiles, to\n * avoid conflicting context.clip() or context.save()/restore() calls.\n */\n offset() {\n this.offset_ = this.instructions_.length;\n this.zIndex = 0;\n }\n}\n\nexport default ZIndexContext;\n"],"names":[],"sourceRoot":""}
|