@@ -146,16 +146,14 @@ function findDimensions(gd, sliderOpts) {
146146 // The length of the rail, *excluding* padding on either end:
147147 sliderOpts . inputAreaStart = 0 ;
148148 sliderOpts . inputAreaLength = Math . round ( sliderOpts . outerLength - sliderOpts . pad . l - sliderOpts . pad . r ) ;
149- sliderOpts . railInset = Math . round ( Math . max ( 0 , constants . gripWidth - constants . railWidth ) * 0.5 ) ;
150- sliderOpts . stepInset = Math . round ( Math . max ( sliderOpts . railInset , constants . gripWidth * 0.5 ) ) ;
151149
152- var textableInputLength = sliderOpts . inputAreaLength - 2 * sliderOpts . stepInset ;
150+ var textableInputLength = sliderOpts . inputAreaLength - 2 * constants . stepInset ;
153151 var availableSpacePerLabel = textableInputLength / ( sliderOpts . steps . length - 1 ) ;
154152 var computedSpacePerLabel = maxLabelWidth + constants . labelPadding ;
155153 sliderOpts . labelStride = Math . max ( 1 , Math . ceil ( computedSpacePerLabel / availableSpacePerLabel ) ) ;
156154 sliderOpts . labelHeight = labelHeight ;
157155
158- sliderOpts . height = constants . tickOffset + constants . tickLength + sliderOpts . labelHeight + sliderOpts . pad . t + sliderOpts . pad . b ;
156+ sliderOpts . height = constants . tickOffset + constants . tickLength + constants . labelOffset + sliderOpts . labelHeight + sliderOpts . pad . t + sliderOpts . pad . b ;
159157
160158 var xanchor = 'left' ;
161159 if ( anchorUtils . isRightAnchor ( sliderOpts ) ) {
@@ -307,7 +305,7 @@ function drawLabelGroup(sliderGroup, sliderOpts) {
307305
308306 Lib . setTranslate ( item ,
309307 normalizedValueToPosition ( sliderOpts , d . fraction ) ,
310- constants . tickOffset + constants . tickLength + sliderOpts . labelHeight
308+ constants . tickOffset + constants . tickLength + sliderOpts . labelHeight + constants . labelOffset
311309 ) ;
312310 } ) ;
313311
@@ -405,7 +403,7 @@ function drawTicks(sliderGroup, sliderOpts) {
405403
406404 Lib . setTranslate ( item ,
407405 normalizedValueToPosition ( sliderOpts , i / ( sliderOpts . steps . length - 1 ) ) - 0.5 * constants . tickWidth ,
408- constants . tickOffset
406+ isMajor ? constants . tickOffset : constants . minorTickOffset
409407 ) ;
410408 } ) ;
411409
@@ -443,13 +441,13 @@ function setGripPosition(sliderGroup, sliderOpts, position, doTransition) {
443441
444442// Convert a number from [0-1] to a pixel position relative to the slider group container:
445443function normalizedValueToPosition ( sliderOpts , normalizedPosition ) {
446- return sliderOpts . inputAreaStart + sliderOpts . stepInset +
447- ( sliderOpts . inputAreaLength - 2 * sliderOpts . stepInset ) * Math . min ( 1 , Math . max ( 0 , normalizedPosition ) ) ;
444+ return sliderOpts . inputAreaStart + constants . stepInset +
445+ ( sliderOpts . inputAreaLength - 2 * constants . stepInset ) * Math . min ( 1 , Math . max ( 0 , normalizedPosition ) ) ;
448446}
449447
450448// Convert a position relative to the slider group to a nubmer in [0, 1]
451449function positionToNormalizedValue ( sliderOpts , position ) {
452- return Math . min ( 1 , Math . max ( 0 , ( position - sliderOpts . stepInset - sliderOpts . inputAreaStart ) / ( sliderOpts . inputAreaLength - 2 * sliderOpts . stepInset - 2 * sliderOpts . inputAreaStart ) ) ) ;
450+ return Math . min ( 1 , Math . max ( 0 , ( position - constants . stepInset - sliderOpts . inputAreaStart ) / ( sliderOpts . inputAreaLength - 2 * constants . stepInset - 2 * sliderOpts . inputAreaStart ) ) ) ;
453451}
454452
455453function drawTouchRect ( sliderGroup , gd , sliderOpts ) {
@@ -466,7 +464,7 @@ function drawTouchRect(sliderGroup, gd, sliderOpts) {
466464 height : Math . max ( sliderOpts . inputAreaWidth , constants . tickOffset + constants . tickLength + sliderOpts . labelHeight )
467465 } )
468466 . call ( Color . fill , constants . gripBgColor )
469- . attr ( 'opacity' , 0.0 ) ;
467+ . attr ( 'opacity' , 0 ) ;
470468
471469 Lib . setTranslate ( rect , 0 , 0 ) ;
472470}
@@ -478,7 +476,7 @@ function drawRail(sliderGroup, sliderOpts) {
478476 rect . enter ( ) . append ( 'rect' )
479477 . classed ( constants . railRectClass , true ) ;
480478
481- var computedLength = sliderOpts . inputAreaLength - sliderOpts . railInset * 2 ;
479+ var computedLength = sliderOpts . inputAreaLength - constants . railInset * 2 ;
482480
483481 rect . attr ( {
484482 width : computedLength ,
@@ -491,7 +489,7 @@ function drawRail(sliderGroup, sliderOpts) {
491489 . call ( Color . fill , constants . railBgColor )
492490 . style ( 'stroke-width' , '1px' ) ;
493491
494- Lib . setTranslate ( rect , sliderOpts . railInset , ( sliderOpts . inputAreaWidth - constants . railWidth ) * 0.5 ) ;
492+ Lib . setTranslate ( rect , constants . railInset , ( sliderOpts . inputAreaWidth - constants . railWidth ) * 0.5 ) ;
495493}
496494
497495function clearPushMargins ( gd ) {
0 commit comments