@@ -149,6 +149,11 @@ window.mapInterop = (() => {
149149 // Active tool name, kept in sync by setActiveTool so cursor handlers can check it.
150150 let activeTool = 'select' ;
151151
152+ // Radius (px) within which normally-hidden way-nodes are revealed so they can be snapped to.
153+ const PROXIMITY_PX = 20 ;
154+ // Base filter for layer-nodes; restored on mouseleave after proximity overrides.
155+ const BASE_NODE_FILTER = [ '==' , [ 'get' , 'show' ] , 'yes' ] ;
156+
152157 // Vector helpers (matching iD's geoVec* conventions).
153158 function vecSubtract ( a , b )
154159 {
@@ -1308,6 +1313,27 @@ window.mapInterop = (() => {
13081313 ) . catch ( console . error ) ;
13091314 } ) ;
13101315
1316+ // Proximity reveal: show normally-hidden way-nodes within PROXIMITY_PX of the cursor
1317+ // by temporarily widening the layer-nodes filter to include their IDs. Runs every
1318+ // mousemove (no debounce) so the reveal feels instant; map.setFilter is cheap.
1319+ map . on ( 'mousemove' , e => {
1320+ const hidden = ( sourceCache [ 'osm-nodes' ] ?. features ?? [ ] )
1321+ . filter ( f => f . properties ?. show === 'no' && f . geometry ?. type === 'Point' ) ;
1322+ const proximityIds = hidden
1323+ . filter ( f => {
1324+ const px = map . project ( f . geometry . coordinates ) ;
1325+ return Math . hypot ( px . x - e . point . x , px . y - e . point . y ) <= PROXIMITY_PX ;
1326+ } )
1327+ . map ( f => f . properties . id ) ;
1328+ const newFilter = proximityIds . length === 0
1329+ ? BASE_NODE_FILTER
1330+ : [ 'any' , BASE_NODE_FILTER , [ 'in' , [ 'get' , 'id' ] , [ 'literal' , proximityIds ] ] ] ;
1331+ if ( map . getLayer ( 'layer-nodes' ) )
1332+ {
1333+ map . setFilter ( 'layer-nodes' , newFilter ) ;
1334+ }
1335+ } ) ;
1336+
13111337 // Hover, debounced 16 ms. Only notifies .NET when the hovered element changes.
13121338 // Also handles draw-preview-line hover locally (no C# round-trip needed).
13131339 map . on ( 'mousemove' , e => {
@@ -1353,6 +1379,10 @@ window.mapInterop = (() => {
13531379 {
13541380 map . setLayoutProperty ( 'layer-draw-preview-hover' , 'visibility' , 'none' ) ;
13551381 }
1382+ if ( map . getLayer ( 'layer-nodes' ) )
1383+ {
1384+ map . setFilter ( 'layer-nodes' , BASE_NODE_FILTER ) ;
1385+ }
13561386 if ( dotnetRef && lastHoveredId !== null ) {
13571387 lastHoveredId = null ;
13581388 dotnetRef . invokeMethodAsync ( 'OnHover' , null ) . catch ( console . error ) ;
0 commit comments