-
Notifications
You must be signed in to change notification settings - Fork 131
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
feat: Add StyleSpans support for Polylines #308
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this contribution! The implementation looks good and this will be useful for polyline customization.
- Please add tests.
- Please add example usage to the demo app and README.
- You may want to rebase or merge from main.
- Please add semantic prefixes to upcoming commits.
val mapApplier = currentComposer.applier as MapApplier? | ||
ComposeNode<PolylineNode, MapApplier>( | ||
factory = { | ||
val polyline = mapApplier?.map?.addPolyline { | ||
addAll(points) | ||
addAllSpans(spans) | ||
clickable(clickable) | ||
endCap(endCap) | ||
geodesic(geodesic) | ||
jointType(jointType) | ||
pattern(pattern) | ||
startCap(startCap) | ||
visible(visible) | ||
width(width) | ||
zIndex(zIndex) | ||
} ?: error("Error adding Polyline") | ||
polyline.tag = tag | ||
PolylineNode(polyline, onClick) | ||
}, | ||
update = { | ||
update(onClick) { this.onPolylineClick = it } | ||
|
||
set(points) { this.polyline.points = it } | ||
set(spans) { this.polyline.spans = it } | ||
set(clickable) { this.polyline.isClickable = it } | ||
set(endCap) { this.polyline.endCap = it } | ||
set(geodesic) { this.polyline.isGeodesic = it } | ||
set(jointType) { this.polyline.jointType = it } | ||
set(pattern) { this.polyline.pattern = it } | ||
set(startCap) { this.polyline.startCap = it } | ||
set(tag) { this.polyline.tag = it } | ||
set(visible) { this.polyline.isVisible = it } | ||
set(width) { this.polyline.width = it } | ||
set(zIndex) { this.polyline.zIndex = it } | ||
} | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you create a private PolylineImpl()
function to combine the nearly identical implementations of the two Polyline()
overloads?
Hi! |
@kikoso Could you please close the PR? (outdated) |
Done! Thanks for the reminder, @el-qq |
Fixes #307 🦕
Polyline
composable with thespans
parameter, allowing to specify spans for each segment ofpoints
Polyline
composable, because I believe it would be confusing with thecolor
parameter - it doesn't make sense to specify it when we specify Spans for every segment. To not make it confusing, I think we'd need to make it nullable without the default color. However, that would be a braking change.