Modify

Opened 5 years ago

Closed 3 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)

selectedprop.diff (5.2 KB) - added by stoecker 4 years ago.
selectedprop2.diff (5.3 KB) - added by stoecker 4 years ago.
Solve the name issue and update to recent SVN

Download all attachments as: .zip

Change History (26)

comment:1 Changed 5 years ago by IrlJidel

Cc: xeen added

comment:2 Changed 5 years ago by bastiK

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.

comment:3 in reply to:  2 Changed 5 years ago by Don-vip

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 Changed 5 years ago by Aun Johnsen <lists@…>

Would like to have all pseudo-classes supported, there are a lot that can be done with them and when combining them

comment:5 Changed 5 years ago by grinapo

#10540 reports, sir! :) It seems its solution would need this one to have big lumpy selected nodes. :-)

comment:6 Changed 4 years ago by Klumbumbus

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) :)

Changed 4 years ago by stoecker

Attachment: selectedprop.diff added

comment:7 Changed 4 years ago by stoecker

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 Changed 4 years ago by stoecker

Summary: MapCSS: feature request - add pseudo-class for selected objects[patch] MapCSS: feature request - add pseudo-class for selected objects

comment:9 Changed 4 years ago by stoecker

Any comments to the changes?

comment:10 Changed 4 years ago by bastiK

  • Children (way nodes & relation members) neeed to be invalidated as well.
  • DataSet.selectionChanged has the same name and signature as SelectionChangedListener.selectionChanged, but different meaning - this is confusing.

Changed 4 years ago by stoecker

Attachment: selectedprop2.diff added

Solve the name issue and update to recent SVN

comment:11 Changed 4 years ago by stoecker

Fix issue two, children still missing.

comment:12 Changed 4 years ago by Klumbumbus

Ticket #11861 has been marked as a duplicate of this ticket.

comment:13 Changed 3 years ago by bastiK

Owner: changed from team to bastiK

comment:14 Changed 3 years ago by bastiK

In 9284/josm:

refactor some code from StyleCache into separate classes (see #9891)

comment:15 Changed 3 years ago by Don-vip

Milestone: 16.01

comment:16 Changed 3 years ago by Don-vip

Should we delay this ticket (and #10540) to milestone:16.02 and release new tested version now?

comment:17 in reply to:  16 Changed 3 years ago by bastiK

Milestone: 16.0116.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:18 Changed 3 years ago by bastiK

In 9341/josm:

mapcss: basic support for :selected pseudoclass (see #9891)

comment:19 Changed 3 years ago by bastiK

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:20 Changed 3 years ago by Klumbumbus

In 9451/josm:

see #10540, see #9891 - make selected nodes more visible, i.e. always filled and size 6 (like in old XML style)

comment:21 Changed 3 years ago by Klumbumbus

Is there any regression of r9451? I couldn't find problems with boundary relations.

comment:22 Changed 3 years ago by bastiK

I don't expect any regression from [9451].

comment:23 Changed 3 years ago by Don-vip

is this fixed?

comment:24 Changed 3 years ago by bastiK

Resolution: fixed
Status: newclosed

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.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain bastiK.
as The resolution will be set.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.