Registry / RepositoryTypeScriptRustPython
Rollpie
ReadmeFiles
Versions
Info
Download
0.2.0528.5 KB2026-10-160.1.1542.8 KB2026-10-150.1.0541.1 KB2026-10-15
Version
0.2.0
Copyright
Rollpie, Irohabook
Publisher
math
Published
2026-10-16
Size
528.5 KB
Downloads
6
Checksum
f8871632f38084ae53dd9bf16e9ea90c80a209bf6cd234b6767630c5470dc305
Dependencies
None

style.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct Style {
    pub bond_length: f64,
    pub line_width: f64,
    pub double_gap: f64,
    pub bond_offset: f64,
    pub wedge_width: f64,
    pub hash_gap: f64,
    pub ring_circle: f64,
    pub script_size: f64,
    pub script_floor: f64,
    pub script_space: f64,
    pub subscript_drop: f64,
    pub superscript_rise: f64,
    pub margin: f64,
    pub name_gap: f64,
    pub darken: f64,
}


impl Default for Style {
    fn default() -> Style {
        Style {
            bond_length: 3.0,
            line_width: 0.05,
            double_gap: 0.2,
            bond_offset: 0.2,
            wedge_width: 0.25,
            hash_gap: 0.14,
            ring_circle: 0.62,
            script_size: 0.7,
            script_floor: 0.5,
            script_space: 0.05,
            subscript_drop: 0.2,
            superscript_rise: 0.4,
            margin: 0.3,
            name_gap: 0.6,
            darken: 0.011,
        }
    }
}


#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn the_default_is_usable() {
        let style = Style::default();
        assert!(style.bond_length > 0.0);
        assert!(style.line_width > 0.0 && style.line_width < style.bond_length);
        assert!(style.script_size > 0.0 && style.script_size < 1.0);
        assert!(style.script_floor > 0.0 && style.script_floor < style.script_size);
        assert!(style.name_gap > 0.0);
        assert!(style.wedge_width > style.line_width);
        assert!(style.hash_gap > 0.0 && style.hash_gap < style.bond_length);
        assert!(style.ring_circle > 0.0 && style.ring_circle < 1.0);
    }
}