Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Add function and interpolation mode to style property docs #7958

Merged
merged 3 commits into from
Feb 9, 2017

Conversation

boundsj
Copy link
Contributor

@boundsj boundsj commented Feb 6, 2017

Fixes #7935

This adds documentation to each style layer property that specifies the function and interpolation mode combinations that will work for the property.

In some cases, function and interpolation stop combination values that don't make sense will be coerced into a values that do. For example, a camera function with and exponential interpolation mode that is set on a property that is a piecewise-constant function will be converted into a camera function with an interval interpolation mode.

@boundsj boundsj added documentation GL JS parity For feature parity with Mapbox GL JS iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS runtime styling labels Feb 6, 2017
@boundsj boundsj added this to the ios-v3.5.0 milestone Feb 6, 2017
@boundsj boundsj self-assigned this Feb 6, 2017
@boundsj boundsj requested a review from 1ec5 February 6, 2017 23:14
@mention-bot
Copy link

@boundsj, thanks for your PR! By analyzing this pull request, we identified @1ec5, @incanus and @jfirebaugh to be potential reviewers.

'interpolation mode, an `MGLSourceStyleFunction` using an `MGLInterpolationModeExponential`, `MGLInterpolationModeInterval`, `MGLInterpolationModeCategorical, or `MGLInterpolationModeIdentity` ' +
'interpolation mode, or an `MGLCompositeStyleFunction` using an `MGLInterpolationModeExponential`, `MGLInterpolationModeInterval` or `MGLInterpolationModeCategorical` interpolation mode`';
} else {
if (property.function == "interpolated") {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: use the === operator unless type coercion is required.

doc += '`\n\nThis property can be set to an `MGLStyleConstantValue` or an `MGLCameraStyleFunction` using an `MGLInterpolationModeExponential` or `MGLInterpolationModeInterval` ' +
'interpolation mode';
} else {
doc += '`\n\nThis property can be set to an `MGLStyleConstantValue` or an `MGLCameraStyleFunction` using an `MGLInterpolationModeInterval` interpolation mode';
Copy link
Contributor

Choose a reason for hiding this comment

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

Funky indentation.

if (property["property-function"]) {
doc += '`\n\nThis property can be set to an `MGLStyleConstantValue`, an `MGLCameraStyleFunction` using an `MGLInterpolationModeExponential` or `MGLInterpolationModeInterval` ' +
'interpolation mode, an `MGLSourceStyleFunction` using an `MGLInterpolationModeExponential`, `MGLInterpolationModeInterval`, `MGLInterpolationModeCategorical, or `MGLInterpolationModeIdentity` ' +
'interpolation mode, or an `MGLCompositeStyleFunction` using an `MGLInterpolationModeExponential`, `MGLInterpolationModeInterval` or `MGLInterpolationModeCategorical` interpolation mode`';
Copy link
Contributor

Choose a reason for hiding this comment

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

End this sentence with a period.

Copy link
Contributor

@friedbunny friedbunny left a comment

Choose a reason for hiding this comment

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

Concatenating strings is leading to long, difficult to follow sentences — could we organize these into tables or otherwise section them?

if (property["property-function"]) {
doc += '`\n\nThis property can be set to an `MGLStyleConstantValue`, an `MGLCameraStyleFunction` using an `MGLInterpolationModeExponential` or `MGLInterpolationModeInterval` ' +
'interpolation mode, an `MGLSourceStyleFunction` using an `MGLInterpolationModeExponential`, `MGLInterpolationModeInterval`, `MGLInterpolationModeCategorical, or `MGLInterpolationModeIdentity` ' +
'interpolation mode, or an `MGLCompositeStyleFunction` using an `MGLInterpolationModeExponential`, `MGLInterpolationModeInterval` or `MGLInterpolationModeCategorical` interpolation mode`.';
Copy link
Contributor

Choose a reason for hiding this comment

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

The end of this string has a stray tick before the period.

Copy link
Contributor

Choose a reason for hiding this comment

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

Which leads to this, on MGLCircleStyleLayer.circleOpacity:

screen shot 2017-02-08 at 2 08 10 pm

@1ec5
Copy link
Contributor

1ec5 commented Feb 8, 2017

Concatenating strings is leading to long, difficult to follow sentences — could we organize these into tables or otherwise section them?

Yes. At the very least, we should use semicolons to separate list items that contain commas.

@boundsj
Copy link
Contributor Author

boundsj commented Feb 8, 2017

@friedbunny @1ec5 I did not find markup for creating arbitrary tables in jazzy. Are the changes in a749e82 suitable? Example:

screenshot 2017-02-08 12 12 12

@friedbunny
Copy link
Contributor

That looks much better, thanks @boundsj. For tables in jazzy, we’ve been resorting to HTML (but that tends to look terrible inline).

@friedbunny
Copy link
Contributor

Pushed 9ae227e, which adds even more bullets:

screen shot 2017-02-08 at 6 00 36 pm

@incanus
Copy link
Contributor

incanus commented Feb 8, 2017

even more bullets

@1ec5
Copy link
Contributor

1ec5 commented Feb 8, 2017

For tables in jazzy, we’ve been resorting to HTML (but that tends to look terrible inline).

We also have some instances of Markdown tables in the jazzy guides, but we only get away with that because the guides don’t appear in Quick Help or any headers.

@boundsj
Copy link
Contributor Author

boundsj commented Feb 8, 2017

I'm liking the even more bullets look anyway.

@@ -281,6 +281,30 @@ global.propertyDoc = function (propertyName, property, layerType, kind) {
doc += `\n\nThis attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#${anchor}"><code>${property.original}</code></a> layout property in the Mapbox Style Specification.`;
}
}
doc += '\n\nThis property can be set to one of the following values:\n\n' +
Copy link
Contributor

Choose a reason for hiding this comment

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

We’re saying what kind of values the property can be set to, not which values specifically. Also, avoid passive voice:

You can set this property to an instance of:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in c602839

doc += '\n\nThis property can be set to one of the following values:\n\n' +
'- `MGLStyleConstantValue`\n';
if (property["property-function"]) {
doc += '- `MGLCameraStyleFunction` with an interpolation mode of:\n' +
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI, we’ve been using * syntax in other places, but I don’t think it matters much.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in c602839 for consistency

@@ -9,34 +9,70 @@ NS_ASSUME_NONNULL_BEGIN

/**
Controls the scaling behavior of the circle when the map is pitched.

This property can be set to one of the following values:
Copy link
Contributor

Choose a reason for hiding this comment

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

This isn’t a property, it’s an enumeration value. Enumeration values don’t need this extra text.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for catching this! Updated in c602839

@boundsj boundsj force-pushed the boundsj-document-interpolation-mode branch from 9ae227e to c602839 Compare February 9, 2017 00:27
Copy link
Contributor

@1ec5 1ec5 left a comment

Choose a reason for hiding this comment

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

Looks good! Before merging, please make sure the various regular expressions in make darwin-update-examples (or make style-code, which depends on it) can cope with the new documentation, just in case.

@boundsj boundsj merged commit a49301a into master Feb 9, 2017
@boundsj boundsj deleted the boundsj-document-interpolation-mode branch February 9, 2017 05:11
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation GL JS parity For feature parity with Mapbox GL JS iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS runtime styling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants