Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

lenoch0d
Copy link

Fixes #307 🦕

  • updated google play maps services which support the new feature
  • added new Polyline composable with the spans parameter, allowing to specify spans for each segment of points
  • I did not extend the existing Polyline composable, because I believe it would be confusing with the color 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.

@google-cla
Copy link

google-cla bot commented Apr 17, 2023

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.

@lenoch0d lenoch0d changed the title Add StyleSpans support for Polylines feat: Add StyleSpans support for Polylines Apr 17, 2023
@wangela wangela self-requested a review April 29, 2023 01:57
@wangela wangela requested a review from kikoso July 28, 2023 16:57
Copy link
Member

@wangela wangela left a 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.

Comment on lines +146 to +181
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 }
}
)
Copy link
Contributor

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?

@el-qq
Copy link
Contributor

el-qq commented Apr 8, 2024

Hi!
I wanted to check in and see if you're planning to continue working on it? We're looking forward to potentially incorporating these changes into our project.

@el-qq
Copy link
Contributor

el-qq commented Apr 23, 2024

@kikoso Could you please close the PR? (outdated)

@kikoso kikoso closed this Apr 23, 2024
@kikoso
Copy link
Collaborator

kikoso commented Apr 23, 2024

Done! Thanks for the reminder, @el-qq

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support of StyleSpan in Polylines
5 participants