-
-
Notifications
You must be signed in to change notification settings - Fork 859
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 BlendMode
support to CircleLayer
#1869
Conversation
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.
do you have an example after picture or some code to test with? Also any particular reason to hard code the BlendMode vs pass it in as a parameter to the layer? Thanks for your contribution!
@mootw i could not test it because of dependency hell. But it uses the same blend mode as in the polygons so the behaviour should be the same. |
@mootw then i guess it would be better to also parametrize it in the polygons |
@@ -92,6 +93,7 @@ class CirclePainter extends CustomPainter { | |||
for (final radius in pointsByRadius.keys) { | |||
final pointsByRadiusColor = pointsByRadius[radius]!; | |||
final radiusPaint = paint..strokeWidth = radius * 2; | |||
radiusPaint.blendMode = BlendMode.src; |
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.
You should move it to first assignment (paintPoint) to avoid useless re-assignment.
@@ -103,6 +105,7 @@ class CirclePainter extends CustomPainter { | |||
for (final radius in pointsByRadius.keys) { | |||
final pointsByRadiusColor = pointsByRadius[radius]!; | |||
final radiusPaint = paint..strokeWidth = radius * 2; | |||
radiusPaint.blendMode = BlendMode.src; |
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.
You can remove it if previous comment resolved.
@@ -73,6 +73,7 @@ class CirclePainter extends CustomPainter { | |||
for (final borderWidth in pointsBorder[color]!.keys) { | |||
final pointsByRadius = pointsBorder[color]![borderWidth]!; | |||
final radiusPaint = paint..strokeWidth = borderWidth; | |||
radiusPaint.blendMode = BlendMode.src; |
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.
You should move it to first assignment (paintBorder) to avoid useless re-assignment.
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.
Hey @Y0ngg4n, thanks for this so far!
Some changes do need to be made before we can merge this though:
- We will require an example (or an update to the exisiting one), or at least some code to test on this occassion
- It may also be a good idea to incorporate this into the polygon and polyline layers, although they use some more complex logic, so it may not work very performantly (may require more calls to
saveLayer
). This may be out of the scope of this PR? - And as said, it should become a property on both the
CircleLayer
andCircleMarker
, with the same decision logic as other properties.
BlendMode
support to CircleLayer
@JaffaKetchup thank you for your answer.
|
I'm going to close this for now. This is a good option to introduce to all the painting layers, but that needs a new PR. |
Currently overlapping Polygons are adding up in stroke color. To fix this it adds the BlendMode.src to all so this should not happen anymore.
Before: