Skip to content

Feat/routing marker drag - #926

Open
JoselinGuevaraHoppe wants to merge 2 commits into
nextfrom
feat/routing-marker-drag
Open

Feat/routing marker drag#926
JoselinGuevaraHoppe wants to merge 2 commits into
nextfrom
feat/routing-marker-drag

Conversation

@JoselinGuevaraHoppe

@JoselinGuevaraHoppe JoselinGuevaraHoppe commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add a dragging-feature to the markers of an existing route.

Instructions for local reproduction and review

  • add apiKey from HeiGit to PluginRouting in example/snowbox/index.js
  • select start and destination in the route plugin
  • select one of the markers and drag them to a new location on the map

@dopenguin
dopenguin changed the base branch from main to next August 10, 2026 11:51
@dopenguin dopenguin added the enhancement New feature or request label Aug 10, 2026
@dopenguin dopenguin added this to the POLAR@3 milestone Aug 10, 2026

@dopenguin dopenguin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should not be able to modify a feature while I am actively adding a new coordinate. It may also cause issues with other plugins. Please take a look at coreStore.maskInteraction and how this is handled for Draw in routing for both.

🏓 @JoselinGuevaraHoppe

Comment on lines +49 to +55
route.value = markerSource.getFeatures().map((feature) => {
const geometry = feature.getGeometry()
if (geometry instanceof Point) {
return geometry.getCoordinates()
}
return []
})

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has two issues

  • If I only have one input filled, the second (currently empty) input is removed. Only the modified feature / coordinate should be updated
  • If I enter both coordinates, then update the first feature, the coordinate in the second input gets updated as well. This should not be the case.

})
map.addInteraction(modify)

map.on('pointermove', function (evt) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be placed above addInteraction just like the modifyend-event-handler.

})
map.addInteraction(modify)

map.on('pointermove', function (evt) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A normal function may be usable here, but an arrow function should be favoured.

map.on('pointermove', function (evt) {
const pixel = map.getEventPixel(evt.originalEvent)
const hit = map.hasFeatureAtPixel(pixel)
map.getTargetElement().style.cursor = hit ? 'pointer' : ''

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cursor should rather be grab if the user is hovering a feature and grabbing while modifying the feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants