diff --git a/app/components/map.gjs b/app/components/map.gjs index 869fa8a..2333f3c 100644 --- a/app/components/map.gjs +++ b/app/components/map.gjs @@ -61,7 +61,6 @@ export default class MapComponent extends Component { zIndex: 10, // Ensure it sits above the map tiles }); - // Default view settings let center = [99.05738, 7.55087]; let zoom = 13.0; @@ -95,7 +94,11 @@ export default class MapComponent extends Component { target: element, layers: [openfreemap, bookmarkLayer], view: view, - controls: defaultControls({ zoom: false, rotate: true, attribution: true }), + controls: defaultControls({ + zoom: false, + rotate: true, + attribution: true, + }), }); apply(this.mapInstance, 'https://tiles.openfreemap.org/styles/liberty'); @@ -210,7 +213,9 @@ export default class MapComponent extends Component { geolocation.un('change:position', zoomToLocation); locateListenerKey = null; } - } catch (e) { /* ignore */ } + } catch (e) { + /* ignore */ + } // Hide pulse if (this.locationOverlayElement) { @@ -261,7 +266,8 @@ export default class MapComponent extends Component { else if (accuracy) { const viewportWidthMeters = 6.325 * accuracy; const minDimensionPixels = Math.min(size[0], size[1]); - const requiredResolutionMeters = viewportWidthMeters / minDimensionPixels; + const requiredResolutionMeters = + viewportWidthMeters / minDimensionPixels; const metersPerMapUnit = getPointResolution( view.getProjection(), 1, @@ -443,23 +449,23 @@ export default class MapComponent extends Component { // If the pin is in the bottom half (y > splitPoint), it is obscured if (pixel[1] > splitPoint) { - // Target position: Center of top half = height * 0.25 - const targetY = height * 0.25; - const deltaY = pixel[1] - targetY; + // Target position: Center of top half = height * 0.25 + const targetY = height * 0.25; + const deltaY = pixel[1] - targetY; - const view = this.mapInstance.getView(); - const center = view.getCenter(); - const resolution = view.getResolution(); + const view = this.mapInstance.getView(); + const center = view.getCenter(); + const resolution = view.getResolution(); - // Move the map center SOUTH (decrease Y) to move the pin UP (decrease pixel Y) - const deltaMapUnits = deltaY * resolution; - const newCenter = [center[0], center[1] - deltaMapUnits]; + // Move the map center SOUTH (decrease Y) to move the pin UP (decrease pixel Y) + const deltaMapUnits = deltaY * resolution; + const newCenter = [center[0], center[1] - deltaMapUnits]; - view.animate({ - center: newCenter, - duration: 500, - easing: (t) => t * (2 - t) // Ease-out - }); + view.animate({ + center: newCenter, + duration: 500, + easing: (t) => t * (2 - t), // Ease-out + }); } } @@ -525,7 +531,7 @@ export default class MapComponent extends Component { const viewState = { center: currentCenter, - zoom: currentZoom + zoom: currentZoom, }; localStorage.setItem('marco:map-view', JSON.stringify(viewState)); @@ -545,7 +551,9 @@ export default class MapComponent extends Component { if (features && features.length > 0) { console.debug(`Found ${features.length} features in map layer:`); - for (const f of features) { console.debug(f) } + for (const f of features) { + console.debug(f); + } const bookmarkFeature = features.find((f) => f.get('isBookmark')); if (bookmarkFeature) { clickedBookmark = bookmarkFeature.get('originalPlace'); diff --git a/app/components/place-details.gjs b/app/components/place-details.gjs index cf0af21..ff11418 100644 --- a/app/components/place-details.gjs +++ b/app/components/place-details.gjs @@ -79,10 +79,10 @@ export default class PlaceDetails extends Component { get cuisine() { if (!this.tags.cuisine) return null; return this.tags.cuisine - .split(';') - .map(c => capitalize.compute([c])) - .map(c => c.replace('_', ' ')) - .join(', '); + .split(';') + .map((c) => capitalize.compute([c])) + .map((c) => c.replace('_', ' ')) + .join(', '); } get wikipedia() { @@ -123,17 +123,24 @@ export default class PlaceDetails extends Component {
{{#if this.place.description}}- {{this.place.description}} + {{this.place.description}}
{{/if}}Wikipedia: - Article + Article
{{/if}} diff --git a/app/components/places-sidebar.gjs b/app/components/places-sidebar.gjs index f431928..6fd2397 100644 --- a/app/components/places-sidebar.gjs +++ b/app/components/places-sidebar.gjs @@ -50,23 +50,23 @@ export default class PlacesSidebar extends Component { // Update selection to the new saved place object // This updates the local UI state immediately without a route refresh if (this.args.onUpdate) { - // When deleting, we revert to a "fresh" object or just close. - // Since we close the sidebar below, we might not strictly need to update local state, - // but it's good practice. - // Reconstruct the "original" place without ID/Geohash/CreatedAt - const freshPlace = { - ...place, - id: undefined, - geohash: undefined, - createdAt: undefined - }; - this.args.onUpdate(freshPlace); + // When deleting, we revert to a "fresh" object or just close. + // Since we close the sidebar below, we might not strictly need to update local state, + // but it's good practice. + // Reconstruct the "original" place without ID/Geohash/CreatedAt + const freshPlace = { + ...place, + id: undefined, + geohash: undefined, + createdAt: undefined, + }; + this.args.onUpdate(freshPlace); } - // Also fire onSelect if it exists (for list view) + // Also fire onSelect if it exists (for list view) if (this.args.onSelect) { - // Similar logic for select if needed, but we usually close. - this.args.onSelect(null); + // Similar logic for select if needed, but we usually close. + this.args.onSelect(null); } // Close sidebar after delete @@ -81,7 +81,8 @@ export default class PlacesSidebar extends Component { } else { // It's a fresh POI -> Save it const placeData = { - title: place.osmTags.name || place.osmTags['name:en'] || 'Untitled Place', + title: + place.osmTags.name || place.osmTags['name:en'] || 'Untitled Place', lat: place.lat, lon: place.lon, tags: [], @@ -128,11 +129,11 @@ export default class PlacesSidebar extends Component { {{else}}