Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: set the parcel coordinates for the browser #255

Merged
merged 3 commits into from
Oct 7, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 9 additions & 2 deletions components/Map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ export const GW_MAX_LAT = 22;
export const GW_MAX_LON = 23;
const ZOOM_QUERY_LEVEL = 8;
const QUERY_DIM = 1000;
export const LON_OFFSET = 0.00062;
export const LAT_OFFSET = 0.0001;

export enum STATE {
VIEWING = 0,
Expand Down Expand Up @@ -563,8 +565,8 @@ function Map(props: MapProps) {
setInteractionState(STATE.CLAIM_SELECTING);

flyToLocation({
longitude: event.lngLat.lng,
latitude: event.lngLat.lat,
longitude: event.lngLat.lng + LON_OFFSET,
latitude: event.lngLat.lat + LAT_OFFSET,
zoom: ZOOM_GRID_LEVEL + 1,
duration: 500,
});
Expand Down Expand Up @@ -646,6 +648,11 @@ function Map(props: MapProps) {
zoom: ZOOM_GRID_LEVEL + 1,
duration: 500,
});

setSelectedParcelCoords({
x: portfolioParcelCoords.lon - LON_OFFSET,
y: portfolioParcelCoords.lat - LAT_OFFSET,
});
}
}, [portfolioParcelCoords]);

Expand Down
16 changes: 9 additions & 7 deletions components/profile/ProfileModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,17 @@ import {
import { getETHBalance } from "../../lib/getBalance";
import { truncateStr, truncateEth } from "../../lib/truncate";
import { calculateBufferNeeded, calculateAuctionValue } from "../../lib/utils";
import { STATE, GeoPoint } from "../Map";
import {
STATE,
GeoPoint,
LON_OFFSET,
LAT_OFFSET,
} from "../Map";

dayjs.extend(utc);
dayjs.extend(timezone);
dayjs.extend(advancedFormat);

export const LON_OFFSET = 0.00085;
export const LAT_OFFSET = 0.0002;

type ProfileModalProps = {
accountTokenSnapshot: AccountTokenSnapshot;
account: string;
Expand Down Expand Up @@ -129,7 +131,7 @@ const portfolioQuery = gql`
contributionRate
}
coordinates {
pointTL {
pointTR {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have received feedback about the zoom not going to the center of the parcel. Is this an easy fix? Maybe we need to get two corners and find the center point?

Copy link
Collaborator Author

@tnrdd tnrdd Oct 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that when the sidebar is opened it shift right the parcel, it can be seen even when clicking on parcel, so to sort of center it an offset is added.
I think that to really center it accounting for all parcel sizes beside the offset we need to find the center point.
Does the coordinates array comes spatial ordered? If yes it should be easy to fix.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Nick's feedback focused on when you single-click on the map to start a land claim: the single yellow coordinate is offset to the right a bit (I assume because of the same panel shift). Seems like this single-coordinate centering should be pretty straight-forward? Lmk if you want to include that change here or if you want a separate ticket.

As for the parcel-level centering on zoom, that would definitely be nice to have too if possible.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that the offset constant was moved to the map in this PR I think we can include it here.

lon
lat
}
Expand Down Expand Up @@ -381,8 +383,8 @@ function ProfileModal(props: ProfileModalProps) {
buffer: buffer,
action: action,
coords: {
lon: Number(coords[0].pointTL.lon) + LON_OFFSET,
lat: Number(coords[0].pointTL.lat) + LAT_OFFSET,
lon: Number(coords[0].pointTR.lon) + LON_OFFSET,
lat: Number(coords[0].pointTR.lat) + LAT_OFFSET,
},
});
});
Expand Down