From 6b0d003319502884ba83e2610bf9092c8ea7802e Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sat, 28 May 2016 09:35:34 +0200 Subject: [PATCH] Use characters instead of CSS transform to display arrows --- .../webpages/weather/wettercom/WetterComTrigger.kt | 7 +------ .../webpages/weather/wettercom/WindDirection.kt | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/main/kotlin/net/pterodactylus/rhynodge/webpages/weather/wettercom/WetterComTrigger.kt b/src/main/kotlin/net/pterodactylus/rhynodge/webpages/weather/wettercom/WetterComTrigger.kt index 8a2f62b..c671dc0 100644 --- a/src/main/kotlin/net/pterodactylus/rhynodge/webpages/weather/wettercom/WetterComTrigger.kt +++ b/src/main/kotlin/net/pterodactylus/rhynodge/webpages/weather/wettercom/WetterComTrigger.kt @@ -65,12 +65,7 @@ class WetterComTrigger : Trigger { div("temperature") { +"%d °C".format(it.temperature.toInt()) } div("rain-probability") { +"%d%%".format((it.rainProbability * 100).toInt()) } div("rain-amount") { +"%d l/m²".format(it.rainAmount.toInt()) } - div("wind-direction") { - div { - attributes += "style" to "padding: none; transform: rotate(%ddeg)".format(180 - it.windDirection.degrees) - +"➠" - } - } + div("wind-direction") { +it.windDirection.arrow } div("wind-speed") { +"%d km/h".format(it.windSpeed.toInt()) } div("description") { +it.description } div("image") { img(src = it.image) } diff --git a/src/main/kotlin/net/pterodactylus/rhynodge/webpages/weather/wettercom/WindDirection.kt b/src/main/kotlin/net/pterodactylus/rhynodge/webpages/weather/wettercom/WindDirection.kt index 047bbd9..f856815 100644 --- a/src/main/kotlin/net/pterodactylus/rhynodge/webpages/weather/wettercom/WindDirection.kt +++ b/src/main/kotlin/net/pterodactylus/rhynodge/webpages/weather/wettercom/WindDirection.kt @@ -5,17 +5,17 @@ package net.pterodactylus.rhynodge.webpages.weather.wettercom * * @author [David ‘Bombe’ Roden](mailto:bombe@pterodactylus.net) */ -enum class WindDirection(val degrees: Int) { +enum class WindDirection(val arrow: String) { - NONE(0), - NORTH(90), - NORTHEAST(45), - EAST(0), - SOUTHEAST(315), - SOUTH(270), - SOUTHWEST(225), - WEST(180), - NORTHWEST(135) + NONE("↺"), + NORTH("↓"), + NORTHEAST("↙"), + EAST("←"), + SOUTHEAST("↖"), + SOUTH("↑"), + SOUTHWEST("↗"), + WEST("→"), + NORTHWEST("↘") } -- 2.7.4