Skip to content

Commit

Permalink
fix(visualization): set default zoom to cursor functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
IhsenBouallegue committed Nov 28, 2024
1 parent ac7d430 commit 2fdc6c6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
4 changes: 4 additions & 0 deletions visualization/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/)

## [unreleased] (Added 🚀 | Changed | Removed 🗑 | Fixed 🐞 | Chore 👨‍💻 👩‍💻)

### Fixed 🐞

- Set default scroll behaviour to zoom to cursor.

## [1.131.0] - 2024-11-28

### Added 🚀
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,17 +125,15 @@ export class ThreeMapControlsService {
MIDDLE: MOUSE.DOLLY,
RIGHT: MOUSE.PAN
}
this.controls.zoomToCursor = true

window.addEventListener("keydown", event => {
if (event.key === "Alt") {
this.controls.zoomToCursor = false
}
})
window.addEventListener("keyup", event => {
if (event.key === "Alt") {
this.controls.zoomToCursor = true
}
})
const updateZoomToCursor = (event: KeyboardEvent | MouseEvent) => {
this.controls.zoomToCursor = !event.altKey
}

window.addEventListener("keydown", updateZoomToCursor)
window.addEventListener("keyup", updateZoomToCursor)
window.addEventListener("mousemove", updateZoomToCursor)

this.controls.minPolarAngle = 0
this.controls.maxPolarAngle = Math.PI / 2
Expand Down

0 comments on commit 2fdc6c6

Please sign in to comment.