From ff7aafe0bbe6488308302c93cfcde19407a1aa3f Mon Sep 17 00:00:00 2001 From: eric1tran Date: Wed, 24 Feb 2021 16:34:57 +0000 Subject: [PATCH] Aircraft label styling --- public_html/planeObject.js | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/public_html/planeObject.js b/public_html/planeObject.js index eba84af..0907eb7 100644 --- a/public_html/planeObject.js +++ b/public_html/planeObject.js @@ -470,17 +470,17 @@ PlaneObject.prototype.updateIcon = function() { this.markerIcon = icon; - if (AircraftLabels) { + if (AircraftLabels && this.flight != null) { this.markerStyle = new ol.style.Style({ image: this.markerIcon, text: new ol.style.Text({ - text: this.flight, - fill: new ol.style.Fill({color: 'white' }), - stroke: new ol.style.Stroke({color: 'black', width: 3}), - textAlign: 'left', - textBaseline: "top", - offsetX: 20, - font: '12px sans-serif' + text: this.flight.trim(), + fill: new ol.style.Fill({color: 'white'}), + backgroundFill: new ol.style.Stroke({color: 'rgba(0, 47, 93, 0.8'}), + textAlign: 'center', + offsetY: -20, + font: '10px Helvetica', + padding: [1,0,0,2] }) }); } else { @@ -510,17 +510,17 @@ PlaneObject.prototype.updateIcon = function() { this.staticIcon.setOpacity(opacity); } - if (AircraftLabels) { + if (AircraftLabels && this.flight != null) { this.markerStyle = new ol.style.Style({ image: this.markerIcon, text: new ol.style.Text({ - text: this.flight, - fill: new ol.style.Fill({color: 'white' }), - stroke: new ol.style.Stroke({color: 'black', width: 3}), - textAlign: 'left', - textBaseline: "top", - offsetX: 20, - font: '12px sans-serif' + text: this.flight.trim(), + fill: new ol.style.Fill({color: 'white'}), + backgroundFill: new ol.style.Stroke({color: 'rgba(0, 47, 93, 0.8)'}), + textAlign: 'center', + offsetY: -20, + font: '10px Helvetica', + padding: [1,0,0,2] }) }); } else {