Skip to content

Commit

Permalink
chore: minor code cleanup, add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
fredj committed Mar 13, 2024
1 parent c29b179 commit 3901b9f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
11 changes: 3 additions & 8 deletions src/interaction/TrackInteractionModify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,9 @@ export default class Modify extends PointerInteraction {
type: 'segment'
});
private overlay_: VectorLayer<VectorSource<Feature>>;
private lastPixel_ = [0, 0];
private lastPixel_: Pixel = [0, 0];
private trackData_: Options['trackData'];
/**
* @type {Feature<Point>}
*/
private pointAtCursorFeature_ = new Feature({
private pointAtCursorFeature_ = new Feature<Point>({
geometry: new Point([0, 0]),
type: 'sketch',
subtype: '',
Expand Down Expand Up @@ -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<LineString|Point>|undefined}
*/
getFeatureAtPixel(pixel: Pixel): Feature<LineString|Point|undefined> {
getFeatureAtPixel(pixel: Pixel): Feature<LineString|Point> {
const features = this.getMap().getFeaturesAtPixel(pixel, {
layerFilter: (l) => l.getSource() === this.source_,
hitTolerance: this.hitTolerance_
Expand Down
4 changes: 3 additions & 1 deletion src/interaction/TrackManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export default class TrackManager<POIMeta> {
// }));



// 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) => {
Expand Down Expand Up @@ -168,6 +168,7 @@ export default class TrackManager<POIMeta> {
}
});

// Move an existing poi, control point or segment
this.interaction_.on(
// @ts-ignore too complicate to declare proper events
'modifyend',
Expand Down Expand Up @@ -209,6 +210,7 @@ export default class TrackManager<POIMeta> {
}
});

// Delete a control point or a POI
this.interaction_.on(
// @ts-ignore too complicate to declare proper events
'select',
Expand Down

0 comments on commit 3901b9f

Please sign in to comment.