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

Add function and interpolation mode to style property docs - #7958

Merged
boundsj merged 3 commits into
masterfrom
boundsj-document-interpolation-mode
Feb 9, 2017
Merged

boundsj merged 3 commits into
masterfrom
boundsj-document-interpolation-mode

Conversation

@boundsj

@boundsj boundsj commented Feb 6, 2017

Copy link
Copy Markdown
Contributor

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
Copy Markdown

@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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

@friedbunny friedbunny left a comment

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.

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
Copy Markdown
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
Copy Markdown
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

1ec5 commented Feb 8, 2017

Copy link
Copy Markdown
Contributor

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

boundsj commented Feb 8, 2017

Copy link
Copy Markdown
Contributor Author

@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

@boundsj boundsj mentioned this pull request Feb 8, 2017
16 of 18 tasks
@friedbunny

Copy link
Copy Markdown
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
Copy Markdown
Contributor

Pushed 9ae227e, which adds even more bullets:

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

@incanus

incanus commented Feb 8, 2017

Copy link
Copy Markdown
Contributor

even more bullets

@1ec5

1ec5 commented Feb 8, 2017

Copy link
Copy Markdown
Contributor

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

boundsj commented Feb 8, 2017

Copy link
Copy Markdown
Contributor Author

I'm liking the even more bullets look anyway.

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.

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
Copy Markdown
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

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.

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

Copy link
Copy Markdown
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

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.

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

Copy link
Copy Markdown
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

@1ec5 1ec5 left a comment

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.

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