Skip to content

Commit

Permalink
fix: dezoom on close fiche details (#473)
Browse files Browse the repository at this point in the history
  • Loading branch information
abelkhay committed Feb 20, 2024
1 parent cd03577 commit d3a350b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { AddressType } from '../../models';
const MIN_SEARCH_TERM_LENGTH: number = 3;
const SEARCH_DEBOUNCE_TIME: number = 300;

const setZoomUserPosition = (defaultUserPosition: number, distance?: number): number =>
export const setZoomUserPosition = (defaultUserPosition: number, distance?: number): number =>
distance ? (distance >= 50000 && distance <= 100000 ? 8 : 10) : defaultUserPosition;

const findAddressById = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {
import { ErreursReportForm, OrientationSheetForm, SendLieuByEmail } from '../../models';
import { emailMessage, reportErrorEmailMessage } from './lieux-mediation-numerique-details.presentation';
import { AbstractControl, FormControl, FormGroup } from '@angular/forms';
import { setZoomUserPosition } from '@features/adresse/components';

@Component({
changeDetection: ChangeDetectionStrategy.OnPush,
Expand Down Expand Up @@ -143,6 +144,11 @@ export class LieuxMediationNumeriqueDetailsPage {
queryParamsHandling: 'preserve'
}
);
if (lieu.localisation && !this._hasDepartementFilter)
this._markersPresenter.center(
lieu.localisation,
setZoomUserPosition(this._zoomLevel.userPosition, parseInt(this._route.snapshot.queryParams['distance']))
);
}

public onShowLabel(label: LabelNational) {
Expand Down

0 comments on commit d3a350b

Please sign in to comment.