File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -69,6 +69,8 @@ <h3 class="back">Back to index</h3>
6969 < td class ="unit "> N/mm< sup > 2</ sup > </ td >
7070 </ tr >
7171 </ table >
72+
73+ < button class ="switch " onclick ="switchDim() "> Switch dimensions</ button >
7274 </ div >
7375
7476 < div class ="results ">
Original file line number Diff line number Diff line change @@ -24,4 +24,12 @@ function Resistance() {
2424 return PI * A * pow ( B , 2 ) / 32 ;
2525}
2626
27- function ResistanceB ( ) { }
27+ function ResistanceB ( ) { }
28+
29+ function switchDim ( ) {
30+ let A = floatElseZero ( dim . A . elt . value ) ;
31+ let B = floatElseZero ( dim . B . elt . value ) ;
32+ dim . A . elt . value = B ;
33+ dim . B . elt . value = A ;
34+ updateResults ( ) ;
35+ }
Original file line number Diff line number Diff line change @@ -75,6 +75,8 @@ <h3 class="back">Back to index</h3>
7575 < td class ="unit "> N/mm< sup > 2</ sup > </ td >
7676 </ tr >
7777 </ table >
78+
79+ < button class ="switch " onclick ="switchDim() "> Switch dimensions</ button >
7880 </ div >
7981
8082 < div class ="results ">
Original file line number Diff line number Diff line change @@ -29,4 +29,12 @@ function Resistance() {
2929 return 2 * I / B ;
3030}
3131
32- function ResistanceB ( ) { }
32+ function ResistanceB ( ) { }
33+
34+ function switchDim ( ) {
35+ let A = floatElseZero ( dim . A . elt . value ) ;
36+ let B = floatElseZero ( dim . B . elt . value ) ;
37+ dim . A . elt . value = B ;
38+ dim . B . elt . value = A ;
39+ updateResults ( ) ;
40+ }
Original file line number Diff line number Diff line change @@ -81,6 +81,8 @@ <h3 class="back">Back to index</h3>
8181 < td class ="unit "> N/mm< sup > 2</ sup > </ td >
8282 </ tr >
8383 </ table >
84+
85+ < button class ="switch " onclick ="switchDim() "> Switch dimensions</ button >
8486 </ div >
8587
8688 < div class ="results ">
Original file line number Diff line number Diff line change @@ -44,4 +44,12 @@ function Resistance() {
4444 return ( outer - inner ) / ( 6 * h ) ;
4545}
4646
47- function ResistanceB ( ) { }
47+ function ResistanceB ( ) { }
48+
49+ function switchDim ( ) {
50+ let b = floatElseZero ( dim . B . elt . value ) ;
51+ let h = floatElseZero ( dim . H . elt . value ) ;
52+ dim . B . elt . value = h ;
53+ dim . H . elt . value = b ;
54+ updateResults ( ) ;
55+ }
Original file line number Diff line number Diff line change @@ -75,6 +75,8 @@ <h3 class="back">Back to index</h3>
7575 < td class ="unit "> N/mm< sup > 2</ sup > </ td >
7676 </ tr >
7777 </ table >
78+
79+ < button class ="switch " onclick ="switchDim() "> Switch dimensions</ button >
7880 </ div >
7981
8082 < div class ="results ">
Original file line number Diff line number Diff line change @@ -30,4 +30,12 @@ function Resistance() {
3030 return I / h * 2 ;
3131}
3232
33- function ResistanceB ( ) { }
33+ function ResistanceB ( ) { }
34+
35+ function switchDim ( ) {
36+ let b = floatElseZero ( dim . B . elt . value ) ;
37+ let h = floatElseZero ( dim . H . elt . value ) ;
38+ dim . B . elt . value = h ;
39+ dim . H . elt . value = b ;
40+ updateResults ( ) ;
41+ }
Original file line number Diff line number Diff line change @@ -139,6 +139,24 @@ img.back {
139139 height : 240px ;
140140}
141141
142+ .switch {
143+ background-color : var (--color-4 );
144+ color : var (--color-1 );
145+ border : solid 2px var (--color-1 );
146+ padding : 4px ;
147+ margin-top : 8px ;
148+ margin-left : 36px ;
149+ margin-right : 400px ;
150+ border-radius : 2px ;
151+ cursor : pointer;
152+ transition : 0.3s ;
153+ }
154+
155+ .switch : hover {
156+ background-color : var (--color-1 );
157+ color : var (--color-4 );
158+ }
159+
142160.drawing {
143161 width : 80% ;
144162 min-width : 300px ;
You can’t perform that action at this time.
0 commit comments