11import { DataTableStorage , FilterManager } from "../filters" ;
2- import { pointToLineDistance , point , lineString } from "../../libraries/turf" ;
2+ import { pointToLineDistance , point , lineString } from "../../libraries/turf" ;
33
44class HeatmapDrawer {
55 constructor ( wrapper , config , modalManager ) {
@@ -31,18 +31,7 @@ class HeatmapDrawer {
3131 }
3232 this . map . on ( "click" , ( e ) => this . _handleMapClick ( e ) ) ;
3333 this . map . on ( "popupclose" , ( ) => this . _resetRouteStyles ( ) ) ;
34- this . map . on ( "popupopen" , ( ev ) => {
35- const container = ev . popup . getElement ( ) ;
36- if ( ! container ) return ;
37-
38- container . querySelectorAll ( 'a[data-model-content-url]' ) . forEach ( node => {
39- node . addEventListener ( "click" , ( e ) => {
40- e . preventDefault ( ) ;
41- e . stopPropagation ( ) ;
42- this . modalManager . open ( node . getAttribute ( 'data-model-content-url' ) ) ;
43- } ) ;
44- } ) ;
45- } ) ;
34+ this . map . on ( "popupopen" , ( e ) => this . _handlePopupOpen ( e ) ) ;
4635 }
4736
4837 _resetRouteStyles ( ) {
@@ -51,6 +40,19 @@ class HeatmapDrawer {
5140 } ) ;
5241 }
5342
43+ _handlePopupOpen ( e ) {
44+ const container = e . popup . getElement ( ) ;
45+ if ( ! container ) return ;
46+
47+ container . querySelectorAll ( 'a[data-model-content-url]' ) . forEach ( node => {
48+ node . addEventListener ( "click" , ( e ) => {
49+ e . preventDefault ( ) ;
50+ e . stopPropagation ( ) ;
51+ this . modalManager . open ( node . getAttribute ( 'data-model-content-url' ) ) ;
52+ } ) ;
53+ } ) ;
54+ } ;
55+
5456 _handleMapClick ( e ) {
5557 const clickPoint = point ( [ e . latlng . lng , e . latlng . lat ] ) ;
5658 const NEARBY_DISTANCE_IN_METERS = 100 ;
@@ -84,7 +86,10 @@ class HeatmapDrawer {
8486 <ul class="divide-default divide-y divide-gray-200">
8587 ${ nearby . map ( entry => `
8688 <li class="py-2">
87- <a href="#" class="block truncate font-medium text-blue-600 hover:underline" data-model-content-url="/activity/${ entry . route . id } .html"> ${ entry . route . name } </a>
89+ <a href="#" title="${ entry . route . name } " class="block truncate font-medium text-blue-600 hover:underline"
90+ data-model-content-url="/activity/${ entry . route . id } .html">
91+ ${ entry . route . name }
92+ </a>
8893 <div class="flex items-center justify-between text-xs text-gray-500">
8994 <div>${ entry . route . startDate } </div>
9095 <div>${ entry . route . distance } </div>
0 commit comments