Fix style of NpThroughHole pad drills
Some checks are pending
test / test (push) Waiting to run

This commit is contained in:
Lily Rose 2025-07-28 18:08:44 +10:00
parent 40cfdf9bc6
commit 71ffecc2d5

View file

@ -2,6 +2,7 @@ import gleam/float
import gleam/list import gleam/list
import gleam/option.{None, Some} import gleam/option.{None, Some}
import gleam/order import gleam/order
import gleam/string
import kicad_sexpr import kicad_sexpr
import kicad_sexpr/token.{type Footprint, type Pad} import kicad_sexpr/token.{type Footprint, type Pad}
import lustre/attribute.{style} as _attribute import lustre/attribute.{style} as _attribute
@ -189,8 +190,8 @@ fn create_svg(footprint: Footprint) -> String {
transform:, transform:,
children: footprint.pads children: footprint.pads
|> list.filter(fn(pad) { |> list.filter(fn(pad) {
pad.layers |> list.contains(token.Layer("F.Cu")) pad.layers
|| pad.layers |> list.contains(token.Layer("*.Cu")) |> list.any(fn(layer) { layer.layer |> string.ends_with(".Cu") })
}) })
|> list.map(pad_to_element), |> list.map(pad_to_element),
), ),
@ -561,9 +562,11 @@ fn pad_to_element(pad: Pad) -> Element(a) {
) )
} }
} }
let fill = Some(bg_col) let #(fill, stroke, stroke_width) = case pad.type_ {
let stroke = Some("#E7B629") token.ThroughHolePadType -> #(Some(bg_col), Some("#E7B629"), Some(0.03333))
let stroke_width = Some(0.03333) token.NpThroughHolePadType -> #(Some("#18C7D6"), None, None)
_ -> #(None, None, None)
}
case pad.drill { case pad.drill {
Some(token.PadDrillDefinition(False, Some(d), ..)) Some(token.PadDrillDefinition(False, Some(d), ..))
| Some(token.PadDrillDefinition(True, Some(d), None, ..)) -> | Some(token.PadDrillDefinition(True, Some(d), None, ..)) ->