Support RenderFeature in Modify with hitDetection
This commit is contained in:
@@ -82,7 +82,7 @@ const ModifyEventType = {
|
|||||||
/**
|
/**
|
||||||
* @typedef {Object} SegmentData
|
* @typedef {Object} SegmentData
|
||||||
* @property {Array<number>} [depth] Depth.
|
* @property {Array<number>} [depth] Depth.
|
||||||
* @property {Feature} feature Feature.
|
* @property {import("../Feature").FeatureLike} feature Feature.
|
||||||
* @property {import("../geom/SimpleGeometry.js").default} geometry Geometry.
|
* @property {import("../geom/SimpleGeometry.js").default} geometry Geometry.
|
||||||
* @property {number} [index] Index.
|
* @property {number} [index] Index.
|
||||||
* @property {Array<Array<number>>} segment Segment.
|
* @property {Array<Array<number>>} segment Segment.
|
||||||
@@ -140,7 +140,7 @@ const ModifyEventType = {
|
|||||||
export class ModifyEvent extends Event {
|
export class ModifyEvent extends Event {
|
||||||
/**
|
/**
|
||||||
* @param {ModifyEventType} type Type.
|
* @param {ModifyEventType} type Type.
|
||||||
* @param {Collection<Feature>} features
|
* @param {Collection<import("../Feature").FeatureLike>} features
|
||||||
* The features modified.
|
* The features modified.
|
||||||
* @param {import("../MapBrowserEvent.js").default} MapBrowserEvent
|
* @param {import("../MapBrowserEvent.js").default} MapBrowserEvent
|
||||||
* Associated {@link module:ol/MapBrowserEvent}.
|
* Associated {@link module:ol/MapBrowserEvent}.
|
||||||
@@ -150,7 +150,7 @@ export class ModifyEvent extends Event {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The features being modified.
|
* The features being modified.
|
||||||
* @type {Collection<Feature>}
|
* @type {Collection<import("../Feature").FeatureLike>}
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
this.features = features;
|
this.features = features;
|
||||||
@@ -255,7 +255,7 @@ class Modify extends PointerInteraction {
|
|||||||
this.ignoreNextSingleClick_ = false;
|
this.ignoreNextSingleClick_ = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {Collection<Feature>}
|
* @type {Collection<import("../Feature").FeatureLike>}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.featuresBeingModified_ = null;
|
this.featuresBeingModified_ = null;
|
||||||
@@ -783,7 +783,7 @@ class Modify extends PointerInteraction {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import("../coordinate.js").Coordinate} coordinates Coordinates.
|
* @param {import("../coordinate.js").Coordinate} coordinates Coordinates.
|
||||||
* @param {Array<Feature>} features The features being modified.
|
* @param {Array<import("../Feature").FeatureLike>} features The features being modified.
|
||||||
* @param {Array<import("../geom/SimpleGeometry.js").default>} geometries The geometries being modified.
|
* @param {Array<import("../geom/SimpleGeometry.js").default>} geometries The geometries being modified.
|
||||||
* @return {Feature} Vertex feature.
|
* @return {Feature} Vertex feature.
|
||||||
* @private
|
* @private
|
||||||
@@ -1140,14 +1140,13 @@ class Modify extends PointerInteraction {
|
|||||||
geometry = geometry || feature.getGeometry();
|
geometry = geometry || feature.getGeometry();
|
||||||
if (
|
if (
|
||||||
geometry.getType() === GeometryType.POINT &&
|
geometry.getType() === GeometryType.POINT &&
|
||||||
geometry.getCoordinates && // Skip RenderFeature
|
|
||||||
includes(this.features_.getArray(), feature)
|
includes(this.features_.getArray(), feature)
|
||||||
) {
|
) {
|
||||||
hitPointGeometry = geometry;
|
hitPointGeometry = geometry;
|
||||||
const coordinate = geometry.getCoordinates();
|
const coordinate = geometry.getFlatCoordinates().slice(0, 2);
|
||||||
nodes = [
|
nodes = [
|
||||||
{
|
{
|
||||||
feature: /** @type {Feature} */ (feature),
|
feature,
|
||||||
geometry,
|
geometry,
|
||||||
segment: [coordinate, coordinate],
|
segment: [coordinate, coordinate],
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user