From 6d3e7c932e7531d2e508be7668a5b9cc08fb95ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= Date: Thu, 1 Nov 2018 10:25:36 +0100 Subject: [PATCH] pt: show directions in hover and selected --- pt.json | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/pt.json b/pt.json index 210e56f..3f4bb5b 100644 --- a/pt.json +++ b/pt.json @@ -84,6 +84,8 @@ "{% set refs = [] %}", "{% set dirForward = false %}", "{% set dirBackward = false %}", + "{% set hover = false %}", + "{% set selected = false %}", "{% for master in masters %}", " {% if master.tags.public_transport == 'stop_area' %}", " {% set stopName = master.tags.name %}", @@ -104,6 +106,9 @@ " {% else %}{% set dirForward = true %}{% set dirBackward = true %}", " {% endif %}", " {% endif %}", + "", + " {% if master.flags.hover %}{% set hover = master.dir|default('both') %}{% endif %}", + " {% if master.flags.selected %}{% set selected = master.dir|default('both') %}{% endif %}", "{% endfor %}", "", "{% set refs = refs|unique|natsort({ insensitive: true }) %}", @@ -118,20 +123,20 @@ "
  • ", "
    {{ markerCircle({fillColor:const[master.tags.route].color})|raw }}
    {{ const[master.tags.route].sign|raw }}
    ", " {% if master.tags.ref and master.tags.name %}{{ master.tags.ref }} - {{ master.tags.name|default(master.tags.ref) }}{% elseif master.tags.ref %}{{ master.tags.ref }}{% elseif master.tags.name %}{{ master.tags.name }}{% else %}{{ trans('unnamed') }}{% endif %}", - " {{ tagTrans('route', master.tags.route) }}", + " {{ tagTrans('route', master.tags.route) }}{{ master.dir }}", "
  • ", " {% endif %}", "{% endfor %}", "" ], - "styles": "{% if isStop and stopCount > 0 %}{% elseif isWay %}way{% else %}{% endif %}", + "styles": "{% if isStop and stopCount > 0 %}{% elseif isWay %}way{% if hover %},hover{% endif %}{% if selected %},selected{% endif %}{% endif %}", "listStopsMarkerSign": null, "listStopsMarkerSymbol": "{{ markerCircle({ width: 5, color: color, fillOpacity: '1', radius: 3 })|raw }}", "listStopsExclude": "{{ not isStop or stopCount == 0 }}", "listStopsTitle": "{% if tags %}{{ tags.name|default(stopName)|default(trans('unknown')) }}{% else %}
  • {{ trans('loading') }}
  • {% endif %}", "listStopsDescription": "{{ refs|join(' ยท ') }}", "listRoutesExclude": "true", - "markerSymbol": "{% if isStop and stopCount > 0 %}{{ markerCircle({ width: 0, fill: true, fillColor: color, fillOpacity: '1', radius: 5 })|raw }}{% endif %}", + "markerSymbol": "{% if isStop and stopCount > 0 %}{% if hover or selected %}{{ markerCircle({ width: 0, fill: true, fillColor: hover ? '#000000' : '#3f3f3f', fillOpacity: '1', radius: 7 })|raw }}{% else %}{{ markerCircle({ width: 0, fill: true, fillColor: color, fillOpacity: '1', radius: 5 })|raw }}{% endif %}{% endif %}", "style:way": { "width": "3", "opacity": "{% if (dirForward and dirBackward) or (not dirForward and not dirBackward) %}1{% else %}0{% endif %}", @@ -147,6 +152,30 @@ "pattern-angleCorrection": "{% if dirBackward %}180{% else %}0{% endif %}", "pattern-path-weight": "2", "pattern-path-color": "{{ color|default('#ff0000') }}" + }, + "style:hover": { + "pane": "hover", + "width": "{% if hover == 'forward' or hover == 'backward' %}0{% else %}4{% endif %}", + "color": "black", + "pattern": "{% if hover == 'forward' or hover == 'backward' %}arrowHead{% endif %}", + "pattern-pixelSize": "4", + "pattern-repeat": "7", + "pattern-polygon": "", + "pattern-path-weight": "2", + "pattern-path-color": "black", + "pattern-path-angleCorrection": "{% if hover == 'backward' %}180{% else %}0{% endif %}" + }, + "style:selected": { + "pane": "selected", + "width": "{% if selected == 'forward' or selected == 'backward' %}0{% else %}3{% endif %}", + "color": "#3f3f3f", + "pattern": "{% if selected == 'forward' or selected == 'backward' %}arrowHead{% endif %}", + "pattern-pixelSize": "4", + "pattern-repeat": "7", + "pattern-polygon": "", + "pattern-path-weight": "2", + "pattern-path-color": "#3f3f3f", + "pattern-path-angleCorrection": "{% if selected == 'backward' %}180{% else %}0{% endif %}" } }, "info": [