Opened 11 years ago
Closed 9 years ago
#9891 closed enhancement (fixed)
[patch] MapCSS: feature request - add pseudo-class for selected objects
Reported by: | IrlJidel | Owned by: | bastiK |
---|---|---|---|
Priority: | normal | Milestone: | 16.02 |
Component: | Core mappaint | Version: | |
Keywords: | mapcss | Cc: | xeen |
Description
Would it be possible to add support for a pseudo-class for selected objects?
My main interest in this feature is through the use of the LessObtrusiveNodes mapcss style.
I'd like to modify it to disable it for child nodes when I select a way.
http://wiki.openstreetmap.org/wiki/MapCSS/0.2#Pseudo-classes mentions:
"Interactive clients can support :hover and :active pseudo-classes."
Looking at P2's mapcss, it seems to support :hover and :selected
https://raw.githubusercontent.com/openstreetmap/potlatch2/master/resources/stylesheets/core_interactive.css
Thanks
Attachments (2)
Change History (26)
comment:1 by , 11 years ago
Cc: | added |
---|
follow-up: 3 comment:2 by , 11 years ago
comment:3 by , 11 years ago
Replying to bastiK:
However I would be even more useful to improve the default node drawing in JOSM, so this workaround style is no longer needed. The yellow squares are too much clutter, especially at low zoom.
+1 but it may require more work and I think we already have a ticket for this :) Moreover this pseudo class could be used for other styles, so it's a good thing :)
comment:4 by , 11 years ago
Would like to have all pseudo-classes supported, there are a lot that can be done with them and when combining them
comment:5 by , 11 years ago
#10540 reports, sir! :) It seems its solution would need this one to have big lumpy selected nodes. :-)
comment:6 by , 10 years ago
Is implementing the :selected
pseudo class a big deal? Could this be in this milestone? I would love to fix #10540 (make selected nodes bigger and filled) :)
by , 10 years ago
Attachment: | selectedprop.diff added |
---|
comment:7 by , 10 years ago
First example attached. It does still not do what it should do for me, but the selected feature seems to work as it should.
The comments in getRole() allow using role() inside of relation[name="myname"] > node:selected { printtext: role(); }
Any reason why this is currently forbidden?
I want to make display of certain nodes depend on the fact if another node of the same relation with equal role is selected. That's still not possible.
comment:8 by , 10 years ago
Summary: | MapCSS: feature request - add pseudo-class for selected objects → [patch] MapCSS: feature request - add pseudo-class for selected objects |
---|
comment:10 by , 10 years ago
- Children (way nodes & relation members) neeed to be invalidated as well.
DataSet.selectionChanged
has the same name and signature asSelectionChangedListener.selectionChanged
, but different meaning - this is confusing.
by , 10 years ago
Attachment: | selectedprop2.diff added |
---|
Solve the name issue and update to recent SVN
comment:13 by , 9 years ago
Owner: | changed from | to
---|
comment:15 by , 9 years ago
Milestone: | → 16.01 |
---|
follow-up: 17 comment:16 by , 9 years ago
Should we delay this ticket (and #10540) to milestone:16.02 and release new tested version now?
comment:17 by , 9 years ago
Milestone: | 16.01 → 16.02 |
---|
Replying to Don-vip:
Should we delay this ticket (and #10540) to milestone:16.02 and release new tested version now?
Yes, certainly.
comment:19 by , 9 years ago
There is now basic support for the :selected
pseudoclass.
It is like a magic word: As soon as :selected
is encountered in the style sheet, the default selected handling is turned off and the style author has full control.
Node symbols and line elements work best at the moment. For some elements, however, the default selected handling is not turned off, as I don't know how to properly replicate it with mapcss syntax.
Especially problematic is the boundary of areas (closed ways and multipolygons). Currently, the logic is in the Java code:
If a way object has no proper line element in the end, then we look for an area element and add a default line element with the color of that area.
This is done implicitly and not reflected in the mapcss style, so there is no direct way to access and change the selected style of these default line elements.
A similar problem is with default node and line elements, e.g. for completely untagged nodes and ways. For the default style, we have a hackish solution:
node[!is_prop_set("icon-image")]!.maxspeedclass { ... }
It relies on the fact, that all rules with the property icon-image
are set before and this is the last rule that deals with nodes. So it doesn't play well with additional mapcss styles that are added to extend the default style.
comment:21 by , 9 years ago
Is there any regression of r9451? I couldn't find problems with boundary relations.
comment:24 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Partially fixed - for the main use-case (node symbols) it works. The final goal would be that all selected handling is configured in the style sheet and the hardcoded stuff can be removed.
Closing for now. Please reopen if it doesn't work as expected.
I support this request in principle.
However I would be even more useful to improve the default node drawing in JOSM, so this workaround style is no longer needed. The yellow squares are too much clutter, especially at low zoom.