Search code examples
here-api

DomMarker blocks Polyline events underneath


I'm using HereMaps JS sdk 3.1.15.1

  1. I've created a Polyline
  2. i have created a DomMarker on pointermove event across the Polyline
  3. i update DomMarker's geometry with the event's coordinates
  4. DomMarker appears on the Polyline but when I continue to move the cursor, events on the Polyline below no longer fire

Is there a workaround? With goodle sdk you have "clickable" and "draggable" properties on the analog of DomMarker so events go through.


Solution

  • You can try using below code snippet.

    // enable the event system
    var behavior = new H.mapevents.Behavior(new H.mapevents.MapEvents(map)),
    
    //create the line
    line=new H.map.Polyline(new H.geo.Strip([ 52.5032, 13.2790,0,
                                              52.5102, 13.2818,0,
                                              52.5121, 13.3224,0,
                                              52.5145, 13.3487,0,
                                              52.5139, 13.3501,0,
                                              52.5146, 13.3515,0,
                                              52.5161, 13.3769,0])
                           );
    //draw the line
    map.addObject(line);
    
    //add tap-listener
    map.addEventListener('tap', function(e){
    
      var pointer = e.currentPointer,
          //create geo.Point
          latLng  = map.screenToGeo(pointer.viewportX, pointer.viewportY),
          //get current strip
          strip=line.getStrip();
    
      //push point to strip
      strip.pushPoint(latLng);
    
      //set updated strip
      line.setStrip(strip);
    });