From cf0214d06a2b08f29c1418316412987e768d819c Mon Sep 17 00:00:00 2001 From: Quincy Morgan Date: Tue, 18 Dec 2018 11:11:15 -0500 Subject: [PATCH] Add the Issues pane --- data/core.yaml | 4 ++ dist/locales/en.json | 67 ++++-------------------- modules/ui/background.js | 4 +- modules/ui/help.js | 2 + modules/ui/init.js | 6 +++ modules/ui/issues.js | 110 +++++++++++++++++++++++++++++++++++++++ modules/ui/map_data.js | 2 + 7 files changed, 138 insertions(+), 57 deletions(-) create mode 100644 modules/ui/issues.js diff --git a/data/core.yaml b/data/core.yaml index 2f5214e3b..39ee8def3 100644 --- a/data/core.yaml +++ b/data/core.yaml @@ -881,6 +881,10 @@ en: indirect: "**Some restrictions display the text \"(indirect)\" and are drawn lighter.**" indirect_example: "These restrictions exist because of another nearby restriction. For example, an \"Only Straight On\" restriction will indirectly create \"No Turn\" restrictions for all other paths through the intersection." indirect_noedit: "You may not edit indirect restrictions. Instead, edit the nearby direct restriction." + issues: + title: Issues + description: Issues + key: I intro: done: done ok: OK diff --git a/dist/locales/en.json b/dist/locales/en.json index c4ae1b817..c0e35c271 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -1047,6 +1047,11 @@ } } }, + "issues": { + "title": "Issues", + "description": "Issues", + "key": "I" + }, "intro": { "done": "done", "ok": "OK", @@ -7550,6 +7555,9 @@ "SPW_PICC": { "name": "SPW(allonie) PICC numerical imagery" }, + "US-TIGER-Roads-2012": { + "name": "TIGER Roads 2012" + }, "US-TIGER-Roads-2014": { "description": "At zoom level 16+, public domain map data from the US Census. At lower zooms, only changes since 2006 minus changes already incorporated into OpenStreetMap", "name": "TIGER Roads 2014" @@ -7558,10 +7566,6 @@ "description": "Yellow = Public domain map data from the US Census. Red = Data not found in OpenStreetMap", "name": "TIGER Roads 2017" }, - "US-TIGER-Roads-2018": { - "description": "Yellow = Public domain map data from the US Census. Red = Data not found in OpenStreetMap", - "name": "TIGER Roads 2018" - }, "US_Forest_Service_roads_overlay": { "description": "Highway: Green casing = unclassified. Brown casing = track. Surface: gravel = light brown fill, Asphalt = black, paved = gray, ground =white, concrete = blue, grass = green. Seasonal = white bars", "name": "U.S. Forest Roads Overlay" @@ -7578,12 +7582,6 @@ }, "name": "UrbIS-Ortho 2017" }, - "UrbISOrtho2018": { - "attribution": { - "text": "Realized by means of Brussels UrbIS®© - Distribution & Copyright CIRB" - }, - "name": "UrbIS-Ortho 2018" - }, "UrbisAdmFR": { "attribution": { "text": "Realized by means of Brussels UrbIS®© - Distribution & Copyright CIRB" @@ -7668,33 +7666,11 @@ "description": "Japan GSI Standard Map. Widely covered.", "name": "Japan GSI Standard Map" }, - "helsingborg-orto": { + "hike_n_bike": { "attribution": { - "text": "© Helsingborg municipality" + "text": "© OpenStreetMap contributors" }, - "description": "Orthophotos from the municipality of Helsingborg 2016, public domain", - "name": "Helsingborg Orthophoto" - }, - "kalmar-orto-2014": { - "attribution": { - "text": "© Kalmar municipality" - }, - "description": "Orthophotos for the north coast of the municipality of Kalmar 2014", - "name": "Kalmar North Orthophoto 2014" - }, - "kalmar-orto-2016": { - "attribution": { - "text": "© Kalmar municipality" - }, - "description": "Orthophotos for the south coast of the municipality of Kalmar 2016", - "name": "Kalmar South Orthophoto 2016" - }, - "kalmar-orto-2018": { - "attribution": { - "text": "© Kalmar municipality" - }, - "description": "Orthophotos for urban areas of the municipality of Kalmar 2018", - "name": "Kalmar Urban Orthophoto 2018" + "name": "Hike & Bike" }, "kelkkareitit": { "attribution": { @@ -7717,20 +7693,6 @@ "description": "Mosaic of Swedish orthophotos from the period 1970–1980. Is under construction.", "name": "Lantmäteriet Historic Orthophoto 1975" }, - "lantmateriet-topowebb": { - "attribution": { - "text": "© Lantmäteriet, CC0" - }, - "description": "Topographic map of Sweden 1:50 000", - "name": "Lantmäteriet Topographic Map" - }, - "linkoping-orto": { - "attribution": { - "text": "© Linköping municipality" - }, - "description": "Orthophotos from the municipality of Linköping 2010, open data", - "name": "Linköping Orthophoto" - }, "mapbox_locator_overlay": { "attribution": { "text": "Terms & Feedback" @@ -7795,13 +7757,6 @@ }, "name": "Stamen Terrain" }, - "stockholm-orto": { - "attribution": { - "text": "© Stockholm municipality, CC0" - }, - "description": "Orthophotos from the municipality of Stockholm 2015, CC0 license", - "name": "Stockholm Orthophoto" - }, "tf-cycle": { "attribution": { "text": "Maps © Thunderforest, Data © OpenStreetMap contributors" diff --git a/modules/ui/background.js b/modules/ui/background.js index 5c2f3ebdb..d82ff280a 100644 --- a/modules/ui/background.js +++ b/modules/ui/background.js @@ -17,6 +17,7 @@ import { uiBackgroundOffset } from './background_offset'; import { uiCmd } from './cmd'; import { uiDisclosure } from './disclosure'; import { uiHelp } from './help'; +import { uiIssues } from './issues'; import { uiMapData } from './map_data'; import { uiMapInMap } from './map_in_map'; import { uiSettingsCustomBackground } from './settings/custom_background'; @@ -310,8 +311,9 @@ export function uiBackground(context) { _shown = show; if (show) { - uiMapData.hidePane(); uiHelp.hidePane(); + uiIssues.hidePane(); + uiMapData.hidePane(); update(); pane diff --git a/modules/ui/help.js b/modules/ui/help.js index 195c34819..20883e66c 100644 --- a/modules/ui/help.js +++ b/modules/ui/help.js @@ -9,6 +9,7 @@ import { uiCmd } from './cmd'; import { uiBackground } from './background'; import { uiIntro } from './intro'; import { uiMapData } from './map_data'; +import { uiIssues } from './issues'; import { uiShortcuts } from './shortcuts'; import { uiTooltipHtml } from './tooltipHtml'; @@ -294,6 +295,7 @@ export function uiHelp(context) { if (show) { uiBackground.hidePane(); + uiIssues.hidePane(); uiMapData.hidePane(); pane.style('display', 'block') diff --git a/modules/ui/init.js b/modules/ui/init.js index 29d4defaa..737b4bec7 100644 --- a/modules/ui/init.js +++ b/modules/ui/init.js @@ -21,6 +21,7 @@ import { uiGeolocate } from './geolocate'; import { uiHelp } from './help'; import { uiInfo } from './info'; import { uiIntro } from './intro'; +import { uiIssues } from './issues'; import { uiLoading } from './loading'; import { uiMapData } from './map_data'; import { uiMapInMap } from './map_in_map'; @@ -165,6 +166,11 @@ export function uiInit(context) { .attr('class', 'map-control map-data-control') .call(uiMapData(context)); + controls + .append('div') + .attr('class', 'map-control map-issues-control') + .call(uiIssues(context)); + controls .append('div') .attr('class', 'map-control help-control') diff --git a/modules/ui/issues.js b/modules/ui/issues.js new file mode 100644 index 000000000..bcf2d0834 --- /dev/null +++ b/modules/ui/issues.js @@ -0,0 +1,110 @@ +import { + event as d3_event, + select as d3_select +} from 'd3-selection'; + +import { svgIcon } from '../svg'; +import { t, textDirection } from '../util/locale'; +import { tooltip } from '../util/tooltip'; +import { geoExtent } from '../geo'; +import { modeBrowse } from '../modes'; +import { uiBackground } from './background'; +import { uiDisclosure } from './disclosure'; +import { uiHelp } from './help'; +import { uiMapData } from './map_data'; +import { uiSettingsCustomData } from './settings/custom_data'; +import { uiTooltipHtml } from './tooltipHtml'; + + +export function uiIssues(context) { + var key = t('issues.key'); + var _shown = false; + + function update() { + + } + + function issues(selection) { + + function hidePane() { + setVisible(false); + } + + function togglePane() { + if (d3_event) d3_event.preventDefault(); + setVisible(!button.classed('active')); + } + + function setVisible(show) { + if (show !== _shown) { + button.classed('active', show); + _shown = show; + + if (show) { + uiBackground.hidePane(); + uiHelp.hidePane(); + uiMapData.hidePane(); + update(); + + pane + .style('display', 'block') + .style('right', '-300px') + .transition() + .duration(200) + .style('right', '0px'); + + } else { + pane + .style('display', 'block') + .style('right', '0px') + .transition() + .duration(200) + .style('right', '-300px') + .on('end', function() { + d3_select(this).style('display', 'none'); + }); + } + } + } + + var pane = selection + .append('div') + .attr('class', 'fillL map-pane hide'); + + var paneTooltip = tooltip() + .placement((textDirection === 'rtl') ? 'right' : 'left') + .html(true) + .title(uiTooltipHtml(t('issues.description'), key)); + + var button = selection + .append('button') + .attr('tabindex', -1) + .on('click', togglePane) + .call(svgIcon('#iD-icon-alert', 'light')) + .call(paneTooltip); + + var heading = pane + .append('div') + .attr('class', 'pane-heading'); + + heading + .append('h2') + .text(t('issues.title')); + + heading + .append('button') + .on('click', function() { uiIssues.hidePane(); }) + .call(svgIcon('#iD-icon-close')); + + update(); + + context.keybinding() + .on(key, togglePane); + + uiIssues.hidePane = hidePane; + uiIssues.togglePane = togglePane; + uiIssues.setVisible = setVisible; + } + + return issues; +} diff --git a/modules/ui/map_data.js b/modules/ui/map_data.js index 3fa8cfb8f..868ae141c 100644 --- a/modules/ui/map_data.js +++ b/modules/ui/map_data.js @@ -11,6 +11,7 @@ import { modeBrowse } from '../modes'; import { uiBackground } from './background'; import { uiDisclosure } from './disclosure'; import { uiHelp } from './help'; +import { uiIssues } from './issues'; import { uiSettingsCustomData } from './settings/custom_data'; import { uiTooltipHtml } from './tooltipHtml'; @@ -550,6 +551,7 @@ export function uiMapData(context) { if (show) { uiBackground.hidePane(); uiHelp.hidePane(); + uiIssues.hidePane(); update(); pane