From 3901b9f5a455136b3e0448ad81e384fc15f052a0 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Wed, 13 Mar 2024 11:00:54 +0100 Subject: [PATCH] chore: minor code cleanup, add comments --- src/interaction/TrackInteractionModify.ts | 11 +++-------- src/interaction/TrackManager.ts | 4 +++- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/interaction/TrackInteractionModify.ts b/src/interaction/TrackInteractionModify.ts index 68e424bd..de8e00da 100644 --- a/src/interaction/TrackInteractionModify.ts +++ b/src/interaction/TrackInteractionModify.ts @@ -64,12 +64,9 @@ export default class Modify extends PointerInteraction { type: 'segment' }); private overlay_: VectorLayer>; - private lastPixel_ = [0, 0]; + private lastPixel_: Pixel = [0, 0]; private trackData_: Options['trackData']; - /** - * @type {Feature} - */ - private pointAtCursorFeature_ = new Feature({ + private pointAtCursorFeature_ = new Feature({ geometry: new Point([0, 0]), type: 'sketch', subtype: '', @@ -126,10 +123,8 @@ export default class Modify extends PointerInteraction { /** * Get the first feature at pixel, favor points over lines - * @param {import("ol/pixel").Pixel} pixel - * @return {Feature|undefined} */ - getFeatureAtPixel(pixel: Pixel): Feature { + getFeatureAtPixel(pixel: Pixel): Feature { const features = this.getMap().getFeaturesAtPixel(pixel, { layerFilter: (l) => l.getSource() === this.source_, hitTolerance: this.hitTolerance_ diff --git a/src/interaction/TrackManager.ts b/src/interaction/TrackManager.ts index 3b258bd1..7838dbd9 100644 --- a/src/interaction/TrackManager.ts +++ b/src/interaction/TrackManager.ts @@ -122,7 +122,7 @@ export default class TrackManager { // })); - + // Add a control point at the end of the track // @ts-ignore too complicate to declare proper events this.interaction_.on('drawend', async (event: DrawEvent) => { @@ -168,6 +168,7 @@ export default class TrackManager { } }); + // Move an existing poi, control point or segment this.interaction_.on( // @ts-ignore too complicate to declare proper events 'modifyend', @@ -209,6 +210,7 @@ export default class TrackManager { } }); + // Delete a control point or a POI this.interaction_.on( // @ts-ignore too complicate to declare proper events 'select',