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

Rename textField, textFont, textSize, circlePitchScale, *Translate, *TranslateAnchor - #7603

Merged
1ec5 merged 3 commits into
release-ios-v3.4.0from
1ec5-style-rename-font-6098
Jan 8, 2017
Merged

1ec5 merged 3 commits into
release-ios-v3.4.0from
1ec5-style-rename-font-6098

Conversation

@1ec5

@1ec5 1ec5 commented Jan 5, 2017 •

Copy link
Copy Markdown
Contributor

This PR renames the following properties:

  • MGLSymbolStyleLayer.textField to text, in anticipation of Rename text-field to text mapbox-gl-style-spec#646
    The developer would expect a textField property to hold an NSTextField or UITextField, or at least some kind of editable control, but not an NSString. There is such a thing as NSText on macOS, but no one ever uses it directly. On the other hand, UILabel.text, analogous to the text-field layout property, is one of the most commonly used properties on iOS.
  • MGLSymbolStyleLayer.textFont to textFontNames
    The developer would expect to set this property to an NSFont or UIFont, or perhaps an NSFontDescriptor or UIFontDescriptor, but definitely not an array of strings. textFontNames is also consistent with NSFont.fontName, UIFont.fontName, and MGLSymbolStyleLayer.iconImageName.
  • MGLSymbolStyleLayer.textSize to textFontSize in anticipation of Rename text-size to text-font-size mapbox-gl-style-spec#650
    Contrary to the property’s current name, it does not specify the dimensions of the overall label the way text-max-width does. Instead, it specifies the font size in pixels. This inconsistency means a developer would be tempted to set the property to a CGSize or NSSize value instead of an NSNumber.
  • MGLCircleStyleLayer.circlePitchScale to circleScaleAlignment, in anticipation of Rename circle-pitch-scale to circle-scale-alignment mapbox-gl-style-spec#645
    The developer would expect to set this property to a CGFloat, especially considering that we renamed MGLSymbolStyleLayer.iconScale (renamed from iconSize) is numeric.
  • MGLCircleStyleLayer.circleTranslate to circleTranslation, circleTranslateAnchor to circleTranslationAnchor, MGLCircleTranslateAnchor to MGLCircleTranslationAnchor, and the corresponding fill, line, and symbol properties and enumerations, to complete the work done in Use appropriate part of speech for properties #7457

Of these changes, MGLSymbolStyleLayer.text is perhaps the most disruptive, but I also see the upstream property inevitably getting renamed to something or other.

Fixes #6098 once and for all. Past this point, if we ever rename any properties unilaterally in the iOS and macOS SDKs, we should not only declare the old name but make it available (albeit deprecated), to minimize disruption. But I’m pretty confident that this will be the last batch of renames for existing properties.

/cc @boundsj @friedbunny @ericrwolfe

@1ec5 1ec5 added iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS refactor runtime styling labels Jan 5, 2017
@1ec5 1ec5 added this to the ios-v3.4.0 milestone Jan 5, 2017
@1ec5 1ec5 self-assigned this Jan 5, 2017
@1ec5
1ec5 requested a review from frederoni January 5, 2017 11:43
@mention-bot

Copy link
Copy Markdown

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

@1ec5 1ec5 mentioned this pull request Jan 5, 2017
6 tasks done
@1ec5
1ec5 force-pushed the 1ec5-style-rename-font-6098 branch 2 times, most recently from 0244d2e to 3043453 Compare January 6, 2017 22:36
@1ec5 1ec5 changed the title Rename textField, textFont, circlePitchScale Rename textField, textFont, textSize, circlePitchScale, *Translate, *TranslateAnchor Jan 6, 2017
@1ec5

1ec5 commented Jan 6, 2017

Copy link
Copy Markdown
Contributor Author

On @jfirebaugh’s suggestion in #6098 (comment), I also replaced translate with translation in several property names in anticipation of mapbox/mapbox-gl-style-spec#201.

Finally – and I mean finally – textSize is now textFontSize. This change is also tracked upstream in mapbox/mapbox-gl-style-spec#650, but I don’t think we should wait for a new version of the style specification to make it.

@1ec5
1ec5 requested a review from frederoni January 7, 2017 08:34

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 URL leads to the root of the style spec. Isn't the correct ref #paint-circle-translate?

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.

Good catch – all the paint property links were broken. Fixed in d3a2ffe.

1ec5 added 2 commits January 7, 2017 15:46
…tch-scale

Reduced the likelihood that the developer might attempt to set textField to an NSTextField or UITextField, or textFont to an NSFont or UIFont, or textSize to a CGSize or NSSize, or circlePitchScale to a number (given iconScale).
@1ec5
1ec5 force-pushed the 1ec5-style-rename-font-6098 branch from 3043453 to bf8d037 Compare January 7, 2017 23:47
@1ec5
1ec5 merged commit d3a2ffe into release-ios-v3.4.0 Jan 8, 2017
1ec5 added a commit to mapbox/mapbox-gl-style-spec that referenced this pull request Jan 8, 2017
Renamed more properties according to mapbox/mapbox-gl-native#7603.
@friedbunny
friedbunny deleted the 1ec5-style-rename-font-6098 branch January 10, 2017 16:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS refactor runtime styling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants