Skip to content

Commit fe2e5a5

Browse files
committed
Website updates
1 parent a9e033d commit fe2e5a5

File tree

9 files changed

+116
-25
lines changed

9 files changed

+116
-25
lines changed

dist/en/main/apidoc/module-ol_interaction_Modify-Modify.html

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ <h4 class="name">
177177

178178
<div class="tag-source">
179179
<a href="https://github.com/openlayers/openlayers/blob/main/src/ol/interaction/Modify.js">interaction/Modify.js</a>,
180-
<a href="https://github.com/openlayers/openlayers/blob/main/src/ol/interaction/Modify.js#L249">line 249</a>
180+
<a href="https://github.com/openlayers/openlayers/blob/main/src/ol/interaction/Modify.js#L255">line 255</a>
181181
</div>
182182

183183
</div>
@@ -593,6 +593,35 @@ <h4 class="name">
593593
</tr>
594594

595595

596+
597+
<tr class="">
598+
599+
<td class="name"><code>sharedVerticesEqual</code></td>
600+
601+
602+
603+
<td class="type">
604+
605+
606+
<span class="param-type">function</span>
607+
608+
| undefined
609+
610+
611+
</td>
612+
613+
614+
615+
<td class="description last">
616+
617+
<p>A function that takes two coordinates and returns whether they should be
618+
considered equal for vertex matching purposes. By default, all coordinate
619+
dimensions are compared. This is useful when features have mixed coordinate
620+
dimensions (e.g., XY and XYZ) but should still be treated as sharing vertices
621+
at the same 2D position.</p></td>
622+
</tr>
623+
624+
596625
</tbody>
597626
</table>
598627

@@ -793,7 +822,7 @@ <h4 class="name">
793822

794823
<div class="tag-source">
795824
<a href="https://github.com/openlayers/openlayers/blob/main/src/ol/interaction/Modify.js">interaction/Modify.js</a>,
796-
<a href="https://github.com/openlayers/openlayers/blob/main/src/ol/interaction/Modify.js#L2172">line 2172</a>
825+
<a href="https://github.com/openlayers/openlayers/blob/main/src/ol/interaction/Modify.js#L2194">line 2194</a>
797826
</div>
798827

799828
</div>
@@ -884,7 +913,7 @@ <h4 class="name">
884913

885914
<div class="tag-source">
886915
<a href="https://github.com/openlayers/openlayers/blob/main/src/ol/interaction/Modify.js">interaction/Modify.js</a>,
887-
<a href="https://github.com/openlayers/openlayers/blob/main/src/ol/interaction/Modify.js#L1980">line 1980</a>
916+
<a href="https://github.com/openlayers/openlayers/blob/main/src/ol/interaction/Modify.js#L2002">line 2002</a>
888917
</div>
889918

890919
</div>
@@ -1614,7 +1643,7 @@ <h4 class="name">
16141643

16151644
<div class="tag-source">
16161645
<a href="https://github.com/openlayers/openlayers/blob/main/src/ol/interaction/Modify.js">interaction/Modify.js</a>,
1617-
<a href="https://github.com/openlayers/openlayers/blob/main/src/ol/interaction/Modify.js#L699">line 699</a>
1646+
<a href="https://github.com/openlayers/openlayers/blob/main/src/ol/interaction/Modify.js#L713">line 713</a>
16181647
</div>
16191648

16201649
</div>
@@ -1982,7 +2011,7 @@ <h4 class="name">
19822011

19832012
<div class="tag-source">
19842013
<a href="https://github.com/openlayers/openlayers/blob/main/src/ol/interaction/Modify.js">interaction/Modify.js</a>,
1985-
<a href="https://github.com/openlayers/openlayers/blob/main/src/ol/interaction/Modify.js#L2205">line 2205</a>
2014+
<a href="https://github.com/openlayers/openlayers/blob/main/src/ol/interaction/Modify.js#L2227">line 2227</a>
19862015
</div>
19872016

19882017
</div>
@@ -2452,7 +2481,7 @@ <h4 class="name">
24522481

24532482
<div class="tag-source">
24542483
<a href="https://github.com/openlayers/openlayers/blob/main/src/ol/interaction/Modify.js">interaction/Modify.js</a>,
2455-
<a href="https://github.com/openlayers/openlayers/blob/main/src/ol/interaction/Modify.js#L2011">line 2011</a>
2484+
<a href="https://github.com/openlayers/openlayers/blob/main/src/ol/interaction/Modify.js#L2033">line 2033</a>
24562485
</div>
24572486

24582487
</div>
@@ -2766,7 +2795,7 @@ <h4 class="name">
27662795

27672796
<div class="tag-source">
27682797
<a href="https://github.com/openlayers/openlayers/blob/main/src/ol/interaction/Modify.js">interaction/Modify.js</a>,
2769-
<a href="https://github.com/openlayers/openlayers/blob/main/src/ol/interaction/Modify.js#L674">line 674</a>
2798+
<a href="https://github.com/openlayers/openlayers/blob/main/src/ol/interaction/Modify.js#L688">line 688</a>
27702799
</div>
27712800

27722801
</div>

dist/en/main/apidoc/module-ol_interaction_Modify.html

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,33 @@ <h5 class="subsection-title">Properties:</h5>
699699
</tr>
700700

701701

702+
703+
<tr>
704+
705+
<td class="name"><code>sharedVerticesEqual</code></td>
706+
707+
708+
<td class="type">
709+
710+
711+
<span class="param-type">function</span>
712+
713+
| undefined
714+
715+
716+
</td>
717+
718+
<td class="description last">
719+
<p>A function that takes two coordinates and returns whether they should be
720+
considered equal for vertex matching purposes. By default, all coordinate
721+
dimensions are compared. This is useful when features have mixed coordinate
722+
dimensions (e.g., XY and XYZ) but should still be treated as sharing vertices
723+
at the same 2D position.</p>
724+
725+
</td>
726+
</tr>
727+
728+
702729
</tbody>
703730
</table></dl>
704731

dist/en/main/examples/common.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/en/main/examples/common.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/en/main/ol/dist/ol.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/en/main/ol/dist/ol.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/en/main/ol/interaction/Modify.d.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,14 @@ export type Options = {
156156
* pointer coordinate when clicked within the `pixelTolerance`.
157157
*/
158158
snapToPointer?: boolean | undefined;
159+
/**
160+
* A function that takes two coordinates and returns whether they should be
161+
* considered equal for vertex matching purposes. By default, all coordinate
162+
* dimensions are compared. This is useful when features have mixed coordinate
163+
* dimensions (e.g., XY and XYZ) but should still be treated as sharing vertices
164+
* at the same 2D position.
165+
*/
166+
sharedVerticesEqual?: ((arg0: import("../coordinate.js").Coordinate, arg1: import("../coordinate.js").Coordinate) => boolean) | undefined;
159167
};
160168
/**
161169
* *
@@ -374,6 +382,11 @@ declare class Modify extends PointerInteraction {
374382
* @type {FilterFunction}
375383
*/
376384
private filter_;
385+
/**
386+
* @private
387+
* @type {function(import("../coordinate.js").Coordinate, import("../coordinate.js").Coordinate): boolean}
388+
*/
389+
private coordinatesEqual_;
377390
featuresCollection_: Collection<Feature<import("../geom.js").Geometry, {
378391
[x: string]: any;
379392
}>> | undefined;

dist/en/main/ol/interaction/Modify.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/en/main/ol/interaction/Modify.js

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,12 @@ const ModifyEventType = {
162162
* overlay.
163163
* @property {boolean} [snapToPointer=!hitDetection] The vertex, point or segment being modified snaps to the
164164
* pointer coordinate when clicked within the `pixelTolerance`.
165+
* @property {function(import("../coordinate.js").Coordinate, import("../coordinate.js").Coordinate): boolean} [sharedVerticesEqual]
166+
* A function that takes two coordinates and returns whether they should be
167+
* considered equal for vertex matching purposes. By default, all coordinate
168+
* dimensions are compared. This is useful when features have mixed coordinate
169+
* dimensions (e.g., XY and XYZ) but should still be treated as sharing vertices
170+
* at the same 2D position.
165171
*/
166172

167173
function getCoordinatesArray(coordinates, geometryType, depth) {
@@ -468,6 +474,14 @@ class Modify extends PointerInteraction {
468474
*/
469475
this.filter_ = options.filter ? options.filter : () => true;
470476

477+
/**
478+
* @private
479+
* @type {function(import("../coordinate.js").Coordinate, import("../coordinate.js").Coordinate): boolean}
480+
*/
481+
this.coordinatesEqual_ = options.sharedVerticesEqual
482+
? options.sharedVerticesEqual
483+
: coordinatesEqual;
484+
471485
if (!(options.features || options.source)) {
472486
throw new Error(
473487
'The modify interaction requires features collection or a source',
@@ -1109,7 +1123,7 @@ class Modify extends PointerInteraction {
11091123
projection,
11101124
);
11111125
if (
1112-
coordinatesEqual(closestVertex, vertex) &&
1126+
this.coordinatesEqual_(closestVertex, vertex) &&
11131127
!componentSegments[uid][0]
11141128
) {
11151129
this.dragSegments_.push([segmentDataMatch, 0]);
@@ -1118,13 +1132,19 @@ class Modify extends PointerInteraction {
11181132
continue;
11191133
}
11201134

1121-
if (coordinatesEqual(segment[0], vertex) && !componentSegments[uid][0]) {
1135+
if (
1136+
this.coordinatesEqual_(segment[0], vertex) &&
1137+
!componentSegments[uid][0]
1138+
) {
11221139
this.dragSegments_.push([segmentDataMatch, 0]);
11231140
componentSegments[uid][0] = segmentDataMatch;
11241141
continue;
11251142
}
11261143

1127-
if (coordinatesEqual(segment[1], vertex) && !componentSegments[uid][1]) {
1144+
if (
1145+
this.coordinatesEqual_(segment[1], vertex) &&
1146+
!componentSegments[uid][1]
1147+
) {
11281148
if (
11291149
componentSegments[uid][0] &&
11301150
componentSegments[uid][0].index === 0
@@ -1456,9 +1476,11 @@ class Modify extends PointerInteraction {
14561476
const geometry = segmentData.geometry;
14571477
const index = dragSegment[1];
14581478

1459-
while (vertex.length < geometry.getStride()) {
1460-
vertex.push(segment[index][vertex.length]);
1479+
const stride = geometry.getStride();
1480+
for (let i = 2; i < stride; ++i) {
1481+
vertex[i] = segment[index][i];
14611482
}
1483+
vertex.length = stride;
14621484
switch (geometry.getType()) {
14631485
case 'Point':
14641486
coordinates = vertex;
@@ -1848,10 +1870,10 @@ class Modify extends PointerInteraction {
18481870
for (let i = 1, ii = nodes.length; i < ii; ++i) {
18491871
const segment = nodes[i].segment;
18501872
if (
1851-
(coordinatesEqual(closestSegment[0], segment[0]) &&
1852-
coordinatesEqual(closestSegment[1], segment[1])) ||
1853-
(coordinatesEqual(closestSegment[0], segment[1]) &&
1854-
coordinatesEqual(closestSegment[1], segment[0]))
1873+
(this.coordinatesEqual_(closestSegment[0], segment[0]) &&
1874+
this.coordinatesEqual_(closestSegment[1], segment[1])) ||
1875+
(this.coordinatesEqual_(closestSegment[0], segment[1]) &&
1876+
this.coordinatesEqual_(closestSegment[1], segment[0]))
18551877
) {
18561878
const geometryUid = getUid(nodes[i].geometry);
18571879
if (!(geometryUid in geometries)) {
@@ -1996,8 +2018,8 @@ class Modify extends PointerInteraction {
19962018
const segments = this.rBush_.getInExtent(boundingExtent([coordinate]));
19972019
return segments.some(
19982020
({segment}) =>
1999-
coordinatesEqual(segment[0], coordinate) ||
2000-
coordinatesEqual(segment[1], coordinate),
2021+
this.coordinatesEqual_(segment[0], coordinate) ||
2022+
this.coordinatesEqual_(segment[1], coordinate),
20012023
);
20022024
}
20032025

@@ -2189,8 +2211,8 @@ class Modify extends PointerInteraction {
21892211
return segments.some(
21902212
({segment}) =>
21912213
!(
2192-
coordinatesEqual(segment[0], coordinate) ||
2193-
coordinatesEqual(segment[1], coordinate)
2214+
this.coordinatesEqual_(segment[0], coordinate) ||
2215+
this.coordinatesEqual_(segment[1], coordinate)
21942216
),
21952217
);
21962218
}

0 commit comments

Comments
 (0)