Skip to content

Commit

Permalink
Refactor after review
Browse files Browse the repository at this point in the history
  • Loading branch information
louptheron committed Apr 2, 2024
1 parent a164950 commit 00fcc74
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions frontend/src/features/map/layers/styles/interestPoint.style.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,18 @@ export const getInterestPointStyle = (feature, resolution) => {
}

const style = interestPointStylesCache.get(type)
const scale = 1 / resolution ** (1 / 8) + 0.3
const verticalIconOffset = 18
style[0].getImage().setScale(scale)
style[0].getImage().setDisplacement([0, verticalIconOffset * scale])

const SCALE_BASE = 1 / 8 // Scale factor to reduce the size of the icon when dezooming
const SCALE_ADDITION = 0.3 // Minimum scale number
const VERTICAL_ICON_OFFSET = 18

const scale = 1 / resolution ** SCALE_BASE + SCALE_ADDITION
const verticalIconOffset = VERTICAL_ICON_OFFSET

const iconImage = style[0].getImage()

iconImage.setScale(scale)
iconImage.setDisplacement([0, verticalIconOffset * scale])

return style
}
Expand Down

0 comments on commit 00fcc74

Please sign in to comment.