@@ -95,9 +95,9 @@ module.exports = function(gd) {
9595 opts . _height = ( fullLayout . height - margin . b - margin . t ) * opts . thickness ;
9696 opts . _offsetShift = Math . floor ( opts . borderwidth / 2 ) ;
9797
98- var x = margin . l + ( graphSize . w * domain [ 0 ] ) ;
98+ var x = Math . round ( margin . l + ( graphSize . w * domain [ 0 ] ) ) ;
9999
100- var y = (
100+ var y = Math . round (
101101 margin . t + graphSize . h * ( 1 - oppDomain [ 0 ] ) +
102102 tickHeight +
103103 opts . _offsetShift + constants . extraPad
@@ -252,11 +252,16 @@ function setDataRange(rangeSlider, gd, axisOpts, opts) {
252252}
253253
254254function setPixelRange ( rangeSlider , gd , axisOpts , opts ) {
255+ var hw2 = constants . handleWidth / 2 ;
255256
256257 function clamp ( v ) {
257258 return Lib . constrain ( v , 0 , opts . _width ) ;
258259 }
259260
261+ function clampHandle ( v ) {
262+ return Lib . constrain ( v , - hw2 , opts . _width + hw2 ) ;
263+ }
264+
260265 var pixelMin = clamp ( opts . d2p ( axisOpts . _rl [ 0 ] ) ) ,
261266 pixelMax = clamp ( opts . d2p ( axisOpts . _rl [ 1 ] ) ) ;
262267
@@ -271,11 +276,17 @@ function setPixelRange(rangeSlider, gd, axisOpts, opts) {
271276 . attr ( 'x' , pixelMax )
272277 . attr ( 'width' , opts . _width - pixelMax ) ;
273278
279+ // ..
280+ var offset = 0.5 ;
281+
282+ var xMin = Math . round ( clampHandle ( pixelMin - hw2 ) ) - offset ,
283+ xMax = Math . round ( clampHandle ( pixelMax - hw2 ) ) + offset ;
284+
274285 rangeSlider . select ( 'g.' + constants . grabberMinClassName )
275- . attr ( 'transform' , 'translate(' + ( pixelMin - constants . handleWidth - 1 ) + ',0 )' ) ;
286+ . attr ( 'transform' , 'translate(' + xMin + ',' + offset + ')' ) ;
276287
277288 rangeSlider . select ( 'g.' + constants . grabberMaxClassName )
278- . attr ( 'transform' , 'translate(' + pixelMax + ',0 )' ) ;
289+ . attr ( 'transform' , 'translate(' + xMax + ',' + offset + ' )') ;
279290}
280291
281292function drawBg ( rangeSlider , gd , axisOpts , opts ) {
@@ -295,14 +306,15 @@ function drawBg(rangeSlider, gd, axisOpts, opts) {
295306 opts . borderwidth - 1 ;
296307
297308 var offsetShift = - opts . _offsetShift ;
309+ var lw = Drawing . crispRound ( gd , opts . borderwidth ) ;
298310
299311 bg . attr ( {
300312 width : opts . _width + borderCorrect ,
301313 height : opts . _height + borderCorrect ,
302314 transform : 'translate(' + offsetShift + ',' + offsetShift + ')' ,
303315 fill : opts . bgcolor ,
304316 stroke : opts . bordercolor ,
305- 'stroke-width' : opts . borderwidth ,
317+ 'stroke-width' : lw
306318 } ) ;
307319}
308320
@@ -415,7 +427,8 @@ function drawMasks(rangeSlider, gd, axisOpts, opts) {
415427
416428 maskMin . enter ( ) . append ( 'rect' )
417429 . classed ( constants . maskMinClassName , true )
418- . attr ( { x : 0 , y : 0 } ) ;
430+ . attr ( { x : 0 , y : 0 } )
431+ . attr ( 'shape-rendering' , 'crispEdges' ) ;
419432
420433 maskMin
421434 . attr ( 'height' , opts . _height )
@@ -426,7 +439,8 @@ function drawMasks(rangeSlider, gd, axisOpts, opts) {
426439
427440 maskMax . enter ( ) . append ( 'rect' )
428441 . classed ( constants . maskMaxClassName , true )
429- . attr ( 'y' , 0 ) ;
442+ . attr ( 'y' , 0 )
443+ . attr ( 'shape-rendering' , 'crispEdges' ) ;
430444
431445 maskMax
432446 . attr ( 'height' , opts . _height )
@@ -442,7 +456,8 @@ function drawSlideBox(rangeSlider, gd, axisOpts, opts) {
442456 slideBox . enter ( ) . append ( 'rect' )
443457 . classed ( constants . slideBoxClassName , true )
444458 . attr ( 'y' , 0 )
445- . attr ( 'cursor' , constants . slideBoxCursor ) ;
459+ . attr ( 'cursor' , constants . slideBoxCursor )
460+ . attr ( 'shape-rendering' , 'crispEdges' ) ;
446461
447462 slideBox . attr ( {
448463 height : opts . _height ,
@@ -470,14 +485,15 @@ function drawGrabbers(rangeSlider, gd, axisOpts, opts) {
470485 x : 0 ,
471486 width : constants . handleWidth ,
472487 rx : constants . handleRadius ,
473- fill : constants . handleFill ,
474- stroke : constants . handleStroke ,
488+ fill : Color . background ,
489+ stroke : Color . defaultLine ,
490+ 'stroke-width' : constants . handleStrokeWidth ,
475491 'shape-rendering' : 'crispEdges'
476492 } ;
477493
478494 var handleDynamicAttrs = {
479- y : opts . _height / 4 ,
480- height : opts . _height / 2 ,
495+ y : Math . round ( opts . _height / 4 ) ,
496+ height : Math . round ( opts . _height / 2 ) ,
481497 } ;
482498
483499 var handleMin = grabberMin . selectAll ( 'rect.' + constants . handleMinClassName )
@@ -500,6 +516,7 @@ function drawGrabbers(rangeSlider, gd, axisOpts, opts) {
500516
501517 var grabAreaFixAttrs = {
502518 width : constants . grabAreaWidth ,
519+ x : 0 ,
503520 y : 0 ,
504521 fill : constants . grabAreaFill ,
505522 cursor : constants . grabAreaCursor
@@ -510,20 +527,14 @@ function drawGrabbers(rangeSlider, gd, axisOpts, opts) {
510527 grabAreaMin . enter ( ) . append ( 'rect' )
511528 . classed ( constants . grabAreaMinClassName , true )
512529 . attr ( grabAreaFixAttrs ) ;
513- grabAreaMin . attr ( {
514- x : constants . grabAreaMinOffset ,
515- height : opts . _height
516- } ) ;
530+ grabAreaMin . attr ( 'height' , opts . _height ) ;
517531
518532 var grabAreaMax = grabberMax . selectAll ( 'rect.' + constants . grabAreaMaxClassName )
519533 . data ( [ 0 ] ) ;
520534 grabAreaMax . enter ( ) . append ( 'rect' )
521535 . classed ( constants . grabAreaMaxClassName , true )
522536 . attr ( grabAreaFixAttrs ) ;
523- grabAreaMax . attr ( {
524- x : constants . grabAreaMaxOffset ,
525- height : opts . _height
526- } ) ;
537+ grabAreaMax . attr ( 'height' , opts . _height ) ;
527538}
528539
529540function clearPushMargins ( gd ) {
0 commit comments