Modify

Opened 10 years ago

Closed 8 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 9 years ago.
selectedprop2.diff (5.3 KB ) - added by stoecker 9 years ago.
Solve the name issue and update to recent SVN

Download all attachments as: .zip

Change History (26)

comment:1 by IrlJidel, 10 years ago

Cc: xeen added

comment:2 by bastiK, 10 years ago

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.

in reply to:  2 comment:3 by Don-vip, 10 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 Aun Johnsen <lists@…>, 10 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 grinapo, 9 years ago

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

comment:6 by Klumbumbus, 9 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 stoecker, 9 years ago

Attachment: selectedprop.diff added

comment:7 by stoecker, 9 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 stoecker, 9 years ago

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

comment:9 by stoecker, 9 years ago

Any comments to the changes?

comment:10 by bastiK, 9 years ago

  • 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.

by stoecker, 9 years ago

Attachment: selectedprop2.diff added

Solve the name issue and update to recent SVN

comment:11 by stoecker, 9 years ago

Fix issue two, children still missing.

comment:12 by Klumbumbus, 9 years ago

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

comment:13 by bastiK, 8 years ago

Owner: changed from team to bastiK

comment:14 by bastiK, 8 years ago

In 9284/josm:

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

comment:15 by Don-vip, 8 years ago

Milestone: 16.01

comment:16 by Don-vip, 8 years ago

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

in reply to:  16 comment:17 by bastiK, 8 years ago

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 by bastiK, 8 years ago

In 9341/josm:

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

comment:19 by bastiK, 8 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:20 by Klumbumbus, 8 years ago

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 by Klumbumbus, 8 years ago

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

comment:22 by bastiK, 8 years ago

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

comment:23 by Don-vip, 8 years ago

is this fixed?

comment:24 by bastiK, 8 years ago

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. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.