From 7ea7c7cea5361b36cd0391a5a2d002cdff25da79 Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Thu, 21 Jul 2022 22:34:33 -0400 Subject: [PATCH] FIX processor dial placement for multiple rows --- src/modules/processor.lua | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/modules/processor.lua b/src/modules/processor.lua index 0801f8d..d0e48cb 100644 --- a/src/modules/processor.lua +++ b/src/modules/processor.lua @@ -74,20 +74,15 @@ return function(update_freq, config, main_state, common, width, point) local core_cols = ncores / config.core_rows local cores = {} for c = 1, ncores do - local dial_x - local dial_y - if core_cols == 1 then - dial_x = point.x + width / 2 - dial_y = y + DIAL_OUTER_RADIUS + - (2 * DIAL_OUTER_RADIUS + DIAL_SPACING) * (c - 1) - else - dial_x = point.x + config.core_padding + DIAL_OUTER_RADIUS + - (width - 2 * (DIAL_OUTER_RADIUS + config.core_padding)) - * math.fmod(c - 1, core_cols) / (core_cols - 1) - dial_y = y + DIAL_OUTER_RADIUS + - (2 * DIAL_OUTER_RADIUS + DIAL_SPACING) - * math.floor((c - 1) / core_cols) / (core_cols - 1) - end + local dial_x = point.x + + (core_cols == 1 + and (width / 2) + or (config.core_padding + DIAL_OUTER_RADIUS + + (width - 2 * (DIAL_OUTER_RADIUS + config.core_padding)) + * math.fmod(c - 1, core_cols) / (core_cols - 1))) + local dial_y = y + DIAL_OUTER_RADIUS + + (2 * DIAL_OUTER_RADIUS + DIAL_SPACING) + * math.floor((c - 1) / core_cols) cores[c] = create_core(dial_x, dial_y) end local update = function()