Formatting

This commit is contained in:
2026-02-20 12:38:57 +04:00
parent 2aa59f9384
commit 2734f08608
3 changed files with 31 additions and 25 deletions

View File

@@ -155,9 +155,6 @@ export default class MapComponent extends Component {
`; `;
element.appendChild(this.crosshairElement); element.appendChild(this.crosshairElement);
// Geolocation Pulse Overlay // Geolocation Pulse Overlay
this.locationOverlayElement = document.createElement('div'); this.locationOverlayElement = document.createElement('div');
this.locationOverlayElement.className = 'search-pulse blue'; this.locationOverlayElement.className = 'search-pulse blue';
@@ -311,7 +308,7 @@ export default class MapComponent extends Component {
}; };
const startLocating = () => { const startLocating = () => {
console.debug('Getting current geolocation...') console.debug('Getting current geolocation...');
// 1. Clear any previous session // 1. Clear any previous session
stopLocating(); stopLocating();
@@ -374,11 +371,15 @@ export default class MapComponent extends Component {
if (!this.mapInstance) return; if (!this.mapInstance) return;
// Remove existing DragPan interactions // Remove existing DragPan interactions
this.mapInstance.getInteractions().getArray().slice().forEach((interaction) => { this.mapInstance
if (interaction instanceof DragPan) { .getInteractions()
this.mapInstance.removeInteraction(interaction); .getArray()
} .slice()
}); .forEach((interaction) => {
if (interaction instanceof DragPan) {
this.mapInstance.removeInteraction(interaction);
}
});
// Add new DragPan with current setting // Add new DragPan with current setting
const kinetic = this.settings.mapKinetic const kinetic = this.settings.mapKinetic
@@ -652,10 +653,15 @@ export default class MapComponent extends Component {
const mapRect = this.mapInstance.getTargetElement().getBoundingClientRect(); const mapRect = this.mapInstance.getTargetElement().getBoundingClientRect();
const crosshairRect = this.crosshairElement.getBoundingClientRect(); const crosshairRect = this.crosshairElement.getBoundingClientRect();
const centerX = crosshairRect.left + crosshairRect.width / 2 - mapRect.left; const centerX =
const centerY = crosshairRect.top + crosshairRect.height / 2 - mapRect.top; crosshairRect.left + crosshairRect.width / 2 - mapRect.left;
const centerY =
crosshairRect.top + crosshairRect.height / 2 - mapRect.top;
const coordinate = this.mapInstance.getCoordinateFromPixel([centerX, centerY]); const coordinate = this.mapInstance.getCoordinateFromPixel([
centerX,
centerY,
]);
const center = toLonLat(coordinate); const center = toLonLat(coordinate);
const lat = parseFloat(center[1].toFixed(6)); const lat = parseFloat(center[1].toFixed(6));

View File

@@ -21,11 +21,7 @@ export default class PlaceDetails extends Component {
} }
get name() { get name() {
return ( return this.place.title || getLocalizedName(this.tags) || 'Unnamed Place';
this.place.title ||
getLocalizedName(this.tags) ||
'Unnamed Place'
);
} }
@action @action
@@ -274,7 +270,11 @@ export default class PlaceDetails extends Component {
<p class="content-with-icon"> <p class="content-with-icon">
<Icon @name="map" /> <Icon @name="map" />
<span> <span>
<a href={{this.gmapsUrl}} target="_blank" rel="noopener noreferrer"> <a
href={{this.gmapsUrl}}
target="_blank"
rel="noopener noreferrer"
>
Google Maps Google Maps
</a> </a>
</span> </span>

View File

@@ -17,8 +17,8 @@ export default class ApplicationComponent extends Component {
@tracked isSettingsOpen = false; @tracked isSettingsOpen = false;
get isSidebarOpen() { get isSidebarOpen() {
// We consider the sidebar "open" if we are in search or place routes. // We consider the sidebar "open" if we are in search or place routes.
// This helps the map know if it should shift the center or adjust view. // This helps the map know if it should shift the center or adjust view.
return ( return (
this.router.currentRouteName === 'place' || this.router.currentRouteName === 'place' ||
this.router.currentRouteName === 'place.new' || this.router.currentRouteName === 'place.new' ||
@@ -48,12 +48,12 @@ export default class ApplicationComponent extends Component {
if (this.isSettingsOpen) { if (this.isSettingsOpen) {
this.closeSettings(); this.closeSettings();
} else if (this.router.currentRouteName === 'search') { } else if (this.router.currentRouteName === 'search') {
this.router.transitionTo('index'); this.router.transitionTo('index');
} else if (this.router.currentRouteName === 'place') { } else if (this.router.currentRouteName === 'place') {
// If in place route, decide if we want to go back to search or index // If in place route, decide if we want to go back to search or index
// For now, let's go to index or maybe back to search if search params exist? // For now, let's go to index or maybe back to search if search params exist?
// Simplest behavior: clear selection // Simplest behavior: clear selection
this.router.transitionTo('index'); this.router.transitionTo('index');
} }
} }