MCPcopy Index your code
hub / github.com/plotly/plotly.js / getStyleObj

Function getStyleObj

src/plots/mapbox/mapbox.js:771–805  ·  view source on GitHub ↗
(val, fullLayout)

Source from the content-addressed store, hash-verified

769};
770
771function 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
808function convertStyleVal(val) {

Callers 1

mapbox.jsFile · 0.70

Calls 1

convertStyleValFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…