Skip to content

Commit

Permalink
Have ColormapOverlay support blank keys
Browse files Browse the repository at this point in the history
Signed-off-by: Evy Bongers <[email protected]>
  • Loading branch information
EvyBongers authored and obra committed Jun 18, 2024
1 parent 622df1c commit 3561c3e
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,24 @@ void ColormapOverlay::setup() {
}

bool ColormapOverlay::hasOverlay(KeyAddr k) {
uint8_t top_layer = Layer.mostRecent();
uint8_t layer_index = Layer.lookupActiveLayer(k);

bool found_match_on_lower_layer = false;
for (uint8_t i{0}; i < overlay_count_; ++i) {
Overlay overlay = overlays_[i];
if (overlay.addr == k) {
if ((overlay.layer == layer_index) ||
(overlay.layer == layer_wildcard)) {
if ((overlay.layer == top_layer) || (overlay.layer == layer_wildcard)) {
selectedColor = ::LEDPaletteTheme.lookupPaletteColor(overlay.palette_index);
return true;
} else if (overlay.layer == layer_index) {
selectedColor = ::LEDPaletteTheme.lookupPaletteColor(overlay.palette_index);
found_match_on_lower_layer = true;
}
}
}

return false;
return found_match_on_lower_layer;
}

EventHandlerResult ColormapOverlay::onSetup() {
Expand Down

0 comments on commit 3561c3e

Please sign in to comment.