From d4eb9e7d6bc326a8efc069c25af2ee35ab87acc4 Mon Sep 17 00:00:00 2001 From: Jacek Kowalski <Jacek@jacekk.info> Date: Thu, 13 Apr 2017 08:00:59 +0000 Subject: [PATCH] Fix rotation --- map.html | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/map.html b/map.html index 0f16846..f8f23fb 100644 --- a/map.html +++ b/map.html @@ -196,7 +196,8 @@ stroke: new ol.style.Stroke({color: color_type, width: 2}), points: 3, radius: 12, - rotation: Math.PI * 2.0 * vehicle.heading / 360.0, + rotation: Math.PI * parseFloat(vehicle.heading) / 180.0, + rotateWithView: true, angle: 0 }), text: new ol.style.Text({ @@ -208,6 +209,7 @@ vehicles_source.addFeature(vehicle_feature); } else { vehicle_feature.setProperties(vehicle); + vehicle_feature.getStyle().getImage().setRotation(Math.PI * parseFloat(vehicle.heading) / 180.0); if(popup_feature_id == vehicle.id) { popup.setPosition(vehicle_feature.getGeometry().getCoordinates()); } -- Gitblit v1.9.1