Skip to content
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
5 changes: 5 additions & 0 deletions src/HEREMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
animateCenter,
useVectorTiles,
engineType = H.Map.EngineType.HARP,
}, ref) => {

Check warning on line 96 in src/HEREMap.tsx

View workflow job for this annotation

GitHub Actions / lint

Refactor this function to reduce its Cognitive Complexity from 43 to the 15 allowed
if (engineType === H.Map.EngineType.WEBGL) {
throw new Error('WEBGL Engine is not supported.')
}
Expand Down Expand Up @@ -218,7 +218,7 @@
zoomOnMarkers,
zoomOnMarkersSet,
}
}, [map])

Check warning on line 221 in src/HEREMap.tsx

View workflow job for this annotation

GitHub Actions / lint

React Hook useImperativeHandle has missing dependencies: 'addToMarkerGroup', 'animateCenter', 'animateZoom', 'removeFromMarkerGroup', 'screenToGeo', 'zoomOnMarkers', and 'zoomOnMarkersSet'. Either include them or remove the dependency array

useEffect(() => {
if (unmountedRef.current) {
Expand All @@ -230,9 +230,14 @@
apikey: apiKey,
})

const ppi = engineType === H.Map.EngineType.P2D
? hidpi ? 320 : 72
: undefined

defaultLayersRef.current = platform.createDefaultLayers({
lg: getTileLanguage(language),
engineType,
ppi,
}) as DefaultLayers

const hereMapEl = document.querySelector(`#map-container-${uniqueIdRef.current}`) as HTMLElement
Expand Down Expand Up @@ -287,7 +292,7 @@
unmountedRef.current = true
map?.dispose()
}
}, [])

Check warning on line 295 in src/HEREMap.tsx

View workflow job for this annotation

GitHub Actions / lint

React Hook useEffect has missing dependencies: 'apiKey', 'center', 'disableMapSettings', 'engineType', 'hidpi', 'interactive', 'language', 'map', 'onMapAvailable', 'trafficLayer', 'useVectorTiles', and 'zoom'. Either include them or remove the dependency array. If 'onMapAvailable' changes too often, find the parent component that defines it and wrap that definition in useCallback

useEffect(() => {
if (map) {
Expand Down
2 changes: 1 addition & 1 deletion src/useLegacyRasterLayers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const getLayers = (
hidpi?: boolean,
) => {
const lang = getTileLanguage(language)
const ppi = hidpi ? 400 : 100
const ppi = hidpi ? 200 : 100
const format = 'png8'

const getTrafficOverlayProvider = (): H.map.provider.ImageTileProvider.Options => {
Expand Down
8 changes: 4 additions & 4 deletions src/useRasterLayers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const getBaseLayer = ({
const service = platform.getRasterTileService({
queryParams: {
lang,
ppi: hidpi ? 200 : 100,
scale: hidpi ? 2 : 1,
style: trafficLayer ? 'lite.day' : 'logistics.day',
...(congestion
? {
Expand All @@ -45,7 +45,7 @@ const getBaseLayer = ({
})

const provider =
new H.service.rasterTile.Provider(service, { engineType: H.Map.EngineType.HARP, tileSize: 256 })
new H.service.rasterTile.Provider(service, { engineType: H.Map.EngineType.HARP, tileSize: hidpi ? 512 : 256 })

return new H.map.layer.TileLayer(provider)
}
Expand All @@ -68,12 +68,12 @@ const getTruckOverlayLayer = ({
features: `vehicle_restrictions:${showActiveAndInactiveTruckRestrictions ? 'active_and_inactive' : 'permanent_only'}`,
style: 'logistics.day',
lang,
ppi: hidpi ? 200 : 100,
scale: hidpi ? 2 : 1,
},
})

const truckOverlayProvider =
new H.service.rasterTile.Provider(truckOnlyTileService, { engineType: H.Map.EngineType.HARP, tileSize: 256 })
new H.service.rasterTile.Provider(truckOnlyTileService, { engineType: H.Map.EngineType.HARP, tileSize: hidpi ? 512 : 256 })

return new H.map.layer.TileLayer(truckOverlayProvider)
}
Expand Down
3 changes: 3 additions & 0 deletions testbench/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0,user-scalable=0">
</head>
<body>
<div id="root" height="100%" width="100%"></div>
<script src="./index.tsx" type="module"></script>
Expand Down
Loading