UNPKG

mapbox-gl

Version:
30 lines (24 loc) 923 B
'use strict'; var util = require('../../util/util'); var StyleLayer = require('../style_layer'); function SymbolStyleLayer() { StyleLayer.apply(this, arguments); } module.exports = SymbolStyleLayer; SymbolStyleLayer.prototype = util.inherit(StyleLayer, { getLayoutValue: function(name, globalProperties, featureProperties) { var value = StyleLayer.prototype.getLayoutValue.apply(this, arguments); if (value !== 'auto') { return value; } switch (name) { case 'text-rotation-alignment': case 'icon-rotation-alignment': return this.getLayoutValue('symbol-placement', globalProperties, featureProperties) === 'line' ? 'map' : 'viewport'; case 'text-pitch-alignment': return this.getLayoutValue('text-rotation-alignment', globalProperties, featureProperties); default: return value; } } });