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

Sketch - Can't (easily) select transparent polygons #752

Open
chughes-lincoln opened this issue Nov 10, 2022 · 14 comments
Open

Sketch - Can't (easily) select transparent polygons #752

chughes-lincoln opened this issue Nov 10, 2022 · 14 comments
Milestone

Comments

@chughes-lincoln
Copy link
Contributor

When you create a polygon you can adjust the fill opacity to make it fully transparent. If you do this you can't easily go back and select this polygon to edit the geometry or attributes. You actually can select the polygon by clicking on the outline, but it no longer recognizes the interior as part of the polygon, so just clicking in the middle of the shape doesn't select it.

@klassenjs
Copy link
Member

I'm not sure how I feel about this.

Part of me thinks that clicking on nothing (like the interior of a polygon with no fill) is expected to select nothing. Part of me thinks it is unusual to set a polygon to no-fill by setting the fill opacity to 0 instead of having a separate control for that.

@chughes-lincoln
Copy link
Contributor Author

My main concern is that I think users will want to add sketches without a fill so that you can easily see what's underneath, and will assume that it's a bug that they can no longer click on the interior.

@klassenjs
Copy link
Member

klassenjs commented Nov 17, 2022

I fully agree the current behavior isn't optimal and can lead to confusing situations. What I'm unsure about is what the "right"/optimal behavior should be. My concern is if there is a large transparent fill polygon that the user doesn't even realize is there (for an extreme example say a state when zoomed into city level) and it interferes with selecting items they can see, that it is also confusing.

I have GeoMoose instances where I have states/counties/various levels of watersheds/etc. loaded as vector layers (with no fill) so the user can select a state/county and use that as a selection filter for another layer (get me all the Wetlands in Lake County type of thing) and it would be really easy for one of those layers to be on and cause an issue. (Or the user could upload a selection area to the scratch layer using GeoJSON/KML, forget about it, and cause the same issue.)

@klassenjs klassenjs added this to the 3.11.0 milestone Jan 20, 2023
@theduckylittle
Copy link
Member

The I've handled this, historically, is to only allow the minimum transparency to be .01-.05 transparency.

It would be a small tweak to the mapbook to do that. Thoughts?

@elil
Copy link
Member

elil commented Jan 27, 2023 via email

@chughes-lincoln
Copy link
Contributor Author

This issue also occurs if you set the highlight fill for results to be transparent (you then can't do anything that requires clicking on results like measuring or buffering results). I handled that by setting the highlight fill to be 0.00001 transparency (perhaps overkill, but it appears transparent to the user).

@klassenjs
Copy link
Member

I still think we need to support both behaviors or large polygons can block the selection of smaller features when zoomed in. Just pushing the min-transparency to not-quite zero is going to break other things. I'd really like a good universal answer to this, but I don't have one at the moment.

@theduckylittle
Copy link
Member

I'm not saying we don't support both behaviours. The styles are completely customizable by the user, but I would expect that if I draw something on the map and even if it looks transparent that I can click on it.

For out-of-the-box behaviour I feel the .01 opacity is a reasonable compromise.

Users could still adjust it if they want true transparency and the vector layers can still be styled however they want (see @chughes-lincoln 's .0000000000000000000000000000000 -breathes- 0000000000001 hack above).

@theduckylittle
Copy link
Member

And this discussion is in the scope of the Sketch layer, none of the others would be directly effected.

@theduckylittle theduckylittle modified the milestones: 3.11.0, 3.12.0 Feb 17, 2023
@chughes-lincoln
Copy link
Contributor Author

For out-of-the-box behavior I feel the .01 opacity is a reasonable compromise.

Interesting caveat is that setting a min of .01 opacity changes where the range starts at for adjusting opacity with the slider, which can prevent the user from making things fully opaque. If I have a min-opacity of 0.01, and a step of 0.1, the highest opacity value I can reach in the slider is 0.91, because another step exceeds the max value of 1.

I did notice that you can combine the above hack with another hack and set the max-opacity to 1.01, which seems to be correctly treated as 100% opaque.

@klassenjs
Copy link
Member

What happens if step is set to 0.099?

Or to minimize round off issues with repeating "decimals" in binary:
set min to 0.00878906250 (.00000010010)
and step to 0.09912109375 (.00011001011)
?

@klassenjs
Copy link
Member

Or for that matter, let the slider hit 0, but set a minimum in whatever function actually applies the value to the style.

@chughes-lincoln
Copy link
Contributor Author

0.099 also works.

@klassenjs klassenjs modified the milestones: 3.12.0, 3.13.0 Sep 15, 2023
@chughes-lincoln
Copy link
Contributor Author

Returning back to this, for my site I set the min opacity to 0.00001 and the max opacity to 1.00001 which works well. The transparency slider works, and sketches are selectable. Setting min to 0.00001 and max to 1, with a step of 0.099999 would probably give the same result (and may prevent any issues that could arise from setting a max opacity greater than 1 - though I haven't seen any so far).

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

No branches or pull requests

4 participants