File tree Expand file tree Collapse file tree 3 files changed +10
-3
lines changed
Expand file tree Collapse file tree 3 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ Behaviors :
3737* max : max value || default=100.
3838* stopper : stop at 0 & 100 on keydown/mousewheel || default=true.
3939* readOnly : disable input and events.
40+ * angleOffset: change the 0 position of the knob (in degree), || default=0.
4041
4142UI :
4243* cursor : display mode "cursor" | default=gauge.
Original file line number Diff line number Diff line change 126126data-min="-100"
127127data-cgColor="#A9EFFD"
128128data-displayPrevious=true
129+ data-angleOffset="90"
129130 </ pre >
130- < input class ="knob "data-width ="200 " data-min ="-100 " data-displayPrevious =true value ="44 ">
131+ < input class ="knob "data-width ="200 " data-min ="-100 " data-angleOffset =" 90 " data- displayPrevious =true value ="44 ">
131132 </ div >
132133 < div style ="clear:both "> </ div >
133134 < div style ="float:left;width:300px;height:320px;padding:20px ">
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ $(function () {
1919
2020 var v = null
2121 , ctx = c [ 0 ] . getContext ( "2d" )
22- , PI2 = 2 * Math . PI
22+ , PI2 = 2 * Math . PI
2323 , mx , my , x , y
2424 , self = this ;
2525
@@ -55,7 +55,7 @@ $(function () {
5555 this . draw = function ( nv ) {
5656
5757 var a = this . angle ( nv ) // Angle
58- , sa = 1.5 * Math . PI // Previous start angle
58+ , sa = 1.5 * Math . PI + opt . angleOffset // Previous start angle
5959 , sat = sa // Start angle
6060 , ea = sa + this . angle ( v ) // Previous end angle
6161 , eat = sat + a // End angle
@@ -242,6 +242,7 @@ $(function () {
242242 , 'tickWidth' : $this . data ( 'tickWidth' ) || 0.02
243243 , 'tickColorizeValues' : $this . data ( 'tickColorizeValues' ) || true
244244 , 'skin' : $this . data ( 'skin' ) || 'default'
245+ , 'angleOffset' : degreeToRadians ( $this . data ( 'angleoffset' ) )
245246
246247 // Hooks
247248 , 'draw' :
@@ -418,4 +419,8 @@ $(function () {
418419 }
419420 ) . parent ( ) ;
420421 } ;
422+
423+ function degreeToRadians ( angle ) {
424+ return $ . isNumeric ( angle ) ? angle * Math . PI / 180 : 0 ;
425+ }
421426} ) ;
You can’t perform that action at this time.
0 commit comments