Skip to content

Commit

Permalink
[Point d'intérêt] L'icône des points placés est décalée par rapport à…
Browse files Browse the repository at this point in the history
… la position réelle (#3076)

## Linked issues

- Resolve #3074

----

- [ ] Tests E2E (Cypress)


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit


- **Refactor**
- Improved the calculation of scale and vertical icon offset for map
interest points for better visual alignment.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
louptheron committed Apr 2, 2024
2 parents 1e79353 + 00fcc74 commit fd0004c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion frontend/src/features/map/layers/styles/interestPoint.style.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,18 @@ export const getInterestPointStyle = (feature, resolution) => {
}

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

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 fd0004c

Please sign in to comment.