Skip to content

Commit

Permalink
Rotate map icon instead of view (#3668)
Browse files Browse the repository at this point in the history
  • Loading branch information
atomgomba authored Dec 12, 2023
1 parent c712da5 commit 8909ea9
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/js/tabs/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,11 @@ function processMapEvents(e) {

case 'center':
case 'centerMag':
const iconStyle = e.data.action == 'centerMag' ? iconStyleMag : iconStyleGPS;
iconFeature.setStyle(iconStyle);
const hasMag = e.data.action == 'centerMag';
(hasMag ? iconStyleMag : iconStyleGPS).getImage().setRotation(e.data.heading);
iconFeature.setStyle(hasMag ? iconStyleMag : iconStyleGPS);
const center = ol.proj.fromLonLat([e.data.lon, e.data.lat]);
mapView.setCenter(center);
// TODO - add rotation for the icon
// const heading = e.data.heading === undefined ? 0 : e.data.heading;
// mapView.setRotation(heading);
iconGeometry.setCoordinates(center);
break;

Expand Down

0 comments on commit 8909ea9

Please sign in to comment.