(gd)
| 62 | |
| 63 | // logic behind which buttons are displayed by default |
| 64 | function getButtonGroups(gd) { |
| 65 | var fullLayout = gd._fullLayout; |
| 66 | var fullData = gd._fullData; |
| 67 | var context = gd._context; |
| 68 | |
| 69 | function match(name, B) { |
| 70 | if(typeof B === 'string') { |
| 71 | if(B.toLowerCase() === name.toLowerCase()) return true; |
| 72 | } else { |
| 73 | var v0 = B.name; |
| 74 | var v1 = (B._cat || B.name); |
| 75 | |
| 76 | if(v0 === name || v1 === name.toLowerCase()) return true; |
| 77 | } |
| 78 | return false; |
| 79 | } |
| 80 | |
| 81 | var layoutAdd = fullLayout.modebar.add; |
| 82 | if(typeof layoutAdd === 'string') layoutAdd = [layoutAdd]; |
| 83 | |
| 84 | var layoutRemove = fullLayout.modebar.remove; |
| 85 | if(typeof layoutRemove === 'string') layoutRemove = [layoutRemove]; |
| 86 | |
| 87 | var buttonsToAdd = context.modeBarButtonsToAdd.concat( |
| 88 | layoutAdd.filter(function(e) { |
| 89 | for(var i = 0; i < context.modeBarButtonsToRemove.length; i++) { |
| 90 | if(match(e, context.modeBarButtonsToRemove[i])) return false; |
| 91 | } |
| 92 | return true; |
| 93 | }) |
| 94 | ); |
| 95 | |
| 96 | var buttonsToRemove = context.modeBarButtonsToRemove.concat( |
| 97 | layoutRemove.filter(function(e) { |
| 98 | for(var i = 0; i < context.modeBarButtonsToAdd.length; i++) { |
| 99 | if(match(e, context.modeBarButtonsToAdd[i])) return false; |
| 100 | } |
| 101 | return true; |
| 102 | }) |
| 103 | ); |
| 104 | |
| 105 | var hasCartesian = fullLayout._has('cartesian'); |
| 106 | var hasGL3D = fullLayout._has('gl3d'); |
| 107 | var hasGeo = fullLayout._has('geo'); |
| 108 | var hasPie = fullLayout._has('pie'); |
| 109 | var hasFunnelarea = fullLayout._has('funnelarea'); |
| 110 | var hasTernary = fullLayout._has('ternary'); |
| 111 | var hasMapbox = fullLayout._has('mapbox'); |
| 112 | var hasMap = fullLayout._has('map'); |
| 113 | var hasPolar = fullLayout._has('polar'); |
| 114 | var hasSmith = fullLayout._has('smith'); |
| 115 | var hasSankey = fullLayout._has('sankey'); |
| 116 | var allAxesFixed = areAllAxesFixed(fullLayout); |
| 117 | var hasUnifiedHoverLabel = isUnifiedHover(fullLayout.hovermode); |
| 118 | |
| 119 | var groups = []; |
| 120 | |
| 121 | function addGroup(newGroup) { |
no test coverage detected
searching dependent graphs…