leomcelroy / svg-pcb

Design PCBs in the Browser
https://www.leomcelroy.com/svg-pcb-website
GNU General Public License v3.0
64 stars 9 forks source link

getX(), getY() do not take into account component flip #77

Open kr15h opened 9 months ago

kr15h commented 9 months ago

Noticed while making a board and placing vias. I have some components flipped on the back side of the board and I want to position vias relative to the pads there, but the returned positions of the pads are those of an unflipped component.

Say I have the following.

const batt_holder_left = board.add(batt_holder, { translate: pt(battOffsetFromLeftEdge + battClipOffset, height/2), rotate: 0, label: "batt_holder_left", flip: true })

And then I do this (given that the component has two pads labeled 1_1 and 1_2).

const viaB = board.add(via(viaHoleDia, viaRingDia), {translate: pt(batt_holder_left.padX("1_1"), height/2), label: 'V2'});

The resulting position will be where pad 1_2 is.

image