Skip to content

Commit

Permalink
Merge pull request #760 from hackforla/759-fix-zoom-by-distance-bug
Browse files Browse the repository at this point in the history
Fix zoom levels for Any, 100 or 500 radius
  • Loading branch information
entrotech authored Oct 27, 2020
2 parents a2f1de1 + 30ccc51 commit b86242c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
7 changes: 5 additions & 2 deletions client/src/components/Results/ResultsContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,20 @@ export default function ResultsContainer({
);

const viewPortHash = {
0: 4,
1: 13.5,
2: 12.5,
3: 12,
5: 11,
10: 10,
20: 9,
50: 8,
100: 7,
500: 4.5,
};

const [viewport, setViewport] = useState({
zoom: viewPortHash[radius],
zoom: viewPortHash[radius || 0],
latitude: origin.latitude || JSON.parse(storage.origin).latitude,
longitude: origin.longitude || JSON.parse(storage.origin).longitude,
logoPosition: "top-left",
Expand Down Expand Up @@ -182,7 +185,7 @@ export default function ResultsContainer({
storage.verified = JSON.stringify(isVerifiedSelected);
if (!center)
setViewport({
zoom: viewPortHash[radius],
zoom: viewPortHash[radius || 0],
latitude: origin.latitude,
longitude: origin.longitude,
});
Expand Down
14 changes: 8 additions & 6 deletions client/src/components/Stakeholder/StakeholderPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,14 @@ const StakeholderPreview = ({ stakeholder, doSelectStakeholder }) => {
>
<div className={classes.leftInfo}>
<Icon stakeholder={stakeholder} height="50px" width="50px" />
<div>
{stakeholder.distance >= 10
? stakeholder.distance.toString().substring(0, 3).padEnd(4, "0")
: stakeholder.distance.toString().substring(0, 3)}{" "}
mi
</div>
{stakeholder.distance ? (
<div>
{stakeholder.distance >= 10
? stakeholder.distance.toString().substring(0, 3).padEnd(4, "0")
: stakeholder.distance.toString().substring(0, 3)}{" "}
mi
</div>
) : null}
</div>
<div className={classes.info}>
<p className={classes.name}>{stakeholder.name}</p>
Expand Down

0 comments on commit b86242c

Please sign in to comment.