Skip to content

[not ready] Better handling for undefined icon|text-rotation-alignment - #3203

Merged
jfirebaugh merged 3 commits into
masterfrom
boundsj-symbol-complex-default
Sep 21, 2016
Merged

jfirebaugh merged 3 commits into
masterfrom
boundsj-symbol-complex-default

Conversation

@boundsj

@boundsj boundsj commented Sep 16, 2016 •

Copy link
Copy Markdown
Contributor

This updates the symbol style layer so that it uses the correct values (viewport or map) when the auto value is set explicitly or by default for the properties that support it.

text-pitch-alignment continues to parrot text-rotation-alignment but now also does so if its value is explicitly set to auto.

Companion to mapbox/mapbox-gl-style-spec#493, mapbox/mapbox-gl-native#6253, and mapbox/mapbox-gl-test-suite#144.

Part of the federation of PRs to address mapbox/mapbox-gl-native#5683

Launch Checklist

  • write tests for all new functionality
  • manually test the debug page
  • get a PR review

cc @jfirebaugh @lbud

@boundsj boundsj changed the title Better handling for undefined icon|text-rotation-alignment [not ready] Better handling for undefined icon|text-rotation-alignment Sep 16, 2016
@boundsj

boundsj commented Sep 16, 2016

Copy link
Copy Markdown
Contributor Author

@lbud I think e9b7cfb should unblock mapbox/mapbox-gl-test-suite#144

cc @lucaswoj @jfirebaugh

@@ -12,19 +12,28 @@ module.exports = SymbolStyleLayer;
SymbolStyleLayer.prototype = util.inherit(StyleLayer, {

getLayoutValue: function(name, globalProperties, featureProperties) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's a shorter and clearer way to write this:

    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;
        }
    }

@jfirebaugh
jfirebaugh force-pushed the boundsj-symbol-complex-default branch from 4231f85 to 01f8d0d Compare September 20, 2016 19:03
@jfirebaugh
jfirebaugh merged commit dde8278 into master Sep 21, 2016
@jfirebaugh
jfirebaugh deleted the boundsj-symbol-complex-default branch September 21, 2016 00:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants