@@ -360,30 +360,10 @@ function showClusterInfo(events, marker) {
360360/**
361361 * Shows detailed info for a specific event from a cluster
362362 * @param {number } eventIndex - Index of the event in the cluster
363- * @param {boolean } expandDetails - Whether to automatically expand details
364- * @param {object } marker - The marker to anchor the info window to (cluster marker)
365363 */
366- window . viewEventDetails = function ( eventIndex , expandDetails = false , marker = null ) {
367- if ( window . clusterEvents && window . clusterEvents [ eventIndex ] ) {
368- const event = window . clusterEvents [ eventIndex ] ;
369- const infoWindow = Events . infoWindow ( event , true ) ;
370- // Use the provided marker (cluster marker) or fallback to event marker
371- const anchorMarker = marker || event . marker ;
372-
373- // Automatically expand details if requested
374- if ( expandDetails ) {
375- // Wait for the info window to render, then open the details
376- setTimeout ( ( ) => {
377- const detailsElement = document . querySelector ( '.info-body details' ) ;
378- if ( detailsElement && ! detailsElement . open ) {
379- detailsElement . open = true ;
380- // Trigger the reposition
381- infoWindow . open ( window . map , anchorMarker ) ;
382- }
383- } , 100 ) ;
384- } else {
385- infoWindow . open ( window . map , anchorMarker ) ;
386- }
364+ window . viewEventDetails = function ( eventIndex ) {
365+ if ( window . clusterEvents ?. [ eventIndex ] ) {
366+ Events . infoWindow ( window . clusterEvents [ eventIndex ] , true ) ;
387367 }
388368} ;
389369
@@ -444,10 +424,10 @@ class Events {
444424 * Generates and returns a google maps info window
445425 *
446426 * @param {object } [event] - If passed, sets the content
447- * @param {boolean } [fromCluster] - If true, don't mutate the title
427+ * @param {boolean } [expanded]
448428 * @returns {google.maps.InfoWindow }
449429 */
450- static infoWindow ( event , fromCluster = false ) {
430+ static infoWindow ( event , expanded = false ) {
451431 if ( ! this . cachedInfoWindow )
452432 this . cachedInfoWindow = new google . maps . InfoWindow ( { } ) ;
453433 if ( event ) {
@@ -509,7 +489,7 @@ class Events {
509489 <p class="categories">Categories: ${ event . categories . map ( category => `<a onclick="filter({category:'${ category } '})">${ category } </a>` ) . join ( '' ) } </p>
510490 </div>
511491 <div class="info-body">
512- <details>
492+ <details ${ expanded ? 'open' : '' } >
513493 <summary>Expand Details</summary>
514494 <div id="details">
515495 ${ event . details }
@@ -519,8 +499,8 @@ class Events {
519499 `
520500 // Reposition after expanding
521501 content . querySelector ( 'details' ) . addEventListener ( 'toggle' , ( ) => {
522- // TODO: this is breaking calendar button
523- // this.cachedInfoWindow.open(window.map, event.marker );
502+ const { lat , lng } = this . cachedInfoWindow . getPosition ( ) ;
503+ window . map . panTo ( { lat : lat ( ) + 0.05 , lng : lng ( ) } ) ;
524504 } )
525505 this . cachedInfoWindow . setContent ( content ) ;
526506 }
0 commit comments