Skip to content

Commit e2ccd96

Browse files
committed
Support configuring board rotation
1 parent d589d47 commit e2ccd96

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/lib.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,12 @@ pub struct InteractiveHtmlBom {
621621
/// Dark mode on/off
622622
pub dark_mode: bool,
623623

624+
/// Board drawings rotation \[°\]
625+
pub board_rotation: f32,
626+
627+
/// Whether to offset the back side rotation or not
628+
pub offset_back_rotation: bool,
629+
624630
/// Silkscreen visibility
625631
pub show_silkscreen: bool,
626632

@@ -718,6 +724,8 @@ impl InteractiveHtmlBom {
718724
view_mode: ViewMode::LeftRight,
719725
highlight_pin1: HighlightPin1Mode::None,
720726
dark_mode: false,
727+
board_rotation: 0.0,
728+
offset_back_rotation: false,
721729
show_silkscreen: true,
722730
show_fabrication: true,
723731
show_pads: true,
@@ -791,15 +799,15 @@ impl InteractiveHtmlBom {
791799
};
792800

793801
let config = object! {
794-
board_rotation: 0.0,
802+
board_rotation: (self.board_rotation / 5.0) as i32,
795803
bom_view: self.view_mode.to_json(),
796804
checkboxes: self.checkboxes.join(","),
797805
dark_mode: self.dark_mode,
798806
fields: self.fields.to_json(),
799807
highlight_pin1: self.highlight_pin1.to_json(),
800808
kicad_text_formatting: false,
801809
layer_view: layer_view,
802-
offset_back_rotation: false,
810+
offset_back_rotation: self.offset_back_rotation,
803811
redraw_on_drag: true,
804812
show_fabrication: self.show_fabrication,
805813
show_pads: self.show_pads,

tests/integration_test.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ fn test_everything() {
2929
bom.view_mode = ViewMode::TopBottom;
3030
bom.highlight_pin1 = HighlightPin1Mode::All;
3131
bom.dark_mode = true;
32+
bom.board_rotation = 45.0;
33+
bom.offset_back_rotation = true;
3234
bom.show_silkscreen = false;
3335
bom.show_fabrication = false;
3436
bom.show_pads = false;

0 commit comments

Comments
 (0)