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

Function handleLayerDefaults

src/plots/map/layout_defaults.js:49–114  ·  view source on GitHub ↗
(layerIn, layerOut)

Source from the content-addressed store, hash-verified

47}
48
49function handleLayerDefaults(layerIn, layerOut) {
50 function coerce(attr, dflt) {
51 return Lib.coerce(layerIn, layerOut, layoutAttributes.layers, attr, dflt);
52 }
53
54 var visible = coerce('visible');
55 if(visible) {
56 var sourceType = coerce('sourcetype');
57 var mustBeRasterLayer = sourceType === 'raster' || sourceType === 'image';
58
59 coerce('source');
60 coerce('sourceattribution');
61
62 if(sourceType === 'vector') {
63 coerce('sourcelayer');
64 }
65
66 if(sourceType === 'image') {
67 coerce('coordinates');
68 }
69
70 var typeDflt;
71 if(mustBeRasterLayer) typeDflt = 'raster';
72
73 var type = coerce('type', typeDflt);
74
75 if(mustBeRasterLayer && type !== 'raster') {
76 type = layerOut.type = 'raster';
77 Lib.log('Source types *raster* and *image* must drawn *raster* layer type.');
78 }
79
80 coerce('below');
81 coerce('color');
82 coerce('opacity');
83 coerce('minzoom');
84 coerce('maxzoom');
85
86 if(type === 'circle') {
87 coerce('circle.radius');
88 }
89
90 if(type === 'line') {
91 coerce('line.width');
92 coerce('line.dash');
93 }
94
95 if(type === 'fill') {
96 coerce('fill.outlinecolor');
97 }
98
99 if(type === 'symbol') {
100 coerce('symbol.icon');
101 coerce('symbol.iconsize');
102
103 coerce('symbol.text');
104 Lib.coerceFont(coerce, 'symbol.textfont', undefined, {
105 noFontVariant: true,
106 noFontShadow: true,

Callers

nothing calls this directly

Calls 1

coerceFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…