@@ -9732,13 +9732,17 @@ LGraphNode.prototype.executeAction = function(action)
97329732 ctx . fillRect ( margin , y , widget_width - margin * 2 , H ) ;
97339733 var range = w . options . max - w . options . min ;
97349734 var nvalue = ( w . value - w . options . min ) / range ;
9735- ctx . fillStyle = active_widget == w ? "#89A" : "#678" ;
9735+ if ( nvalue < 0.0 ) nvalue = 0.0 ;
9736+ if ( nvalue > 1.0 ) nvalue = 1.0 ;
9737+ ctx . fillStyle = w . options . hasOwnProperty ( "slider_color" ) ? w . options . slider_color : ( active_widget == w ? "#89A" : "#678" ) ;
97369738 ctx . fillRect ( margin , y , nvalue * ( widget_width - margin * 2 ) , H ) ;
97379739 if ( show_text && ! w . disabled )
97389740 ctx . strokeRect ( margin , y , widget_width - margin * 2 , H ) ;
97399741 if ( w . marker ) {
97409742 var marker_nvalue = ( w . marker - w . options . min ) / range ;
9741- ctx . fillStyle = "#AA9" ;
9743+ if ( marker_nvalue < 0.0 ) marker_nvalue = 0.0 ;
9744+ if ( marker_nvalue > 1.0 ) marker_nvalue = 1.0 ;
9745+ ctx . fillStyle = w . options . hasOwnProperty ( "marker_color" ) ? w . options . marker_color : "#AA9" ;
97429746 ctx . fillRect ( margin + marker_nvalue * ( widget_width - margin * 2 ) , y , 2 , H ) ;
97439747 }
97449748 if ( show_text ) {
@@ -9905,6 +9909,7 @@ LGraphNode.prototype.executeAction = function(action)
99059909 case "slider" :
99069910 var range = w . options . max - w . options . min ;
99079911 var nvalue = Math . clamp ( ( x - 15 ) / ( widget_width - 30 ) , 0 , 1 ) ;
9912+ if ( w . options . read_only ) break ;
99089913 w . value = w . options . min + ( w . options . max - w . options . min ) * nvalue ;
99099914 if ( w . callback ) {
99109915 setTimeout ( function ( ) {
@@ -10019,7 +10024,6 @@ LGraphNode.prototype.executeAction = function(action)
1001910024 case "text" :
1002010025 if ( event . type == LiteGraph . pointerevents_method + "down" ) {
1002110026 this . prompt ( "Value" , w . value , function ( v ) {
10022- this . value = v ;
1002310027 inner_value_change ( this , v ) ;
1002410028 } . bind ( w ) ,
1002510029 event , w . options ? w . options . multiline : false ) ;
@@ -10044,6 +10048,9 @@ LGraphNode.prototype.executeAction = function(action)
1004410048 } //end for
1004510049
1004610050 function inner_value_change ( widget , value ) {
10051+ if ( widget . type == "number" ) {
10052+ value = Number ( value ) ;
10053+ }
1004710054 widget . value = value ;
1004810055 if ( widget . options && widget . options . property && node . properties [ widget . options . property ] !== undefined ) {
1004910056 node . setProperty ( widget . options . property , value ) ;
0 commit comments