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 add center button and blue dot #40759

Merged
merged 39 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
be55619
fix add center button and blue dot
nkdengineer Apr 23, 2024
0a4b847
fix use util.getBounds
nkdengineer Apr 23, 2024
6093f69
fix update center button
nkdengineer Apr 24, 2024
e7420da
fix native issue
nkdengineer Apr 25, 2024
b7b9fbb
fix lint
nkdengineer Apr 25, 2024
a5ea387
fix lint
nkdengineer Apr 25, 2024
a218054
fix create blueDot color
nkdengineer Apr 25, 2024
b7a31bc
fix lint
nkdengineer Apr 25, 2024
f29e65b
fix only display center button if user interacted
nkdengineer Apr 26, 2024
f975e08
fix merge main
nkdengineer Apr 28, 2024
9754dce
fix using toggleCenterButton and related comment
nkdengineer Apr 30, 2024
ee0584b
fix type error
nkdengineer Apr 30, 2024
50208b8
fix blue dot radius
nkdengineer May 2, 2024
ee76e2e
Merge branch 'main' into fix/40209
nkdengineer May 2, 2024
3acd03f
fix hide center button if already centered
nkdengineer May 2, 2024
757865a
fix lint
nkdengineer May 2, 2024
f1de15d
fix fade in and out 300ms
nkdengineer May 3, 2024
d179015
fix remove inline style and rename function
nkdengineer May 3, 2024
1ff830a
fix merge main
nkdengineer May 8, 2024
eadb32a
fix lint
nkdengineer May 8, 2024
ee8cef6
fix using onTouchCancel instead of onTouchEnd
nkdengineer May 8, 2024
ee451b3
fix merge main
nkdengineer May 16, 2024
273741e
fix native issues
nkdengineer May 16, 2024
b253ae1
fix remove redundant logic
nkdengineer May 16, 2024
b12c374
fix merge main
nkdengineer May 20, 2024
aa487e7
fix compare two coordinates in web
nkdengineer May 21, 2024
6ee0862
fix lint
nkdengineer May 21, 2024
6c90e66
fix lint
nkdengineer May 21, 2024
b38b19f
fix always display center button
nkdengineer May 21, 2024
0688a0e
fix lint
nkdengineer May 21, 2024
e30eb90
fix remove maxZoom prop and change the default zoom value
nkdengineer May 23, 2024
76679ed
fix remove currentZoom variable
nkdengineer May 23, 2024
55f6535
fix merge main
nkdengineer May 24, 2024
0f09d6f
fix merge main
nkdengineer May 28, 2024
1732367
Merge branch 'main' into fix/40209
nkdengineer May 29, 2024
cc42428
fix lint
nkdengineer May 29, 2024
2d79bd8
fix lint
nkdengineer May 29, 2024
95591d9
fix add explaination about haversineDistance
nkdengineer Jun 3, 2024
3fe0372
fix haversineDistance: add new line
nkdengineer Jun 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/MapView/MapView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ const MapView = forwardRef<MapViewHandle, ComponentProps>(
<PressableWithoutFeedback
Copy link
Contributor

Choose a reason for hiding this comment

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

Coming from #43058. We missed adding hover and press effect on this button.

Copy link
Member

Choose a reason for hiding this comment

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

This is wrong. It was not part of the requirement. Design team approved this PR. So the mentioned issued is a new feature/change. @jjcoffee Could you please update the bug list to remove this PR?

Copy link
Contributor

Choose a reason for hiding this comment

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

We might have missed this but the @Expensify/design explicitly stated several times that we wanted this button behavior to match all of our other default buttons. Don't our default buttons all have a hover and press style?

Copy link
Member

Choose a reason for hiding this comment

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

Ok. I see. We were pushed to merge this quickly so it might be missed.

accessibilityRole={CONST.ROLE.BUTTON}
onPress={centerMap}
accessibilityLabel="Center"
accessibilityLabel={translate('common.center')}
>
<View style={styles.primaryMediumIcon}>
<Icon
Expand Down
2 changes: 1 addition & 1 deletion src/components/MapView/MapView.website.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ const MapView = forwardRef<MapViewHandle, ComponentProps>(
<PressableWithoutFeedback
accessibilityRole={CONST.ROLE.BUTTON}
onPress={centerMap}
accessibilityLabel="Center"
accessibilityLabel={translate('common.center')}
>
<View style={styles.primaryMediumIcon}>
<Icon
Expand Down
13 changes: 8 additions & 5 deletions src/components/MapView/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,24 @@ function getBounds(waypoints: Array<[number, number]>, directionCoordinates: und
};
}

/**
* Calculates the distance between two points on the Earth's surface given their latitude and longitude coordinates.
*/
function haversineDistance(coordinate1: number[], coordinate2: number[]) {
nkdengineer marked this conversation as resolved.
Show resolved Hide resolved
// Radius of the Earth in meters
const R = 6371e3;
const lat1 = (coordinate1[0] * Math.PI) / 180;
const lat2 = (coordinate2[0] * Math.PI) / 180;
const deltaLat = ((coordinate2[0] - coordinate1[0]) * Math.PI) / 180;
const deltaLon = ((coordinate2[1] - coordinate1[1]) * Math.PI) / 180;
// The square of half the chord length between the points
nkdengineer marked this conversation as resolved.
Show resolved Hide resolved
const halfChordLengthSq = Math.sin(deltaLat / 2) * Math.sin(deltaLat / 2) + Math.cos(lat1) * Math.cos(lat2) * Math.sin(deltaLon / 2) * Math.sin(deltaLon / 2);

const a = Math.sin(deltaLat / 2) * Math.sin(deltaLat / 2) + Math.cos(lat1) * Math.cos(lat2) * Math.sin(deltaLon / 2) * Math.sin(deltaLon / 2);

const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
// The angular distance in radians
const angularDistance = 2 * Math.atan2(Math.sqrt(halfChordLengthSq), Math.sqrt(1 - halfChordLengthSq));

// Distance in meters
const distance = R * c;
return distance;
return R * angularDistance;
}

function areSameCoordinate(coordinate1: number[], coordinate2: number[]) {
Expand Down
1 change: 1 addition & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ export default {
buttonConfirm: 'Got it',
name: 'Name',
attachment: 'Attachment',
center: 'Center',
from: 'From',
to: 'To',
optional: 'Optional',
Expand Down
1 change: 1 addition & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ export default {
to: 'A',
optional: 'Opcional',
new: 'Nuevo',
center: 'Centrar',
search: 'Buscar',
find: 'Encontrar',
searchWithThreeDots: 'Buscar...',
Expand Down
Loading