Always scale gauge cluster to appropriate 32:15 aspect ratio

This commit is contained in:
XANTRONIX Development 2019-06-09 17:05:18 -05:00
parent 74ab4d1a5f
commit 393d35454d

View file

@ -10,6 +10,15 @@ hexagram_cluster *hexagram_cluster_new(double width, double height) {
goto error_malloc_cluster; goto error_malloc_cluster;
} }
/*
* Ensure correct cluster aspect ratio
*/
if (width / height > 32.0 / 15.0) {
width = height * (32.0 / 15.0);
} else {
height = width * (15.0 / 32.0);
}
hexagram_tacho_init(&cluster->tacho, hexagram_tacho_init(&cluster->tacho,
width * 0.2, width * 0.2,
height * 0.5, height * 0.5,