- Timestamp:
- 2020-03-23T14:24:59+01:00 (5 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ConditionFactory.java
r15990 r16199 448 448 final String index; 449 449 final Op op; 450 final boolean isFirstOrLast; 450 451 451 452 /** … … 457 458 this.index = index; 458 459 this.op = op; 460 isFirstOrLast = op == Op.EQ && ("1".equals(index) || "-1".equals(index)); 459 461 } 460 462 -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Selector.java
r16191 r16199 35 35 import org.openstreetmap.josm.gui.mappaint.Environment; 36 36 import org.openstreetmap.josm.gui.mappaint.Range; 37 import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.IndexCondition; 37 38 import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.OpenEndPseudoClassCondition; 38 39 import org.openstreetmap.josm.tools.CheckParameterUtil; … … 220 221 return; 221 222 } 222 for (int i = 0; i < count; i++) { 223 if (getter.apply(i).equals(e.osm) && link.matches(e.withParentAndIndexAndLinkContext(parent, i, count))) { 223 // see #18964 224 int step = firstAndLastOnly() ? count - 1 : 1; 225 for (int i = 0; i < count; i += step) { 226 if (getter.apply(i).equals(e.osm) 227 && link.matches(e.withParentAndIndexAndLinkContext(parent, i, count))) { 224 228 e.parent = parent; 225 229 e.index = i; … … 228 232 } 229 233 } 234 } 235 236 private boolean firstAndLastOnly() { 237 for (Condition c : link.conds) { 238 if (!(c instanceof IndexCondition) || !((IndexCondition) c).isFirstOrLast) { 239 return false; 240 } 241 } 242 return true; 230 243 } 231 244
Note:
See TracChangeset
for help on using the changeset viewer.