(val, fullLayout)
| 769 | }; |
| 770 | |
| 771 | function getStyleObj(val, fullLayout) { |
| 772 | var styleObj = {}; |
| 773 | |
| 774 | if(Lib.isPlainObject(val)) { |
| 775 | styleObj.id = val.id; |
| 776 | styleObj.style = val; |
| 777 | } else if(typeof val === 'string') { |
| 778 | styleObj.id = val; |
| 779 | |
| 780 | if(constants.styleValuesMapbox.indexOf(val) !== -1) { |
| 781 | styleObj.style = convertStyleVal(val); |
| 782 | } else if(constants.stylesNonMapbox[val]) { |
| 783 | styleObj.style = constants.stylesNonMapbox[val]; |
| 784 | var spec = styleObj.style.sources['plotly-' + val]; |
| 785 | var tiles = spec ? spec.tiles : undefined; |
| 786 | if( |
| 787 | tiles && |
| 788 | tiles[0] && |
| 789 | tiles[0].slice(-9) === '?api_key=' |
| 790 | ) { |
| 791 | // provide api_key for stamen styles |
| 792 | tiles[0] += fullLayout._mapboxAccessToken; |
| 793 | } |
| 794 | } else { |
| 795 | styleObj.style = val; |
| 796 | } |
| 797 | } else { |
| 798 | styleObj.id = constants.styleValueDflt; |
| 799 | styleObj.style = convertStyleVal(constants.styleValueDflt); |
| 800 | } |
| 801 | |
| 802 | styleObj.transition = {duration: 0, delay: 0}; |
| 803 | |
| 804 | return styleObj; |
| 805 | } |
| 806 | |
| 807 | // if style is part of the 'official' mapbox values, add URL prefix and suffix |
| 808 | function convertStyleVal(val) { |
no test coverage detected
searching dependent graphs…