@@ -30,28 +30,28 @@ var multipolygonTester = polygon.multitester;
3030
3131function getAxId ( ax ) { return ax . _id ; }
3232
33- module . exports = function prepSelect ( e , startX , startY , dragOptions , mode ) {
34- var gd = dragOptions . gd ,
35- fullLayout = gd . _fullLayout ,
36- zoomLayer = fullLayout . _zoomlayer ,
37- dragBBox = dragOptions . element . getBoundingClientRect ( ) ,
38- plotinfo = dragOptions . plotinfo ,
39- xs = plotinfo . xaxis . _offset ,
40- ys = plotinfo . yaxis . _offset ,
41- x0 = startX - dragBBox . left ,
42- y0 = startY - dragBBox . top ,
43- x1 = x0 ,
44- y1 = y0 ,
45- path0 = 'M' + x0 + ',' + y0 ,
46- pw = dragOptions . xaxes [ 0 ] . _length ,
47- ph = dragOptions . yaxes [ 0 ] . _length ,
48- xAxisIds = dragOptions . xaxes . map ( getAxId ) ,
49- yAxisIds = dragOptions . yaxes . map ( getAxId ) ,
50- allAxes = dragOptions . xaxes . concat ( dragOptions . yaxes ) ,
51- filterPoly , testPoly , mergedPolygons , currentPolygon ,
52- subtract = e . altKey ,
53- i , cd , trace , searchInfo , eventData ;
54-
33+ function prepSelect ( e , startX , startY , dragOptions , mode ) {
34+ var gd = dragOptions . gd ;
35+ var fullLayout = gd . _fullLayout ;
36+ var zoomLayer = fullLayout . _zoomlayer ;
37+ var dragBBox = dragOptions . element . getBoundingClientRect ( ) ;
38+ var plotinfo = dragOptions . plotinfo ;
39+ var xs = plotinfo . xaxis . _offset ;
40+ var ys = plotinfo . yaxis . _offset ;
41+ var x0 = startX - dragBBox . left ;
42+ var y0 = startY - dragBBox . top ;
43+ var x1 = x0 ;
44+ var y1 = y0 ;
45+ var path0 = 'M' + x0 + ',' + y0 ;
46+ var pw = dragOptions . xaxes [ 0 ] . _length ;
47+ var ph = dragOptions . yaxes [ 0 ] . _length ;
48+ var xAxisIds = dragOptions . xaxes . map ( getAxId ) ;
49+ var yAxisIds = dragOptions . yaxes . map ( getAxId ) ;
50+ var allAxes = dragOptions . xaxes . concat ( dragOptions . yaxes ) ;
51+ var subtract = e . altKey ;
52+
53+ var filterPoly , testPoly , mergedPolygons , currentPolygon ;
54+ var i , cd , trace , searchInfo , eventData ;
5555
5656 // take over selection polygons from prev mode, if any
5757 if ( ( e . shiftKey || e . altKey ) && ( plotinfo . selection && plotinfo . selection . polygons ) && ! dragOptions . polygons ) {
@@ -331,7 +331,7 @@ module.exports = function prepSelect(e, startX, startY, dragOptions, mode) {
331331 }
332332 } ) ;
333333 } ;
334- } ;
334+ }
335335
336336function updateSelectedState ( gd , searchTraces , eventData ) {
337337 var i , j , searchInfo , trace ;
@@ -451,3 +451,15 @@ function fillSelectionItem(selection, searchInfo) {
451451
452452 return selection ;
453453}
454+
455+ function clearSelect ( zoomlayer ) {
456+ // until we get around to persistent selections, remove the outline
457+ // here. The selection itself will be removed when the plot redraws
458+ // at the end.
459+ zoomlayer . selectAll ( '.select-outline' ) . remove ( ) ;
460+ }
461+
462+ module . exports = {
463+ prepSelect : prepSelect ,
464+ clearSelect : clearSelect
465+ } ;
0 commit comments