(dragOptions, immediateSelect)
| 718 | } |
| 719 | |
| 720 | function clearSelectionsCache(dragOptions, immediateSelect) { |
| 721 | var dragmode = dragOptions.dragmode; |
| 722 | var plotinfo = dragOptions.plotinfo; |
| 723 | |
| 724 | var gd = dragOptions.gd; |
| 725 | if(hasActiveShape(gd)) { |
| 726 | gd._fullLayout._deactivateShape(gd); |
| 727 | } |
| 728 | if(hasActiveSelection(gd)) { |
| 729 | gd._fullLayout._deactivateSelection(gd); |
| 730 | } |
| 731 | |
| 732 | var fullLayout = gd._fullLayout; |
| 733 | var zoomLayer = fullLayout._zoomlayer; |
| 734 | |
| 735 | var isDrawMode = drawMode(dragmode); |
| 736 | var isSelectMode = selectMode(dragmode); |
| 737 | |
| 738 | if(isDrawMode || isSelectMode) { |
| 739 | var outlines = zoomLayer.selectAll('.select-outline-' + plotinfo.id); |
| 740 | if(outlines && gd._fullLayout._outlining) { |
| 741 | // add shape |
| 742 | var shapes; |
| 743 | if(isDrawMode) { |
| 744 | shapes = newShapes(outlines, dragOptions); |
| 745 | } |
| 746 | if(shapes) { |
| 747 | Registry.call('_guiRelayout', gd, { |
| 748 | shapes: shapes |
| 749 | }); |
| 750 | } |
| 751 | |
| 752 | // add selection |
| 753 | var selections; |
| 754 | if( |
| 755 | isSelectMode && |
| 756 | !hasSubplot(dragOptions) // only allow cartesian - no maps for now |
| 757 | ) { |
| 758 | selections = newSelections(outlines, dragOptions); |
| 759 | } |
| 760 | if(selections) { |
| 761 | gd._fullLayout._noEmitSelectedAtStart = true; |
| 762 | |
| 763 | Registry.call('_guiRelayout', gd, { |
| 764 | selections: selections |
| 765 | }).then(function() { |
| 766 | if(immediateSelect) { activateLastSelection(gd); } |
| 767 | }); |
| 768 | } |
| 769 | |
| 770 | gd._fullLayout._outlining = false; |
| 771 | } |
| 772 | } |
| 773 | |
| 774 | plotinfo.selection = {}; |
| 775 | plotinfo.selection.selectionDefs = dragOptions.selectionDefs = []; |
| 776 | plotinfo.selection.mergedPolygons = dragOptions.mergedPolygons = []; |
| 777 | } |
no test coverage detected
searching dependent graphs…