-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Color redesign & annotations fixes #650
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
macdrevx
added
bug 🪲
Something is broken!
breaking change ⚠️
If your pull request introduces a breaking change and updates are required when version is published
labels
Sep 6, 2021
macdrevx
force-pushed
the
ah/color-representable
branch
from
September 7, 2021 01:28
b161edd
to
3818163
Compare
- Renamed ColorRepresentable to StyleColor - Removed the argument label from its UIColor initializer - Updated the codebase to use type inference with UIColor when possible - Moved the extension on UIColor that adds ExpressionArgumentConvertible conformance to ExpressionArgumentBuilder.swift, and updated it to return an rgba color string instead of an rgba expression. - StyleColor now stores its data as component-wise Doubles instead of as an expression. - Added a public, failable, component-wise initializer to StyleColor - Added an internal, failable, expression-based initializer to StyleColor - Added an internal, failable, rgba-string-based initializer to StyleColor - Renamed ColorRepresentable.rgbaDescription to StyleColor.rgbaString. - Updated StyleColor's Decodable support to be able to handle rgba color strings as well as rgba expressions - Changed StyleColor's Encodable implementation to always encode an rgba color string instead of encoding an rgba expression - Update annotations to use `rgbaString` and `init(rgbaString:)` when serializing and deserializing `StyleColor`s - Update annotation managers to store common layer styles in a dictionary similarly to how annotations store their styles. This provides better handling of `nil` since the `value` parameter of `StyleManager.setStyleLayerPropertyForLayerId(_:property:value:)` is marked nonnull in Objective-C. The previous implementation silenced a warning about this by casting the optional to Any. - Common layer properties are now synced to the layer each display link just like annotations. Use `syncSourceAndLayerIfNeeded()` (formerly named `syncAnnotationsIfNeeded()` to force the sync to happen earlier. - Updated style and annotation templates to consistently include a trailing newline - Made generated test classes final - The `layerType` argument to `Style._layerPropertyDefaultValue(for:property:)` is now of type `LayerType` instead of `String` - Annotation managers now properly restore the default values of any annotation or common style properties that are reset to nil. - Made Expression.Operator conform to CaseIterable for testing purposes - fixed lint in generated code - updated some types to take [TextAnchor] instead of [String] - updated some types to take [TextWritingMode] instead of [String] - updated PointAnnotationManager.textFont implementation to match other common properties - removed stale todo about turf and QueriedFeature - Made generated enums conform to CaseIterable - added integration tests for common properties - added Random.swift test helpers - Add workarounds for text-field and line-gradient - Fix Expression decoding when second array element could be an operator - Make Expression decoding fail if operator is missing - Add integration tests for all annotation properties Fixes #636
macdrevx
force-pushed
the
ah/color-representable
branch
from
September 7, 2021 01:43
3818163
to
234de8c
Compare
Could we run device tests on this PR? |
macdrevx
commented
Sep 7, 2021
macdrevx
commented
Sep 7, 2021
macdrevx
commented
Sep 7, 2021
macdrevx
commented
Sep 7, 2021
Disable line gradient |
[run device tests] [run app device tests]
nishant-karajgikar
approved these changes
Sep 7, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
breaking change ⚠️
If your pull request introduces a breaking change and updates are required when version is published
bug 🪲
Something is broken!
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull request checklist:
Summary of changes
Breaking Changes
ColorRepresentable
toStyleColor
StyleColor
'sUIColor
initializerColorRepresentable.rgbaDescription
toStyleColor.rgbaString
.StyleColor
'sEncodable
implementation to always encode an rgba color string instead of encoding an rgba expressionUIColor
that addsExpressionArgumentConvertible
to return an rgba color string instead of an rgba expression.syncSourceAndLayerIfNeeded()
(formerly namedsyncAnnotationsIfNeeded()
) to force the sync to happen earlier.layerType
argument toStyle._layerPropertyDefaultValue(for:property:)
is now of typeLayerType
instead ofString
Expression
decoding will now fail if the operator is missingPointAnnotationManager.textVariableAnchor
is now of type[TextAnchor]?
instead of[String]?
PointAnnotationManager.textWritingMode
is now of type[TextWritingMode]?
instead of[String]?
Bug Fixes
rgbaString
andinit(rgbaString:)
when serializing and deserializingStyleColor
s (Fixes Polylines and polygons are always black #636)Additions
StyleColor
StyleColor
'sDecodable
support to be able to handle rgba color strings as well as rgba expressions (Fixes Failed to decode Value<ColorRepresentable> when importing layer definition to v10 #577)CaseIterable
Other Changes
StyleColor
now stores its data as component-wiseDouble
s instead of as an expression.StyleColor
StyleColor
UIColor
when possibleUIColor
that addsExpressionArgumentConvertible
conformance to ExpressionArgumentBuilder.swiftnil
since thevalue
parameter ofStyleManager.setStyleLayerPropertyForLayerId(_:property:value:)
is markednonnull
in Objective-C. The previous implementation silenced a warning about this by casting the optional to Any.