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: round compass margins and attribution position to nearest integers [android] #294

Merged
merged 5 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
99 changes: 51 additions & 48 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ Please add unreleased changes in the following style:
PR Title ([#123](link to my pr))
```

fix: round compass margins and attribution position to nearest integers [android] ([#294](https://github.com/maplibre/maplibre-react-native/pull/294))

## 10.0.0-alpha.5
Fix: [remove AbortController test mock](https://github.com/maplibre/maplibre-react-native/pull/403)
Fix: [ExpoPlugin after Class renaming](thttps://github.com/maplibre/maplibre-react-native/pull/405)
Fix: [android example crashing](https://github.com/maplibre/maplibre-react-native/pull/372) on launch

## 10.0.0-alpha.4

Update maplibre-native to use [new metal renderer on iOS](https://github.com/maplibre/maplibre-native/releases/tag/ios-v6.4.0)

## 10.0.0-alpha.3
Expand Down Expand Up @@ -62,54 +65,54 @@ fix(iOS): correct import of UIView+React.h header ([#1672](https://github.com/rn

## 8.5.0

build: update install guide and `/example` project for android dependencies ([#1640](https://github.com/rnmapbox/maps/pull/1640))
build(turf): update to version 6.5.0 ([#1638](https://github.com/rnmapbox/maps/pull/1638))
fix(Camera) fix `zoomTo` method and expand Fit example ([#1631](https://github.com/rnmapbox/maps/pull/1631))
ci: two scripts for linting with and without fix ([#1630](https://github.com/rnmapbox/maps/pull/1630))
feat(Camera) add an optional `allowUpdates` boolean prop ([#1619](https://github.com/rnmapbox/maps/pull/1619))
refactor(example): remove unused modules and scripts ([#1618](https://github.com/rnmapbox/maps/pull/1618))
fix(react-native): update api to get rid of EventEmitter warnings ([#1615](https://github.com/rnmapbox/maps/pull/1615))
fix(Camera) persist zoom when changing from `bounds` to `centerCoordinate`, fix zero padding not causing map to update, create unified example showcasing bounds/centerCoordinate/zoom/padding ([#1614](https://github.com/rnmapbox/maps/pull/1614))
Update MapLibre to 5.12.1 on iOS ([#1596](https://github.com/rnmapbox/maps/pull/1596))
build: update install guide and `/example` project for android dependencies ([#1640](https://github.com/rnmapbox/maps/pull/1640))
build(turf): update to version 6.5.0 ([#1638](https://github.com/rnmapbox/maps/pull/1638))
fix(Camera) fix `zoomTo` method and expand Fit example ([#1631](https://github.com/rnmapbox/maps/pull/1631))
ci: two scripts for linting with and without fix ([#1630](https://github.com/rnmapbox/maps/pull/1630))
feat(Camera) add an optional `allowUpdates` boolean prop ([#1619](https://github.com/rnmapbox/maps/pull/1619))
refactor(example): remove unused modules and scripts ([#1618](https://github.com/rnmapbox/maps/pull/1618))
fix(react-native): update api to get rid of EventEmitter warnings ([#1615](https://github.com/rnmapbox/maps/pull/1615))
fix(Camera) persist zoom when changing from `bounds` to `centerCoordinate`, fix zero padding not causing map to update, create unified example showcasing bounds/centerCoordinate/zoom/padding ([#1614](https://github.com/rnmapbox/maps/pull/1614))
Update MapLibre to 5.12.1 on iOS ([#1596](https://github.com/rnmapbox/maps/pull/1596))
Update ShapeSource methods to make it usable with any cluster ( Use cluster itself instead of cluster_id as first argument for getClusterExpansionZoom/getClusterLeaves/getClusterChildren methods. Version < 9 methods still supports passing cluster_id as a first argument but a deprecation warning will be shown. ) ([#1499](https://github.com/rnmapbox/maps/pull/1499))

---

## 8.4.0

fix(iOS): pin mapLibre back to `5.12.0` ([#1589](https://github.com/rnmapbox/maps/pull/1589))
chore: improve GH workflows ([#1588](https://github.com/rnmapbox/maps/pull/1588))
build(deps): bump @expo/config-plugins from 3.1.0 to 4.0.3 ([#1585](https://github.com/rnmapbox/maps/pull/1585))
chore(pre-commit): run lint on TS files, change PR template ([#1584](https://github.com/rnmapbox/maps/pull/1584))
feat(example): update vertical alignment example ([#1579](https://github.com/rnmapbox/maps/pull/1579))
fix incorrect anchor calculation for PointAnnotation on iOS ([#1576](https://github.com/rnmapbox/maps/pull/1576))
style(eslint): align root and example with the same configuration ([#1575](https://github.com/rnmapbox/maps/pull/1575))
fix(mapLibre): support version `5.12.0` upwards ([#1571](https://github.com/rnmapbox/maps/pull/1571))
build: upgrade to RN `0.66` ([#1570](https://github.com/rnmapbox/maps/pull/1570))
build(android): add telemetry dependency to default build setup ([#1550](https://github.com/rnmapbox/maps/pull/1550))
feat(camera): Enable `padding` as a root-level prop on the camera, with `bounds.padding*` as fallbacks ([#1538](https://github.com/rnmapbox/maps/pull/1538/files))
fix(iOS): pin mapLibre back to `5.12.0` ([#1589](https://github.com/rnmapbox/maps/pull/1589))
chore: improve GH workflows ([#1588](https://github.com/rnmapbox/maps/pull/1588))
build(deps): bump @expo/config-plugins from 3.1.0 to 4.0.3 ([#1585](https://github.com/rnmapbox/maps/pull/1585))
chore(pre-commit): run lint on TS files, change PR template ([#1584](https://github.com/rnmapbox/maps/pull/1584))
feat(example): update vertical alignment example ([#1579](https://github.com/rnmapbox/maps/pull/1579))
fix incorrect anchor calculation for PointAnnotation on iOS ([#1576](https://github.com/rnmapbox/maps/pull/1576))
style(eslint): align root and example with the same configuration ([#1575](https://github.com/rnmapbox/maps/pull/1575))
fix(mapLibre): support version `5.12.0` upwards ([#1571](https://github.com/rnmapbox/maps/pull/1571))
build: upgrade to RN `0.66` ([#1570](https://github.com/rnmapbox/maps/pull/1570))
build(android): add telemetry dependency to default build setup ([#1550](https://github.com/rnmapbox/maps/pull/1550))
feat(camera): Enable `padding` as a root-level prop on the camera, with `bounds.padding*` as fallbacks ([#1538](https://github.com/rnmapbox/maps/pull/1538/files))
fix: revert pinned mapLibre version to `5.11.0` ([8a2b00e67ba6398f3f6e6f52e98b0f0cea437e4d](https://github.com/rnmapbox/maps/commit/8a2b00e67ba6398f3f6e6f52e98b0f0cea437e4d))

---

## 8.3.0

Fix TypeScript type for Callout's textStyle prop ([#1450](https://github.com/rnmapbox/maps/pull/1450))
Build(ios): pin maplibre version to 5.12.0 ([#1454](https://github.com/rnmapbox/maps/pull/1454))
Update geoUtils helpers types to correspond with `turf/helpers` ([#1455](https://github.com/rnmapbox/maps/pull/1455))
Fix crash with missing okhttp dependency ([#1452](https://github.com/rnmapbox/maps/pull/1452))
Move from react-native-testing-library => @testing-library/react-native ([#1453](https://github.com/rnmapbox/maps/pull/1453))
Feat(camera): maxBounds/(min|max)ZoomLevel can be updated dynamically ([#1462](https://github.com/rnmapbox/maps/pull/1462))
Refactor(example): clean up folder structure ([#1464](https://github.com/rnmapbox/maps/pull/1464))
Fix lineGradient showing wrong colors ([#1471](https://github.com/rnmapbox/maps/pull/1471))
Support tintColor on Android ([#1465](https://github.com/rnmapbox/maps/pull/1465))
Feat(android): dynamically update tintColor & add example ([#1469](https://github.com/rnmapbox/maps/pull/1469)
Examples: align install steps with yarn, ignore created env files ([#1484](https://github.com/rnmapbox/maps/pull/1484)
Fix(plugin): Exclude arm64 architectures for simulator builds ([#1490](https://github.com/rnmapbox/maps/pull/1490)
Feat(android): dynamically update tintColor & add example ([#1469](https://github.com/rnmapbox/maps/pull/1469))
Docs: make background in example pngs transparent ([#1483](https://github.com/rnmapbox/maps/pull/1483))
Style: run yarn lint ([#1486](https://github.com/rnmapbox/maps/pull/1486))
Test: add unit tests for component light ([#1489](https://github.com/rnmapbox/maps/pull/1489))
Fix TypeScript type for Callout's textStyle prop ([#1450](https://github.com/rnmapbox/maps/pull/1450))
Build(ios): pin maplibre version to 5.12.0 ([#1454](https://github.com/rnmapbox/maps/pull/1454))
Update geoUtils helpers types to correspond with `turf/helpers` ([#1455](https://github.com/rnmapbox/maps/pull/1455))
Fix crash with missing okhttp dependency ([#1452](https://github.com/rnmapbox/maps/pull/1452))
Move from react-native-testing-library => @testing-library/react-native ([#1453](https://github.com/rnmapbox/maps/pull/1453))
Feat(camera): maxBounds/(min|max)ZoomLevel can be updated dynamically ([#1462](https://github.com/rnmapbox/maps/pull/1462))
Refactor(example): clean up folder structure ([#1464](https://github.com/rnmapbox/maps/pull/1464))
Fix lineGradient showing wrong colors ([#1471](https://github.com/rnmapbox/maps/pull/1471))
Support tintColor on Android ([#1465](https://github.com/rnmapbox/maps/pull/1465))
Feat(android): dynamically update tintColor & add example ([#1469](https://github.com/rnmapbox/maps/pull/1469)
Examples: align install steps with yarn, ignore created env files ([#1484](https://github.com/rnmapbox/maps/pull/1484)
Fix(plugin): Exclude arm64 architectures for simulator builds ([#1490](https://github.com/rnmapbox/maps/pull/1490)
Feat(android): dynamically update tintColor & add example ([#1469](https://github.com/rnmapbox/maps/pull/1469))
Docs: make background in example pngs transparent ([#1483](https://github.com/rnmapbox/maps/pull/1483))
Style: run yarn lint ([#1486](https://github.com/rnmapbox/maps/pull/1486))
Test: add unit tests for component light ([#1489](https://github.com/rnmapbox/maps/pull/1489))
Feat: add Adds getClusterChildren method to ShapeSource ([#1495](https://github.com/rnmapbox/maps/pull/1495))

## 8.2.1
Expand All @@ -118,22 +121,22 @@ fix issue when publishing to npm with `prepare` script

## 8.2.0

getClusterLeaves method for ShapeSource ([#1411](https://github.com/rnmapbox/maps/pull/1411))
Add logoPosition props to `MapView` to position the mapbox logo ([#1396](https://github.com/rnmapbox/maps/pull/1396))
Add compatibility with React 17/ npm7 ([#1387](https://github.com/rnmapbox/maps/pull/1387))
Add Expo config plugin ([#1388](https://github.com/rnmapbox/maps/pull/1388))
Android: Bump `okhttp` to `4.9.0` ([#1390](https://github.com/rnmapbox/maps/pull/1390))
Support dynamically changing local JSON in styleURL ([#1399](https://github.com/rnmapbox/maps/pull/1399))
Add missing types to `SymbolLayerStyle` & `ImagesProps` ([#1360](https://github.com/rnmapbox/maps/pull/1360))
getClusterLeaves method for ShapeSource ([#1411](https://github.com/rnmapbox/maps/pull/1411))
Add logoPosition props to `MapView` to position the mapbox logo ([#1396](https://github.com/rnmapbox/maps/pull/1396))
Add compatibility with React 17/ npm7 ([#1387](https://github.com/rnmapbox/maps/pull/1387))
Add Expo config plugin ([#1388](https://github.com/rnmapbox/maps/pull/1388))
Android: Bump `okhttp` to `4.9.0` ([#1390](https://github.com/rnmapbox/maps/pull/1390))
Support dynamically changing local JSON in styleURL ([#1399](https://github.com/rnmapbox/maps/pull/1399))
Add missing types to `SymbolLayerStyle` & `ImagesProps` ([#1360](https://github.com/rnmapbox/maps/pull/1360))
Fix error while updating coordinates of RCTMGLImageSource ([#1310](https://github.com/rnmapbox/maps/pull/1310))

## 8.2.0-beta2

Add types for `Logger` class ([#1316](https://github.com/rnmapbox/maps/pull/1316))
Enable linear easing on map camera ([#1281](https://github.com/rnmapbox/maps/pull/1281))
Allow MapLibre as an option ([#1311](https://github.com/rnmapbox/maps/pull/1311))
Fix native UserLocation on Android ([#1284](https://github.com/rnmapbox/maps/pull/1284))
Add getClusterExpansionZoom to ShapeSource ([#1279](https://github.com/rnmapbox/maps/pull/1279))
Add types for `Logger` class ([#1316](https://github.com/rnmapbox/maps/pull/1316))
Enable linear easing on map camera ([#1281](https://github.com/rnmapbox/maps/pull/1281))
Allow MapLibre as an option ([#1311](https://github.com/rnmapbox/maps/pull/1311))
Fix native UserLocation on Android ([#1284](https://github.com/rnmapbox/maps/pull/1284))
Add getClusterExpansionZoom to ShapeSource ([#1279](https://github.com/rnmapbox/maps/pull/1279))
Add type definition for AnimatedPoint ([#1280](https://github.com/rnmapbox/maps/pull/1280))

## 8.2.0-beta1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -925,10 +925,10 @@ public void setReactAttributionPosition(ReadableMap position) {
}
float density = getDisplayDensity();
mAttributionMargin = new int[]{
position.hasKey("left") ? (int) density * position.getInt("left") : 0,
position.hasKey("top") ? (int) density * position.getInt("top") : 0,
position.hasKey("right") ? (int) density * position.getInt("right") : 0,
position.hasKey("bottom") ? (int) density * position.getInt("bottom") : 0
position.hasKey("left") ? Math.round(density * position.getInt("left")) : 0,
position.hasKey("top") ? Math.round(density * position.getInt("top")) : 0,
position.hasKey("right") ? Math.round(density * position.getInt("right")) : 0,
position.hasKey("bottom") ? Math.round(density * position.getInt("bottom")) : 0
};
updateUISettings();
}
Expand Down Expand Up @@ -1181,10 +1181,10 @@ private void updateUISettings() {
}

if (mCompassViewMargins != null && uiSettings.isCompassEnabled()) {
int pixelDensity = (int)getResources().getDisplayMetrics().density;
float pixelDensity = getResources().getDisplayMetrics().density;

int x = mCompassViewMargins.getInt("x") * pixelDensity;
int y = mCompassViewMargins.getInt("y") * pixelDensity;
int x = Math.round(mCompassViewMargins.getInt("x") * pixelDensity);
int y = Math.round(mCompassViewMargins.getInt("y") * pixelDensity);

switch (uiSettings.getCompassGravity()) {
case Gravity.TOP | Gravity.START:
Expand Down
Loading