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

Offsets as vectors, padding as edge insets #6079

Merged
merged 12 commits into from
Aug 19, 2016
Merged

Offsets as vectors, padding as edge insets #6079

merged 12 commits into from
Aug 19, 2016

Conversation

1ec5
Copy link
Contributor

@1ec5 1ec5 commented Aug 18, 2016

An offset style attribute is now exposed publicly as an NSValue representing a CGVector instead of an NSArray of NSNumbers. Likewise, a padding style attribute is now exposed publicly as an NSValue representing an NSEdgeInsets or UIEdgeInsets instead of an NSArray of NSNumbers.

This change also fixes round-tripping of padding values due to a difference between the style specification and Foundation regarding the order of edges around a box. It uses a designated initializer on NSEdgeInsets/UIEdgeInsets to ensure correct order when converting from C++ to Objective-C.

Fixes #5947, fixes #6065. Depends on #6076.

/cc @frederoni

@1ec5 1ec5 added bug iOS Mapbox Maps SDK for iOS refactor macOS Mapbox Maps SDK for macOS runtime styling labels Aug 18, 2016
@1ec5 1ec5 added this to the ios-v3.4.0 milestone Aug 18, 2016
@1ec5 1ec5 self-assigned this Aug 18, 2016
@mention-bot
Copy link

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

@1ec5 1ec5 force-pushed the 1ec5-style-array-5947 branch 2 times, most recently from 2c24566 to b231e7c Compare August 18, 2016 19:50
@1ec5
Copy link
Contributor Author

1ec5 commented Aug 18, 2016

Note that if a developer is building against the iOS 10 SDK, they can make use of +[NSValue(NSValueUIGeometryExtensions) valueWithCGVector:] and -[NSValue(NSValueUIGeometryExtensions) CGVectorValue] to work with offsets more succinctly. I considered using UIOffset instead of CGVector, but there’s no equivalent on macOS.

@1ec5 1ec5 force-pushed the 1ec5-style-array-5947 branch from b231e7c to 6e8bedb Compare August 18, 2016 20:24
@frederoni
Copy link
Contributor

This PR also fixes #6081

👍

1ec5 added 12 commits August 19, 2016 14:20
Properties representing optional attributes are qualified with null_resettable. The default value is documented.
Also expand values in documentation comments to the full enumeration values.

Fixes #5949.
Replaced pixels with points in documentation.
Key the array subtype on the last part of the property name. Don’t assume one of the unaccounted-for properties is an offset.
null_resettable semantics aren’t currently respected: #6095.
An offset style attribute is now exposed publicly as an NSValue representing a CGVector instead of an NSArray of NSNumbers. A padding style attribute is now exposed publicly as an NSValue representing an NSEdgeInsets or UIEdgeInsets instead of an NSArray of NSNumbers. This change also fixes round-tripping of padding values due to a difference between the style specification and Foundation regarding the order of edges around a box. Used a designated initializer on NSEdgeInsets/UIEdgeInsets to ensure correct order when converting from C++ to Objective-C.

Fixes #5947, fixes #6065.
Edges shouldn’t be able to cancel out other edges, so a summation is inappropriate here.
@1ec5 1ec5 force-pushed the 1ec5-style-array-5947 branch from 67edd60 to 98c6987 Compare August 19, 2016 22:48
@1ec5 1ec5 merged commit 98c6987 into master Aug 19, 2016
@1ec5 1ec5 deleted the 1ec5-style-array-5947 branch August 19, 2016 23:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS refactor runtime styling
Projects
None yet
3 participants