mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-16 22:03:37 +02:00
Merge branch 'master' into new-stylings
This commit is contained in:
+31
-6
@@ -4710,16 +4710,31 @@ en:
|
||||
name: Mast
|
||||
# 'terms: antenna,broadcast tower,cell phone tower,cell tower,communication mast,communication tower,guyed tower,mobile phone tower,radio mast,radio tower,television tower,transmission mast,transmission tower,tv tower'
|
||||
terms: '<translate with synonyms or related terms for ''Mast'', separated by commas>'
|
||||
man_made/mast/communication:
|
||||
# 'man_made=mast, tower:type=communication'
|
||||
name: Communication Mast
|
||||
# 'terms: antenna,broadcast tower,cell phone tower,cell tower,communication mast,communication tower,guyed tower,mobile phone tower,radio mast,radio tower,television tower,transmission mast,transmission tower,tv tower'
|
||||
terms: '<translate with synonyms or related terms for ''Communication Mast'', separated by commas>'
|
||||
man_made/mast/communication/mobile_phone:
|
||||
# 'man_made=mast, tower:type=communication, communication:mobile_phone=yes'
|
||||
name: Mobile Phone Mast
|
||||
# 'terms: antenna,cell mast,cell phone mast,cell phone tower,cell tower,communication mast,communication tower,guyed tower,mobile phone tower,transmission mast,transmission tower'
|
||||
terms: '<translate with synonyms or related terms for ''Mobile Phone Mast'', separated by commas>'
|
||||
man_made/mast/communication/radio:
|
||||
# 'man_made=mast, tower:type=communication, communication:radio=yes'
|
||||
name: Radio Broadcast Mast
|
||||
# 'terms: antenna,broadcast tower,communication mast,communication tower,guyed tower,radio mast,radio tower,transmission mast,transmission tower'
|
||||
terms: '<translate with synonyms or related terms for ''Radio Broadcast Mast'', separated by commas>'
|
||||
man_made/mast/communication/television:
|
||||
# 'man_made=mast, tower:type=communication, communication:television=yes'
|
||||
name: Television Broadcast Mast
|
||||
# 'terms: antenna,broadcast tower,communication mast,communication tower,guyed tower,television mast,television tower,transmission mast,transmission tower,tv mast,tv tower'
|
||||
terms: '<translate with synonyms or related terms for ''Television Broadcast Mast'', separated by commas>'
|
||||
man_made/monitoring_station:
|
||||
# man_made=monitoring_station
|
||||
name: Monitoring Station
|
||||
# 'terms: weather,earthquake,seismology,air,gps'
|
||||
terms: '<translate with synonyms or related terms for ''Monitoring Station'', separated by commas>'
|
||||
man_made/observation:
|
||||
# 'man_made=tower, tower:type=observation'
|
||||
name: Observation Tower
|
||||
# 'terms: lookout tower,fire tower'
|
||||
terms: '<translate with synonyms or related terms for ''Observation Tower'', separated by commas>'
|
||||
man_made/observatory:
|
||||
# man_made=observatory
|
||||
name: Observatory
|
||||
@@ -4759,7 +4774,7 @@ en:
|
||||
name: Surveillance
|
||||
# 'terms: anpr,alpr,camera,car plate recognition,cctv,guard,license plate recognition,monitoring,number plate recognition,security,video,webcam'
|
||||
terms: '<translate with synonyms or related terms for ''Surveillance'', separated by commas>'
|
||||
man_made/surveillance_camera:
|
||||
man_made/surveillance/camera:
|
||||
# 'man_made=surveillance, surveillance:type=camera'
|
||||
name: Surveillance Camera
|
||||
# 'terms: anpr,alpr,camera,car plate recognition,cctv,guard,license plate recognition,monitoring,number plate recognition,security,video,webcam'
|
||||
@@ -4773,6 +4788,16 @@ en:
|
||||
# man_made=tower
|
||||
name: Tower
|
||||
terms: '<translate with synonyms or related terms for ''Tower'', separated by commas>'
|
||||
man_made/tower/communication:
|
||||
# 'man_made=tower, tower:type=communication'
|
||||
name: Communication Tower
|
||||
# 'terms: antenna,broadcast tower,cell phone tower,cell tower,communication mast,communication tower,guyed tower,mobile phone tower,radio mast,radio tower,television tower,transmission mast,transmission tower,tv tower'
|
||||
terms: '<translate with synonyms or related terms for ''Communication Tower'', separated by commas>'
|
||||
man_made/tower/observation:
|
||||
# 'man_made=tower, tower:type=observation'
|
||||
name: Observation Tower
|
||||
# 'terms: lookout tower,fire tower'
|
||||
terms: '<translate with synonyms or related terms for ''Observation Tower'', separated by commas>'
|
||||
man_made/wastewater_plant:
|
||||
# man_made=wastewater_plant
|
||||
name: Wastewater Plant
|
||||
|
||||
@@ -594,8 +594,11 @@
|
||||
"man_made/groyne": {"geometry": ["line", "area"], "tags": {"man_made": "groyne"}, "name": "Groyne"},
|
||||
"man_made/lighthouse": {"icon": "maki-lighthouse", "fields": ["building_area"], "geometry": ["point", "area"], "tags": {"man_made": "lighthouse"}, "name": "Lighthouse"},
|
||||
"man_made/mast": {"icon": "maki-communications-tower", "fields": ["tower/type", "tower/construction", "height", "communication_multi"], "geometry": ["point"], "terms": ["antenna", "broadcast tower", "cell phone tower", "cell tower", "communication mast", "communication tower", "guyed tower", "mobile phone tower", "radio mast", "radio tower", "television tower", "transmission mast", "transmission tower", "tv tower"], "tags": {"man_made": "mast"}, "name": "Mast"},
|
||||
"man_made/mast/communication": {"icon": "maki-communications-tower", "fields": ["tower/type", "tower/construction", "height", "communication_multi"], "geometry": ["point"], "terms": ["antenna", "broadcast tower", "cell phone tower", "cell tower", "communication mast", "communication tower", "guyed tower", "mobile phone tower", "radio mast", "radio tower", "television tower", "transmission mast", "transmission tower", "tv tower"], "tags": {"man_made": "mast", "tower:type": "communication"}, "reference": {"key": "tower:type", "value": "communication"}, "name": "Communication Mast"},
|
||||
"man_made/mast/communication/mobile_phone": {"icon": "maki-communications-tower", "fields": ["tower/type", "tower/construction", "height", "communication_multi"], "geometry": ["point"], "terms": ["antenna", "cell mast", "cell phone mast", "cell phone tower", "cell tower", "communication mast", "communication tower", "guyed tower", "mobile phone tower", "transmission mast", "transmission tower"], "tags": {"man_made": "mast", "tower:type": "communication", "communication:mobile_phone": "yes"}, "reference": {"key": "communication:mobile_phone", "value": "yes"}, "name": "Mobile Phone Mast"},
|
||||
"man_made/mast/communication/radio": {"icon": "maki-communications-tower", "fields": ["tower/type", "tower/construction", "height", "communication_multi"], "geometry": ["point"], "terms": ["antenna", "broadcast tower", "communication mast", "communication tower", "guyed tower", "radio mast", "radio tower", "transmission mast", "transmission tower"], "tags": {"man_made": "mast", "tower:type": "communication", "communication:radio": "yes"}, "reference": {"key": "communication:radio", "value": "yes"}, "name": "Radio Broadcast Mast"},
|
||||
"man_made/mast/communication/television": {"icon": "maki-communications-tower", "fields": ["tower/type", "tower/construction", "height", "communication_multi"], "geometry": ["point"], "terms": ["antenna", "broadcast tower", "communication mast", "communication tower", "guyed tower", "television mast", "television tower", "transmission mast", "transmission tower", "tv mast", "tv tower"], "tags": {"man_made": "mast", "tower:type": "communication", "communication:television": "yes"}, "reference": {"key": "communication:television", "value": "yes"}, "name": "Television Broadcast Mast"},
|
||||
"man_made/monitoring_station": {"icon": "temaki-antenna", "geometry": ["point", "area"], "fields": ["monitoring_multi", "operator"], "terms": ["weather", "earthquake", "seismology", "air", "gps"], "tags": {"man_made": "monitoring_station"}, "name": "Monitoring Station"},
|
||||
"man_made/observation": {"icon": "temaki-tower", "geometry": ["point", "area"], "terms": ["lookout tower", "fire tower"], "tags": {"man_made": "tower", "tower:type": "observation"}, "name": "Observation Tower"},
|
||||
"man_made/observatory": {"geometry": ["point", "area"], "terms": ["astronomical", "meteorological"], "tags": {"man_made": "observatory"}, "name": "Observatory"},
|
||||
"man_made/petroleum_well": {"icon": "temaki-storage_tank", "geometry": ["point"], "terms": ["drilling rig", "oil derrick", "oil drill", "oil horse", "oil rig", "oil pump", "petroleum well", "pumpjack"], "tags": {"man_made": "petroleum_well"}, "name": "Oil Well"},
|
||||
"man_made/pier": {"icon": "iD-highway-footway", "fields": ["name", "surface", "lit", "width", "access"], "geometry": ["line", "area"], "terms": ["dock", "jetty"], "tags": {"man_made": "pier"}, "name": "Pier"},
|
||||
@@ -603,10 +606,12 @@
|
||||
"man_made/pumping_station": {"icon": "maki-water", "geometry": ["point", "area"], "tags": {"man_made": "pumping_station"}, "name": "Pumping Station"},
|
||||
"man_made/silo": {"icon": "temaki-silo", "fields": ["crop", "building_area"], "geometry": ["point", "area"], "terms": ["grain", "corn", "wheat"], "tags": {"man_made": "silo"}, "name": "Silo"},
|
||||
"man_made/storage_tank": {"icon": "temaki-storage_tank", "fields": ["content", "building_area"], "geometry": ["point", "area"], "terms": ["water", "oil", "gas", "petrol"], "tags": {"man_made": "storage_tank"}, "name": "Storage Tank"},
|
||||
"man_made/surveillance_camera": {"icon": "maki-attraction", "geometry": ["point", "vertex"], "fields": ["surveillance", "surveillance/type", "camera/type", "camera/mount", "camera/direction", "surveillance/zone", "contact/webcam"], "terms": ["anpr", "alpr", "camera", "car plate recognition", "cctv", "guard", "license plate recognition", "monitoring", "number plate recognition", "security", "video", "webcam"], "tags": {"man_made": "surveillance", "surveillance:type": "camera"}, "name": "Surveillance Camera"},
|
||||
"man_made/surveillance": {"icon": "maki-attraction", "geometry": ["point", "vertex"], "fields": ["surveillance", "surveillance/type", "surveillance/zone", "direction"], "terms": ["anpr", "alpr", "camera", "car plate recognition", "cctv", "guard", "license plate recognition", "monitoring", "number plate recognition", "security", "video", "webcam"], "tags": {"man_made": "surveillance"}, "name": "Surveillance"},
|
||||
"man_made/surveillance/camera": {"icon": "maki-attraction", "geometry": ["point", "vertex"], "fields": ["surveillance", "surveillance/type", "camera/type", "camera/mount", "camera/direction", "surveillance/zone", "contact/webcam"], "terms": ["anpr", "alpr", "camera", "car plate recognition", "cctv", "guard", "license plate recognition", "monitoring", "number plate recognition", "security", "video", "webcam"], "tags": {"man_made": "surveillance", "surveillance:type": "camera"}, "name": "Surveillance Camera"},
|
||||
"man_made/survey_point": {"icon": "maki-monument", "fields": ["ref"], "geometry": ["point", "vertex"], "terms": ["trig point", "triangulation pillar", "trigonometrical station"], "tags": {"man_made": "survey_point"}, "name": "Survey Point"},
|
||||
"man_made/tower": {"icon": "temaki-tower", "fields": ["tower/type", "tower/construction", "height"], "geometry": ["point", "area"], "tags": {"man_made": "tower"}, "name": "Tower"},
|
||||
"man_made/tower/communication": {"icon": "temaki-tower", "fields": ["tower/type", "tower/construction", "height", "communication_multi"], "geometry": ["point", "area"], "terms": ["antenna", "broadcast tower", "cell phone tower", "cell tower", "communication mast", "communication tower", "guyed tower", "mobile phone tower", "radio mast", "radio tower", "television tower", "transmission mast", "transmission tower", "tv tower"], "tags": {"man_made": "tower", "tower:type": "communication"}, "reference": {"key": "tower:type", "value": "communication"}, "name": "Communication Tower"},
|
||||
"man_made/tower/observation": {"icon": "temaki-tower", "fields": ["tower/type", "tower/construction", "height"], "geometry": ["point", "area"], "terms": ["lookout tower", "fire tower"], "tags": {"man_made": "tower", "tower:type": "observation"}, "reference": {"key": "tower:type", "value": "observation"}, "name": "Observation Tower"},
|
||||
"man_made/wastewater_plant": {"icon": "maki-water", "fields": ["name", "operator", "address"], "geometry": ["point", "area"], "terms": ["sewage*", "water treatment plant", "reclamation plant"], "tags": {"man_made": "wastewater_plant"}, "name": "Wastewater Plant"},
|
||||
"man_made/water_tower": {"icon": "maki-water", "fields": ["operator"], "geometry": ["point", "area"], "tags": {"man_made": "water_tower"}, "name": "Water Tower"},
|
||||
"man_made/water_well": {"icon": "maki-water", "fields": ["operator"], "geometry": ["point", "area"], "tags": {"man_made": "water_well"}, "name": "Water Well"},
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"icon": "maki-communications-tower",
|
||||
"fields": [
|
||||
"tower/type",
|
||||
"tower/construction",
|
||||
"height",
|
||||
"communication_multi"
|
||||
],
|
||||
"geometry": [
|
||||
"point"
|
||||
],
|
||||
"terms": [
|
||||
"antenna",
|
||||
"broadcast tower",
|
||||
"cell phone tower",
|
||||
"cell tower",
|
||||
"communication mast",
|
||||
"communication tower",
|
||||
"guyed tower",
|
||||
"mobile phone tower",
|
||||
"radio mast",
|
||||
"radio tower",
|
||||
"television tower",
|
||||
"transmission mast",
|
||||
"transmission tower",
|
||||
"tv tower"
|
||||
],
|
||||
"tags": {
|
||||
"man_made": "mast",
|
||||
"tower:type": "communication"
|
||||
},
|
||||
"reference": {
|
||||
"key": "tower:type",
|
||||
"value": "communication"
|
||||
},
|
||||
"name": "Communication Mast"
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"icon": "maki-communications-tower",
|
||||
"fields": [
|
||||
"tower/type",
|
||||
"tower/construction",
|
||||
"height",
|
||||
"communication_multi"
|
||||
],
|
||||
"geometry": [
|
||||
"point"
|
||||
],
|
||||
"terms": [
|
||||
"antenna",
|
||||
"cell mast",
|
||||
"cell phone mast",
|
||||
"cell phone tower",
|
||||
"cell tower",
|
||||
"communication mast",
|
||||
"communication tower",
|
||||
"guyed tower",
|
||||
"mobile phone tower",
|
||||
"transmission mast",
|
||||
"transmission tower"
|
||||
],
|
||||
"tags": {
|
||||
"man_made": "mast",
|
||||
"tower:type": "communication",
|
||||
"communication:mobile_phone": "yes"
|
||||
},
|
||||
"reference": {
|
||||
"key": "communication:mobile_phone",
|
||||
"value": "yes"
|
||||
},
|
||||
"name": "Mobile Phone Mast"
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"icon": "maki-communications-tower",
|
||||
"fields": [
|
||||
"tower/type",
|
||||
"tower/construction",
|
||||
"height",
|
||||
"communication_multi"
|
||||
],
|
||||
"geometry": [
|
||||
"point"
|
||||
],
|
||||
"terms": [
|
||||
"antenna",
|
||||
"broadcast tower",
|
||||
"communication mast",
|
||||
"communication tower",
|
||||
"guyed tower",
|
||||
"radio mast",
|
||||
"radio tower",
|
||||
"transmission mast",
|
||||
"transmission tower"
|
||||
],
|
||||
"tags": {
|
||||
"man_made": "mast",
|
||||
"tower:type": "communication",
|
||||
"communication:radio": "yes"
|
||||
},
|
||||
"reference": {
|
||||
"key": "communication:radio",
|
||||
"value": "yes"
|
||||
},
|
||||
"name": "Radio Broadcast Mast"
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"icon": "maki-communications-tower",
|
||||
"fields": [
|
||||
"tower/type",
|
||||
"tower/construction",
|
||||
"height",
|
||||
"communication_multi"
|
||||
],
|
||||
"geometry": [
|
||||
"point"
|
||||
],
|
||||
"terms": [
|
||||
"antenna",
|
||||
"broadcast tower",
|
||||
"communication mast",
|
||||
"communication tower",
|
||||
"guyed tower",
|
||||
"television mast",
|
||||
"television tower",
|
||||
"transmission mast",
|
||||
"transmission tower",
|
||||
"tv mast",
|
||||
"tv tower"
|
||||
],
|
||||
"tags": {
|
||||
"man_made": "mast",
|
||||
"tower:type": "communication",
|
||||
"communication:television": "yes"
|
||||
},
|
||||
"reference": {
|
||||
"key": "communication:television",
|
||||
"value": "yes"
|
||||
},
|
||||
"name": "Television Broadcast Mast"
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"icon": "temaki-tower",
|
||||
"fields": [
|
||||
"tower/type",
|
||||
"tower/construction",
|
||||
"height",
|
||||
"communication_multi"
|
||||
],
|
||||
"geometry": [
|
||||
"point",
|
||||
"area"
|
||||
],
|
||||
"terms": [
|
||||
"antenna",
|
||||
"broadcast tower",
|
||||
"cell phone tower",
|
||||
"cell tower",
|
||||
"communication mast",
|
||||
"communication tower",
|
||||
"guyed tower",
|
||||
"mobile phone tower",
|
||||
"radio mast",
|
||||
"radio tower",
|
||||
"television tower",
|
||||
"transmission mast",
|
||||
"transmission tower",
|
||||
"tv tower"
|
||||
],
|
||||
"tags": {
|
||||
"man_made": "tower",
|
||||
"tower:type": "communication"
|
||||
},
|
||||
"reference": {
|
||||
"key": "tower:type",
|
||||
"value": "communication"
|
||||
},
|
||||
"name": "Communication Tower"
|
||||
}
|
||||
+9
@@ -1,5 +1,10 @@
|
||||
{
|
||||
"icon": "temaki-tower",
|
||||
"fields": [
|
||||
"tower/type",
|
||||
"tower/construction",
|
||||
"height"
|
||||
],
|
||||
"geometry": [
|
||||
"point",
|
||||
"area"
|
||||
@@ -12,5 +17,9 @@
|
||||
"man_made": "tower",
|
||||
"tower:type": "observation"
|
||||
},
|
||||
"reference": {
|
||||
"key": "tower:type",
|
||||
"value": "observation"
|
||||
},
|
||||
"name": "Observation Tower"
|
||||
}
|
||||
+41
-13
@@ -3977,6 +3977,34 @@
|
||||
"object_types": ["node"],
|
||||
"icon_url": "https://raw.githubusercontent.com/mapbox/maki/master/icons/communications-tower-15.svg?sanitize=true"
|
||||
},
|
||||
{
|
||||
"key": "tower:type",
|
||||
"value": "communication",
|
||||
"description": "Communication Mast, Communication Tower",
|
||||
"object_types": ["node"],
|
||||
"icon_url": "https://raw.githubusercontent.com/mapbox/maki/master/icons/communications-tower-15.svg?sanitize=true"
|
||||
},
|
||||
{
|
||||
"key": "communication:mobile_phone",
|
||||
"value": "yes",
|
||||
"description": "Mobile Phone Mast",
|
||||
"object_types": ["node"],
|
||||
"icon_url": "https://raw.githubusercontent.com/mapbox/maki/master/icons/communications-tower-15.svg?sanitize=true"
|
||||
},
|
||||
{
|
||||
"key": "communication:radio",
|
||||
"value": "yes",
|
||||
"description": "Radio Broadcast Mast",
|
||||
"object_types": ["node"],
|
||||
"icon_url": "https://raw.githubusercontent.com/mapbox/maki/master/icons/communications-tower-15.svg?sanitize=true"
|
||||
},
|
||||
{
|
||||
"key": "communication:television",
|
||||
"value": "yes",
|
||||
"description": "Television Broadcast Mast",
|
||||
"object_types": ["node"],
|
||||
"icon_url": "https://raw.githubusercontent.com/mapbox/maki/master/icons/communications-tower-15.svg?sanitize=true"
|
||||
},
|
||||
{
|
||||
"key": "man_made",
|
||||
"value": "monitoring_station",
|
||||
@@ -3984,13 +4012,6 @@
|
||||
"object_types": ["node", "area"],
|
||||
"icon_url": "https://raw.githubusercontent.com/bhousel/temaki/master/icons/antenna.svg?sanitize=true"
|
||||
},
|
||||
{
|
||||
"key": "tower:type",
|
||||
"value": "observation",
|
||||
"description": "Observation Tower",
|
||||
"object_types": ["node", "area"],
|
||||
"icon_url": "https://raw.githubusercontent.com/bhousel/temaki/master/icons/tower.svg?sanitize=true"
|
||||
},
|
||||
{
|
||||
"key": "man_made",
|
||||
"value": "observatory",
|
||||
@@ -4040,16 +4061,16 @@
|
||||
"icon_url": "https://raw.githubusercontent.com/bhousel/temaki/master/icons/storage_tank.svg?sanitize=true"
|
||||
},
|
||||
{
|
||||
"key": "surveillance:type",
|
||||
"value": "camera",
|
||||
"description": "Surveillance Camera, Surveillance Type",
|
||||
"key": "man_made",
|
||||
"value": "surveillance",
|
||||
"description": "Surveillance",
|
||||
"object_types": ["node"],
|
||||
"icon_url": "https://raw.githubusercontent.com/mapbox/maki/master/icons/attraction-15.svg?sanitize=true"
|
||||
},
|
||||
{
|
||||
"key": "man_made",
|
||||
"value": "surveillance",
|
||||
"description": "Surveillance",
|
||||
"key": "surveillance:type",
|
||||
"value": "camera",
|
||||
"description": "Surveillance Camera, Surveillance Type",
|
||||
"object_types": ["node"],
|
||||
"icon_url": "https://raw.githubusercontent.com/mapbox/maki/master/icons/attraction-15.svg?sanitize=true"
|
||||
},
|
||||
@@ -4067,6 +4088,13 @@
|
||||
"object_types": ["node", "area"],
|
||||
"icon_url": "https://raw.githubusercontent.com/bhousel/temaki/master/icons/tower.svg?sanitize=true"
|
||||
},
|
||||
{
|
||||
"key": "tower:type",
|
||||
"value": "observation",
|
||||
"description": "Observation Tower",
|
||||
"object_types": ["node", "area"],
|
||||
"icon_url": "https://raw.githubusercontent.com/bhousel/temaki/master/icons/tower.svg?sanitize=true"
|
||||
},
|
||||
{
|
||||
"key": "man_made",
|
||||
"value": "wastewater_plant",
|
||||
|
||||
Vendored
+28
-8
@@ -5552,14 +5552,26 @@
|
||||
"name": "Mast",
|
||||
"terms": "antenna,broadcast tower,cell phone tower,cell tower,communication mast,communication tower,guyed tower,mobile phone tower,radio mast,radio tower,television tower,transmission mast,transmission tower,tv tower"
|
||||
},
|
||||
"man_made/mast/communication": {
|
||||
"name": "Communication Mast",
|
||||
"terms": "antenna,broadcast tower,cell phone tower,cell tower,communication mast,communication tower,guyed tower,mobile phone tower,radio mast,radio tower,television tower,transmission mast,transmission tower,tv tower"
|
||||
},
|
||||
"man_made/mast/communication/mobile_phone": {
|
||||
"name": "Mobile Phone Mast",
|
||||
"terms": "antenna,cell mast,cell phone mast,cell phone tower,cell tower,communication mast,communication tower,guyed tower,mobile phone tower,transmission mast,transmission tower"
|
||||
},
|
||||
"man_made/mast/communication/radio": {
|
||||
"name": "Radio Broadcast Mast",
|
||||
"terms": "antenna,broadcast tower,communication mast,communication tower,guyed tower,radio mast,radio tower,transmission mast,transmission tower"
|
||||
},
|
||||
"man_made/mast/communication/television": {
|
||||
"name": "Television Broadcast Mast",
|
||||
"terms": "antenna,broadcast tower,communication mast,communication tower,guyed tower,television mast,television tower,transmission mast,transmission tower,tv mast,tv tower"
|
||||
},
|
||||
"man_made/monitoring_station": {
|
||||
"name": "Monitoring Station",
|
||||
"terms": "weather,earthquake,seismology,air,gps"
|
||||
},
|
||||
"man_made/observation": {
|
||||
"name": "Observation Tower",
|
||||
"terms": "lookout tower,fire tower"
|
||||
},
|
||||
"man_made/observatory": {
|
||||
"name": "Observatory",
|
||||
"terms": "astronomical,meteorological"
|
||||
@@ -5588,14 +5600,14 @@
|
||||
"name": "Storage Tank",
|
||||
"terms": "water,oil,gas,petrol"
|
||||
},
|
||||
"man_made/surveillance_camera": {
|
||||
"name": "Surveillance Camera",
|
||||
"terms": "anpr,alpr,camera,car plate recognition,cctv,guard,license plate recognition,monitoring,number plate recognition,security,video,webcam"
|
||||
},
|
||||
"man_made/surveillance": {
|
||||
"name": "Surveillance",
|
||||
"terms": "anpr,alpr,camera,car plate recognition,cctv,guard,license plate recognition,monitoring,number plate recognition,security,video,webcam"
|
||||
},
|
||||
"man_made/surveillance/camera": {
|
||||
"name": "Surveillance Camera",
|
||||
"terms": "anpr,alpr,camera,car plate recognition,cctv,guard,license plate recognition,monitoring,number plate recognition,security,video,webcam"
|
||||
},
|
||||
"man_made/survey_point": {
|
||||
"name": "Survey Point",
|
||||
"terms": "trig point,triangulation pillar,trigonometrical station"
|
||||
@@ -5604,6 +5616,14 @@
|
||||
"name": "Tower",
|
||||
"terms": ""
|
||||
},
|
||||
"man_made/tower/communication": {
|
||||
"name": "Communication Tower",
|
||||
"terms": "antenna,broadcast tower,cell phone tower,cell tower,communication mast,communication tower,guyed tower,mobile phone tower,radio mast,radio tower,television tower,transmission mast,transmission tower,tv tower"
|
||||
},
|
||||
"man_made/tower/observation": {
|
||||
"name": "Observation Tower",
|
||||
"terms": "lookout tower,fire tower"
|
||||
},
|
||||
"man_made/wastewater_plant": {
|
||||
"name": "Wastewater Plant",
|
||||
"terms": "sewage*,water treatment plant,reclamation plant"
|
||||
|
||||
@@ -9,26 +9,26 @@ export function behaviorAddWay(context) {
|
||||
var dispatch = d3_dispatch('start', 'startFromWay', 'startFromNode');
|
||||
var draw = behaviorDraw(context);
|
||||
|
||||
var addWay = function(surface) {
|
||||
function behavior(surface) {
|
||||
draw.on('click', function() { dispatch.apply('start', this, arguments); })
|
||||
.on('clickWay', function() { dispatch.apply('startFromWay', this, arguments); })
|
||||
.on('clickNode', function() { dispatch.apply('startFromNode', this, arguments); })
|
||||
.on('cancel', addWay.cancel)
|
||||
.on('finish', addWay.cancel);
|
||||
.on('cancel', behavior.cancel)
|
||||
.on('finish', behavior.cancel);
|
||||
|
||||
context.map()
|
||||
.dblclickEnable(false);
|
||||
|
||||
surface.call(draw);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
addWay.off = function(surface) {
|
||||
behavior.off = function(surface) {
|
||||
surface.call(draw.off);
|
||||
};
|
||||
|
||||
|
||||
addWay.cancel = function() {
|
||||
behavior.cancel = function() {
|
||||
window.setTimeout(function() {
|
||||
context.map().dblclickEnable(true);
|
||||
}, 1000);
|
||||
@@ -37,11 +37,11 @@ export function behaviorAddWay(context) {
|
||||
};
|
||||
|
||||
|
||||
addWay.tail = function(text) {
|
||||
behavior.tail = function(text) {
|
||||
draw.tail(text);
|
||||
return addWay;
|
||||
return behavior;
|
||||
};
|
||||
|
||||
|
||||
return utilRebind(addWay, dispatch, 'on');
|
||||
return utilRebind(behavior, dispatch, 'on');
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ export function behaviorBreathe() {
|
||||
}
|
||||
|
||||
|
||||
var breathe = function(surface) {
|
||||
function behavior(surface) {
|
||||
_done = false;
|
||||
_timer = d3_timer(function() {
|
||||
// wait for elements to actually become selected
|
||||
@@ -148,10 +148,10 @@ export function behaviorBreathe() {
|
||||
_timer.stop();
|
||||
return true;
|
||||
}, 20);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
breathe.off = function() {
|
||||
behavior.off = function() {
|
||||
_done = true;
|
||||
if (_timer) {
|
||||
_timer.stop();
|
||||
@@ -162,5 +162,5 @@ export function behaviorBreathe() {
|
||||
};
|
||||
|
||||
|
||||
return breathe;
|
||||
return behavior;
|
||||
}
|
||||
|
||||
+15
-20
@@ -2,18 +2,11 @@ import _extend from 'lodash-es/extend';
|
||||
import _groupBy from 'lodash-es/groupBy';
|
||||
import _map from 'lodash-es/map';
|
||||
|
||||
import {
|
||||
event as d3_event,
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
import { d3keybinding as d3_keybinding } from '../lib/d3.keybinding.js';
|
||||
import { event as d3_event } from 'd3-selection';
|
||||
import { uiCmd } from '../ui';
|
||||
|
||||
|
||||
export function behaviorCopy(context) {
|
||||
var keybinding = d3_keybinding('copy');
|
||||
|
||||
|
||||
function groupEntities(ids, graph) {
|
||||
var entities = ids.map(function (id) { return graph.entity(id); });
|
||||
@@ -47,8 +40,15 @@ export function behaviorCopy(context) {
|
||||
}
|
||||
|
||||
|
||||
function getSelectionText() {
|
||||
return window.getSelection().toString();
|
||||
}
|
||||
|
||||
|
||||
function doCopy() {
|
||||
if (!getSelectionText()) d3_event.preventDefault();
|
||||
if (!getSelectionText()) {
|
||||
d3_event.preventDefault();
|
||||
}
|
||||
|
||||
var graph = context.graph();
|
||||
var selected = groupEntities(context.selectedIDs(), graph);
|
||||
@@ -82,20 +82,15 @@ export function behaviorCopy(context) {
|
||||
}
|
||||
|
||||
|
||||
function copy() {
|
||||
keybinding.on(uiCmd('⌘C'), doCopy);
|
||||
d3_select(document).call(keybinding);
|
||||
return copy;
|
||||
function behavior() {
|
||||
context.keybinding().on(uiCmd('⌘C'), doCopy);
|
||||
return behavior;
|
||||
}
|
||||
|
||||
function getSelectionText() {
|
||||
return window.getSelection().toString();
|
||||
}
|
||||
|
||||
copy.off = function() {
|
||||
d3_select(document).call(keybinding.off);
|
||||
behavior.off = function() {
|
||||
context.keybinding().off(uiCmd('⌘C'));
|
||||
};
|
||||
|
||||
|
||||
return copy;
|
||||
return behavior;
|
||||
}
|
||||
|
||||
+15
-20
@@ -10,13 +10,8 @@ import {
|
||||
} from 'd3-selection';
|
||||
|
||||
import { osmNote } from '../osm';
|
||||
|
||||
import { utilRebind } from '../util/rebind';
|
||||
|
||||
import {
|
||||
utilPrefixCSSProperty,
|
||||
utilPrefixDOMProperty
|
||||
} from '../util';
|
||||
import { utilPrefixCSSProperty, utilPrefixDOMProperty } from '../util';
|
||||
|
||||
|
||||
/*
|
||||
@@ -62,7 +57,7 @@ export function behaviorDrag() {
|
||||
|
||||
function eventOf(thiz, argumentz) {
|
||||
return function(e1) {
|
||||
e1.target = drag;
|
||||
e1.target = behavior;
|
||||
d3_customEvent(e1, dispatch.apply, dispatch, [e1.type, thiz, argumentz]);
|
||||
};
|
||||
}
|
||||
@@ -154,7 +149,7 @@ export function behaviorDrag() {
|
||||
}
|
||||
|
||||
|
||||
function drag(selection) {
|
||||
function behavior(selection) {
|
||||
var matchesSelector = utilPrefixDOMProperty('matchesSelector');
|
||||
var delegate = dragstart;
|
||||
|
||||
@@ -181,49 +176,49 @@ export function behaviorDrag() {
|
||||
}
|
||||
|
||||
|
||||
drag.off = function(selection) {
|
||||
behavior.off = function(selection) {
|
||||
selection
|
||||
.on('mousedown.drag' + _selector, null)
|
||||
.on('touchstart.drag' + _selector, null);
|
||||
};
|
||||
|
||||
|
||||
drag.selector = function(_) {
|
||||
behavior.selector = function(_) {
|
||||
if (!arguments.length) return _selector;
|
||||
_selector = _;
|
||||
return drag;
|
||||
return behavior;
|
||||
};
|
||||
|
||||
|
||||
drag.origin = function (_) {
|
||||
behavior.origin = function(_) {
|
||||
if (!arguments.length) return _origin;
|
||||
_origin = _;
|
||||
return drag;
|
||||
return behavior;
|
||||
};
|
||||
|
||||
|
||||
drag.cancel = function() {
|
||||
behavior.cancel = function() {
|
||||
d3_select(window)
|
||||
.on('mousemove.drag', null)
|
||||
.on('mouseup.drag', null);
|
||||
return drag;
|
||||
return behavior;
|
||||
};
|
||||
|
||||
|
||||
drag.target = function() {
|
||||
behavior.target = function() {
|
||||
if (!arguments.length) return _target;
|
||||
_target = arguments[0];
|
||||
_event = eventOf(_target, Array.prototype.slice.call(arguments, 1));
|
||||
return drag;
|
||||
return behavior;
|
||||
};
|
||||
|
||||
|
||||
drag.surface = function() {
|
||||
behavior.surface = function() {
|
||||
if (!arguments.length) return _surface;
|
||||
_surface = arguments[0];
|
||||
return drag;
|
||||
return behavior;
|
||||
};
|
||||
|
||||
|
||||
return utilRebind(drag, dispatch, 'on');
|
||||
return utilRebind(behavior, dispatch, 'on');
|
||||
}
|
||||
|
||||
+12
-11
@@ -7,12 +7,11 @@ import {
|
||||
touches as d3_touches
|
||||
} from 'd3-selection';
|
||||
|
||||
import { d3keybinding as d3_keybinding } from '../lib/d3.keybinding.js';
|
||||
import { behaviorEdit } from './edit';
|
||||
import { behaviorHover } from './hover';
|
||||
import { behaviorTail } from './tail';
|
||||
import { geoChooseEdge, geoVecLength } from '../geo';
|
||||
import { utilRebind } from '../util/rebind';
|
||||
import { utilKeybinding, utilRebind } from '../util';
|
||||
|
||||
|
||||
var _usedTails = {};
|
||||
@@ -25,7 +24,7 @@ export function behaviorDraw(context) {
|
||||
'move', 'click', 'clickWay', 'clickNode', 'undo', 'cancel', 'finish'
|
||||
);
|
||||
|
||||
var keybinding = d3_keybinding('draw');
|
||||
var keybinding = utilKeybinding('draw');
|
||||
|
||||
var hover = behaviorHover(context).altDisables(true)
|
||||
.on('hover', context.ui().sidebar.hover);
|
||||
@@ -41,7 +40,9 @@ export function behaviorDraw(context) {
|
||||
// related code
|
||||
// - `mode/drag_node.js` `datum()`
|
||||
function datum() {
|
||||
if (d3_event.altKey) return {};
|
||||
var mode = context.mode();
|
||||
var isNote = mode && (mode.id.indexOf('note') !== -1);
|
||||
if (d3_event.altKey || isNote) return {};
|
||||
|
||||
var element;
|
||||
if (d3_event.type === 'keydown') {
|
||||
@@ -189,7 +190,7 @@ export function behaviorDraw(context) {
|
||||
}
|
||||
|
||||
|
||||
function draw(selection) {
|
||||
function behavior(selection) {
|
||||
context.install(hover);
|
||||
context.install(edit);
|
||||
|
||||
@@ -214,11 +215,11 @@ export function behaviorDraw(context) {
|
||||
d3_select(document)
|
||||
.call(keybinding);
|
||||
|
||||
return draw;
|
||||
return behavior;
|
||||
}
|
||||
|
||||
|
||||
draw.off = function(selection) {
|
||||
behavior.off = function(selection) {
|
||||
context.ui().sidebar.hover.cancel();
|
||||
context.uninstall(hover);
|
||||
context.uninstall(edit);
|
||||
@@ -239,15 +240,15 @@ export function behaviorDraw(context) {
|
||||
// note: keyup.space-block, click.draw-block should remain
|
||||
|
||||
d3_select(document)
|
||||
.call(keybinding.off);
|
||||
.call(keybinding.unbind);
|
||||
};
|
||||
|
||||
|
||||
draw.tail = function(_) {
|
||||
behavior.tail = function(_) {
|
||||
tail.text(_);
|
||||
return draw;
|
||||
return behavior;
|
||||
};
|
||||
|
||||
|
||||
return utilRebind(draw, dispatch, 'on');
|
||||
return utilRebind(behavior, dispatch, 'on');
|
||||
}
|
||||
|
||||
@@ -5,8 +5,6 @@ import {
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
import { d3keybinding as d3_keybinding } from '../lib/d3.keybinding.js';
|
||||
|
||||
import {
|
||||
actionAddMidpoint,
|
||||
actionMoveNode,
|
||||
@@ -17,6 +15,7 @@ import { behaviorDraw } from './draw';
|
||||
import { geoChooseEdge, geoHasSelfIntersections } from '../geo';
|
||||
import { modeBrowse, modeSelect } from '../modes';
|
||||
import { osmNode } from '../osm';
|
||||
import { utilKeybinding } from '../util';
|
||||
|
||||
|
||||
export function behaviorDrawWay(context, wayId, index, mode, startGraph) {
|
||||
@@ -41,9 +40,8 @@ export function behaviorDrawWay(context, wayId, index, mode, startGraph) {
|
||||
_tempEdits++;
|
||||
|
||||
|
||||
|
||||
function keydown() {
|
||||
if (d3_event.keyCode === d3_keybinding.modifierCodes.alt) {
|
||||
if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
|
||||
if (context.surface().classed('nope')) {
|
||||
context.surface()
|
||||
.classed('nope-suppressed', true);
|
||||
@@ -56,7 +54,7 @@ export function behaviorDrawWay(context, wayId, index, mode, startGraph) {
|
||||
|
||||
|
||||
function keyup() {
|
||||
if (d3_event.keyCode === d3_keybinding.modifierCodes.alt) {
|
||||
if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
|
||||
if (context.surface().classed('nope-suppressed')) {
|
||||
context.surface()
|
||||
.classed('nope', true);
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
export function behaviorEdit(context) {
|
||||
|
||||
function edit() {
|
||||
function behavior() {
|
||||
context.map()
|
||||
.minzoom(context.minEditableZoom());
|
||||
}
|
||||
|
||||
|
||||
edit.off = function() {
|
||||
behavior.off = function() {
|
||||
context.map()
|
||||
.minzoom(0);
|
||||
};
|
||||
|
||||
|
||||
return edit;
|
||||
return behavior;
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ export function behaviorHash(context) {
|
||||
}
|
||||
|
||||
|
||||
function hash() {
|
||||
function behavior() {
|
||||
context.map()
|
||||
.on('move.hash', throttledUpdate);
|
||||
|
||||
@@ -97,7 +97,6 @@ export function behaviorHash(context) {
|
||||
.on('hashchange.hash', hashchange);
|
||||
|
||||
if (window.location.hash) {
|
||||
|
||||
var q = utilStringQs(window.location.hash.substring(1));
|
||||
|
||||
if (q.id) {
|
||||
@@ -119,19 +118,19 @@ export function behaviorHash(context) {
|
||||
}
|
||||
|
||||
if (q.walkthrough === 'true') {
|
||||
hash.startWalkthrough = true;
|
||||
behavior.startWalkthrough = true;
|
||||
}
|
||||
|
||||
hashchange();
|
||||
|
||||
if (q.map) {
|
||||
hash.hadHash = true;
|
||||
behavior.hadHash = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
hash.off = function() {
|
||||
behavior.off = function() {
|
||||
throttledUpdate.cancel();
|
||||
|
||||
context.map()
|
||||
@@ -147,5 +146,5 @@ export function behaviorHash(context) {
|
||||
};
|
||||
|
||||
|
||||
return hash;
|
||||
return behavior;
|
||||
}
|
||||
|
||||
+10
-11
@@ -5,9 +5,8 @@ import {
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
import { d3keybinding as d3_keybinding } from '../lib/d3.keybinding.js';
|
||||
import { osmEntity, osmNote } from '../osm';
|
||||
import { utilRebind } from '../util/rebind';
|
||||
import { utilKeybinding, utilRebind } from '../util';
|
||||
|
||||
|
||||
/*
|
||||
@@ -29,7 +28,7 @@ export function behaviorHover(context) {
|
||||
|
||||
|
||||
function keydown() {
|
||||
if (_altDisables && d3_event.keyCode === d3_keybinding.modifierCodes.alt) {
|
||||
if (_altDisables && d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
|
||||
_selection.selectAll('.hover')
|
||||
.classed('hover-suppressed', true)
|
||||
.classed('hover', false);
|
||||
@@ -43,7 +42,7 @@ export function behaviorHover(context) {
|
||||
|
||||
|
||||
function keyup() {
|
||||
if (_altDisables && d3_event.keyCode === d3_keybinding.modifierCodes.alt) {
|
||||
if (_altDisables && d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
|
||||
_selection.selectAll('.hover-suppressed')
|
||||
.classed('hover-suppressed', false)
|
||||
.classed('hover', true);
|
||||
@@ -56,7 +55,7 @@ export function behaviorHover(context) {
|
||||
}
|
||||
|
||||
|
||||
var hover = function(selection) {
|
||||
function behavior(selection) {
|
||||
_selection = selection;
|
||||
_newId = null;
|
||||
|
||||
@@ -151,10 +150,10 @@ export function behaviorHover(context) {
|
||||
dispatch.call('hover', this, null);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
hover.off = function(selection) {
|
||||
behavior.off = function(selection) {
|
||||
selection.selectAll('.hover')
|
||||
.classed('hover', false);
|
||||
selection.selectAll('.hover-suppressed')
|
||||
@@ -173,12 +172,12 @@ export function behaviorHover(context) {
|
||||
};
|
||||
|
||||
|
||||
hover.altDisables = function(_) {
|
||||
behavior.altDisables = function(val) {
|
||||
if (!arguments.length) return _altDisables;
|
||||
_altDisables = _;
|
||||
return hover;
|
||||
_altDisables = val;
|
||||
return behavior;
|
||||
};
|
||||
|
||||
|
||||
return utilRebind(hover, dispatch, 'on');
|
||||
return utilRebind(behavior, dispatch, 'on');
|
||||
}
|
||||
|
||||
@@ -1,57 +1,51 @@
|
||||
import {
|
||||
event as d3_event,
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
import { d3keybinding as d3_keybinding } from '../lib/d3.keybinding.js';
|
||||
import { event as d3_event } from 'd3-selection';
|
||||
import { uiFlash } from '../ui';
|
||||
|
||||
|
||||
/* Creates a keybinding behavior for an operation */
|
||||
export function behaviorOperation() {
|
||||
var keybinding;
|
||||
export function behaviorOperation(context) {
|
||||
var _operation;
|
||||
|
||||
var behavior = function () {
|
||||
function keypress() {
|
||||
d3_event.preventDefault();
|
||||
var disabled = _operation.disabled();
|
||||
var flash;
|
||||
|
||||
if (disabled) {
|
||||
flash = uiFlash()
|
||||
.duration(4000)
|
||||
.iconName('#iD-operation-' + _operation.id)
|
||||
.iconClass('operation disabled')
|
||||
.text(_operation.tooltip);
|
||||
|
||||
flash();
|
||||
|
||||
} else {
|
||||
flash = uiFlash()
|
||||
.duration(2000)
|
||||
.iconName('#iD-operation-' + _operation.id)
|
||||
.iconClass('operation')
|
||||
.text(_operation.annotation() || _operation.title);
|
||||
|
||||
flash();
|
||||
_operation();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function behavior() {
|
||||
if (_operation && _operation.available()) {
|
||||
keybinding = d3_keybinding('behavior.key.' + _operation.id);
|
||||
keybinding.on(_operation.keys, function() {
|
||||
d3_event.preventDefault();
|
||||
var disabled = _operation.disabled();
|
||||
var flash;
|
||||
|
||||
if (disabled) {
|
||||
flash = uiFlash()
|
||||
.duration(4000)
|
||||
.iconName('#iD-operation-' + _operation.id)
|
||||
.iconClass('operation disabled')
|
||||
.text(_operation.tooltip);
|
||||
|
||||
flash();
|
||||
|
||||
} else {
|
||||
flash = uiFlash()
|
||||
.duration(2000)
|
||||
.iconName('#iD-operation-' + _operation.id)
|
||||
.iconClass('operation')
|
||||
.text(_operation.annotation() || _operation.title);
|
||||
|
||||
flash();
|
||||
_operation();
|
||||
}
|
||||
});
|
||||
|
||||
d3_select(document).call(keybinding);
|
||||
context.keybinding()
|
||||
.on(_operation.keys, keypress);
|
||||
}
|
||||
|
||||
return behavior;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
behavior.off = function() {
|
||||
if (keybinding) {
|
||||
d3_select(document).call(keybinding.off);
|
||||
}
|
||||
context.keybinding()
|
||||
.off(_operation.keys);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,31 +1,15 @@
|
||||
import _invert from 'lodash-es/invert';
|
||||
import _mapValues from 'lodash-es/mapValues';
|
||||
|
||||
import {
|
||||
event as d3_event,
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
import { d3keybinding as d3_keybinding } from '../lib/d3.keybinding.js';
|
||||
|
||||
import {
|
||||
actionCopyEntities,
|
||||
actionMove
|
||||
} from '../actions';
|
||||
|
||||
import {
|
||||
geoExtent,
|
||||
geoPointInPolygon,
|
||||
geoVecSubtract
|
||||
} from '../geo';
|
||||
import { event as d3_event } from 'd3-selection';
|
||||
|
||||
import { actionCopyEntities, actionMove } from '../actions';
|
||||
import { geoExtent, geoPointInPolygon, geoVecSubtract } from '../geo';
|
||||
import { modeMove } from '../modes';
|
||||
import { uiCmd } from '../ui';
|
||||
|
||||
|
||||
export function behaviorPaste(context) {
|
||||
var keybinding = d3_keybinding('paste');
|
||||
|
||||
|
||||
function doPaste() {
|
||||
d3_event.preventDefault();
|
||||
@@ -79,17 +63,16 @@ export function behaviorPaste(context) {
|
||||
}
|
||||
|
||||
|
||||
function paste() {
|
||||
keybinding.on(uiCmd('⌘V'), doPaste);
|
||||
d3_select(document).call(keybinding);
|
||||
return paste;
|
||||
function behavior() {
|
||||
context.keybinding().on(uiCmd('⌘V'), doPaste);
|
||||
return behavior;
|
||||
}
|
||||
|
||||
|
||||
paste.off = function() {
|
||||
d3_select(document).call(keybinding.off);
|
||||
behavior.off = function() {
|
||||
context.keybinding().off(uiCmd('⌘V'));
|
||||
};
|
||||
|
||||
|
||||
return paste;
|
||||
return behavior;
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ export function behaviorSelect(context) {
|
||||
}
|
||||
|
||||
|
||||
var behavior = function(selection) {
|
||||
function behavior(selection) {
|
||||
lastMouse = null;
|
||||
suppressMenu = true;
|
||||
p1 = null;
|
||||
@@ -208,7 +208,7 @@ export function behaviorSelect(context) {
|
||||
context.surface()
|
||||
.classed('behavior-multiselect', true);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
behavior.off = function(selection) {
|
||||
|
||||
@@ -15,7 +15,7 @@ export function behaviorTail() {
|
||||
var _text;
|
||||
|
||||
|
||||
function tail(selection) {
|
||||
function behavior(selection) {
|
||||
if (!_text) return;
|
||||
|
||||
d3_select(window)
|
||||
@@ -71,7 +71,7 @@ export function behaviorTail() {
|
||||
}
|
||||
|
||||
|
||||
tail.off = function(selection) {
|
||||
behavior.off = function(selection) {
|
||||
if (!_text) return;
|
||||
|
||||
container
|
||||
@@ -88,12 +88,12 @@ export function behaviorTail() {
|
||||
};
|
||||
|
||||
|
||||
tail.text = function(val) {
|
||||
behavior.text = function(val) {
|
||||
if (!arguments.length) return _text;
|
||||
_text = val;
|
||||
return tail;
|
||||
return behavior;
|
||||
};
|
||||
|
||||
|
||||
return tail;
|
||||
return behavior;
|
||||
}
|
||||
|
||||
+14
-26
@@ -10,38 +10,18 @@ import { dispatch as d3_dispatch } from 'd3-dispatch';
|
||||
import { json as d3_json } from 'd3-request';
|
||||
import { select as d3_select } from 'd3-selection';
|
||||
|
||||
import {
|
||||
t,
|
||||
currentLocale,
|
||||
addTranslation,
|
||||
setLocale
|
||||
} from '../util/locale';
|
||||
import { t, currentLocale, addTranslation, setLocale } from '../util/locale';
|
||||
|
||||
import { coreHistory } from './history';
|
||||
|
||||
import {
|
||||
dataLocales,
|
||||
dataEn
|
||||
} from '../../data';
|
||||
|
||||
import { dataLocales, dataEn } from '../../data';
|
||||
import { geoRawMercator } from '../geo/raw_mercator';
|
||||
import { modeSelect } from '../modes/select';
|
||||
import { presetIndex } from '../presets';
|
||||
|
||||
import {
|
||||
rendererBackground,
|
||||
rendererFeatures,
|
||||
rendererMap
|
||||
} from '../renderer';
|
||||
|
||||
import { rendererBackground, rendererFeatures, rendererMap } from '../renderer';
|
||||
import { services } from '../services';
|
||||
import { uiInit } from '../ui/init';
|
||||
import { utilDetect } from '../util/detect';
|
||||
|
||||
import {
|
||||
utilCallWhenIdle,
|
||||
utilRebind
|
||||
} from '../util';
|
||||
import { utilCallWhenIdle, utilKeybinding, utilRebind } from '../util';
|
||||
|
||||
|
||||
export var areaKeys = {};
|
||||
@@ -104,9 +84,17 @@ export function coreContext() {
|
||||
};
|
||||
|
||||
|
||||
/* Straight accessors. Avoid using these if you can. */
|
||||
var ui, connection, history;
|
||||
/* User interface and keybinding */
|
||||
var ui;
|
||||
context.ui = function() { return ui; };
|
||||
|
||||
var keybinding = utilKeybinding('context');
|
||||
context.keybinding = function() { return keybinding; };
|
||||
d3_select(document).call(keybinding);
|
||||
|
||||
|
||||
/* Straight accessors. Avoid using these if you can. */
|
||||
var connection, history;
|
||||
context.connection = function() { return connection; };
|
||||
context.history = function() { return history; };
|
||||
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
export { d3combobox } from './d3.combobox';
|
||||
export { d3keybinding } from './d3.keybinding';
|
||||
|
||||
@@ -6,8 +6,6 @@ import {
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
import { d3keybinding as d3_keybinding } from '../lib/d3.keybinding.js';
|
||||
|
||||
import { t } from '../util/locale';
|
||||
|
||||
import {
|
||||
@@ -34,6 +32,8 @@ import {
|
||||
import { modeBrowse, modeSelect } from './index';
|
||||
import { osmJoinWays, osmNode } from '../osm';
|
||||
import { uiFlash } from '../ui';
|
||||
import { utilKeybinding } from '../util';
|
||||
|
||||
|
||||
|
||||
export function modeDragNode(context) {
|
||||
@@ -102,7 +102,7 @@ export function modeDragNode(context) {
|
||||
|
||||
|
||||
function keydown() {
|
||||
if (d3_event.keyCode === d3_keybinding.modifierCodes.alt) {
|
||||
if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
|
||||
if (context.surface().classed('nope')) {
|
||||
context.surface()
|
||||
.classed('nope-suppressed', true);
|
||||
@@ -115,7 +115,7 @@ export function modeDragNode(context) {
|
||||
|
||||
|
||||
function keyup() {
|
||||
if (d3_event.keyCode === d3_keybinding.modifierCodes.alt) {
|
||||
if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
|
||||
if (context.surface().classed('nope-suppressed')) {
|
||||
context.surface()
|
||||
.classed('nope', true);
|
||||
|
||||
@@ -3,13 +3,13 @@ import {
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
import { d3keybinding as d3_keybinding } from '../lib/d3.keybinding.js';
|
||||
import { t } from '../util/locale';
|
||||
|
||||
import { actionMove } from '../actions';
|
||||
import { behaviorEdit } from '../behavior';
|
||||
import { geoViewportEdge, geoVecSubtract } from '../geo';
|
||||
import { modeBrowse, modeSelect } from './index';
|
||||
import { utilKeybinding } from '../util';
|
||||
|
||||
import {
|
||||
operationCircularize,
|
||||
@@ -27,7 +27,7 @@ export function modeMove(context, entityIDs, baseGraph) {
|
||||
button: 'browse'
|
||||
};
|
||||
|
||||
var keybinding = d3_keybinding('move');
|
||||
var keybinding = utilKeybinding('move');
|
||||
var behaviors = [
|
||||
behaviorEdit(context),
|
||||
operationCircularize(entityIDs, context).behavior,
|
||||
@@ -159,7 +159,8 @@ export function modeMove(context, entityIDs, baseGraph) {
|
||||
context.history()
|
||||
.on('undone.move', null);
|
||||
|
||||
keybinding.off();
|
||||
d3_select(document)
|
||||
.call(keybinding.unbind);
|
||||
};
|
||||
|
||||
|
||||
|
||||
+5
-10
@@ -8,17 +8,11 @@ import {
|
||||
polygonCentroid as d3_polygonCentroid
|
||||
} from 'd3-polygon';
|
||||
|
||||
import { d3keybinding as d3_keybinding } from '../lib/d3.keybinding.js';
|
||||
|
||||
import { t } from '../util/locale';
|
||||
import { actionRotate } from '../actions';
|
||||
import { behaviorEdit } from '../behavior';
|
||||
import { geoVecInterp } from '../geo';
|
||||
|
||||
import {
|
||||
modeBrowse,
|
||||
modeSelect
|
||||
} from './index';
|
||||
import { modeBrowse, modeSelect } from './index';
|
||||
|
||||
import {
|
||||
operationCircularize,
|
||||
@@ -29,7 +23,7 @@ import {
|
||||
operationReflectShort
|
||||
} from '../operations';
|
||||
|
||||
import { utilGetAllNodes } from '../util';
|
||||
import { utilGetAllNodes, utilKeybinding } from '../util';
|
||||
|
||||
|
||||
export function modeRotate(context, entityIDs) {
|
||||
@@ -38,7 +32,7 @@ export function modeRotate(context, entityIDs) {
|
||||
button: 'browse'
|
||||
};
|
||||
|
||||
var keybinding = d3_keybinding('rotate');
|
||||
var keybinding = utilKeybinding('rotate');
|
||||
var behaviors = [
|
||||
behaviorEdit(context),
|
||||
operationCircularize(entityIDs, context).behavior,
|
||||
@@ -148,7 +142,8 @@ export function modeRotate(context, entityIDs) {
|
||||
context.history()
|
||||
.on('undone.rotate', null);
|
||||
|
||||
keybinding.off();
|
||||
d3_select(document)
|
||||
.call(keybinding.unbind);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ import {
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
import { d3keybinding as d3_keybinding } from '../lib/d3.keybinding.js';
|
||||
import { t } from '../util/locale';
|
||||
|
||||
import {
|
||||
@@ -40,7 +39,8 @@ import {
|
||||
|
||||
import {
|
||||
utilDisplayName,
|
||||
utilDisplayType
|
||||
utilDisplayType,
|
||||
utilKeybinding
|
||||
} from '../util';
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ var _isSaving = false;
|
||||
|
||||
export function modeSave(context) {
|
||||
var mode = { id: 'save' };
|
||||
var keybinding = d3_keybinding('modeSave');
|
||||
var keybinding = utilKeybinding('modeSave');
|
||||
|
||||
var loading = uiLoading(context)
|
||||
.message(t('save.uploading'))
|
||||
@@ -487,7 +487,7 @@ export function modeSave(context) {
|
||||
|
||||
function keybindingOff() {
|
||||
d3_select(document)
|
||||
.call(keybinding.off);
|
||||
.call(keybinding.unbind);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+21
-28
@@ -9,7 +9,6 @@ import {
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
import { d3keybinding as d3_keybinding } from '../lib/d3.keybinding.js';
|
||||
import { t } from '../util/locale';
|
||||
|
||||
import { actionAddMidpoint } from '../actions';
|
||||
@@ -23,30 +22,21 @@ import {
|
||||
behaviorSelect
|
||||
} from '../behavior';
|
||||
|
||||
import {
|
||||
geoExtent,
|
||||
geoChooseEdge,
|
||||
geoPointInPolygon
|
||||
} from '../geo';
|
||||
|
||||
import {
|
||||
osmNode,
|
||||
osmWay
|
||||
} from '../osm';
|
||||
|
||||
import { geoExtent, geoChooseEdge, geoPointInPolygon } from '../geo';
|
||||
import { modeBrowse } from './browse';
|
||||
import { modeDragNode } from './drag_node';
|
||||
import { modeDragNote } from './drag_note';
|
||||
import { osmNode, osmWay } from '../osm';
|
||||
import * as Operations from '../operations/index';
|
||||
import { uiEditMenu, uiSelectionList } from '../ui';
|
||||
import { uiCmd } from '../ui/cmd';
|
||||
import { utilEntityOrMemberSelector, utilEntitySelector } from '../util';
|
||||
import { utilEntityOrMemberSelector, utilEntitySelector, utilKeybinding } from '../util';
|
||||
|
||||
// deprecation warning - Radial Menu to be removed in iD v3
|
||||
import { uiRadialMenu } from '../ui';
|
||||
|
||||
|
||||
var relatedParent;
|
||||
var _relatedParent;
|
||||
|
||||
|
||||
export function modeSelect(context, selectedIDs) {
|
||||
@@ -55,7 +45,7 @@ export function modeSelect(context, selectedIDs) {
|
||||
button: 'browse'
|
||||
};
|
||||
|
||||
var keybinding = d3_keybinding('select');
|
||||
var keybinding = utilKeybinding('select');
|
||||
var timeout = null;
|
||||
var behaviors = [
|
||||
behaviorCopy(context),
|
||||
@@ -132,7 +122,7 @@ export function modeSelect(context, selectedIDs) {
|
||||
function singularParent() {
|
||||
var parents = commonParents();
|
||||
if (!parents || parents.length === 0) {
|
||||
relatedParent = null;
|
||||
_relatedParent = null;
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -140,12 +130,12 @@ export function modeSelect(context, selectedIDs) {
|
||||
// parents, and we want to remember which parent line we started on.
|
||||
|
||||
if (parents.length === 1) {
|
||||
relatedParent = parents[0]; // remember this parent for later
|
||||
return relatedParent;
|
||||
_relatedParent = parents[0]; // remember this parent for later
|
||||
return _relatedParent;
|
||||
}
|
||||
|
||||
if (parents.indexOf(relatedParent) !== -1) {
|
||||
return relatedParent; // prefer the previously seen parent
|
||||
if (parents.indexOf(_relatedParent) !== -1) {
|
||||
return _relatedParent; // prefer the previously seen parent
|
||||
}
|
||||
|
||||
return parents[0];
|
||||
@@ -292,8 +282,8 @@ export function modeSelect(context, selectedIDs) {
|
||||
.classed('related', false);
|
||||
|
||||
singularParent();
|
||||
if (relatedParent) {
|
||||
surface.selectAll(utilEntitySelector([relatedParent]))
|
||||
if (_relatedParent) {
|
||||
surface.selectAll(utilEntitySelector([_relatedParent]))
|
||||
.classed('related', true);
|
||||
}
|
||||
|
||||
@@ -412,19 +402,19 @@ export function modeSelect(context, selectedIDs) {
|
||||
var parents = _uniq(commonParents());
|
||||
if (!parents || parents.length < 2) return;
|
||||
|
||||
var index = parents.indexOf(relatedParent);
|
||||
var index = parents.indexOf(_relatedParent);
|
||||
if (index < 0 || index > parents.length - 2) {
|
||||
relatedParent = parents[0];
|
||||
_relatedParent = parents[0];
|
||||
} else {
|
||||
relatedParent = parents[index + 1];
|
||||
_relatedParent = parents[index + 1];
|
||||
}
|
||||
|
||||
var surface = context.surface();
|
||||
surface.selectAll('.related')
|
||||
.classed('related', false);
|
||||
|
||||
if (relatedParent) {
|
||||
surface.selectAll(utilEntitySelector([relatedParent]))
|
||||
if (_relatedParent) {
|
||||
surface.selectAll(utilEntitySelector([_relatedParent]))
|
||||
.classed('related', true);
|
||||
}
|
||||
}
|
||||
@@ -521,7 +511,10 @@ export function modeSelect(context, selectedIDs) {
|
||||
if (inspector) wrap.call(inspector.close);
|
||||
|
||||
behaviors.forEach(context.uninstall);
|
||||
keybinding.off();
|
||||
|
||||
d3_select(document)
|
||||
.call(keybinding.unbind);
|
||||
|
||||
closeMenu();
|
||||
editMenu = undefined;
|
||||
|
||||
|
||||
@@ -6,8 +6,6 @@ import {
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
import { d3keybinding as d3_keybinding } from '../lib/d3.keybinding.js';
|
||||
|
||||
import {
|
||||
behaviorBreathe,
|
||||
behaviorHover,
|
||||
@@ -16,9 +14,9 @@ import {
|
||||
} from '../behavior';
|
||||
|
||||
import { geoExtent } from '../geo';
|
||||
import { modeDragNode, modeDragNote } from '../modes';
|
||||
import { modeBrowse } from './browse';
|
||||
import { modeBrowse, modeDragNode, modeDragNote } from '../modes';
|
||||
import { uiDataEditor } from '../ui';
|
||||
import { utilKeybinding } from '../util';
|
||||
|
||||
|
||||
export function modeSelectData(context, selectedDatum) {
|
||||
@@ -27,7 +25,7 @@ export function modeSelectData(context, selectedDatum) {
|
||||
button: 'browse'
|
||||
};
|
||||
|
||||
var keybinding = d3_keybinding('select-data');
|
||||
var keybinding = utilKeybinding('select-data');
|
||||
var dataEditor = uiDataEditor(context);
|
||||
|
||||
var behaviors = [
|
||||
@@ -65,7 +63,9 @@ export function modeSelectData(context, selectedDatum) {
|
||||
mode.enter = function() {
|
||||
behaviors.forEach(context.install);
|
||||
keybinding.on('⎋', esc, true);
|
||||
d3_select(document).call(keybinding);
|
||||
|
||||
d3_select(document)
|
||||
.call(keybinding);
|
||||
|
||||
selectData();
|
||||
|
||||
@@ -83,7 +83,9 @@ export function modeSelectData(context, selectedDatum) {
|
||||
|
||||
mode.exit = function() {
|
||||
behaviors.forEach(context.uninstall);
|
||||
keybinding.off();
|
||||
|
||||
d3_select(document)
|
||||
.call(keybinding.unbind);
|
||||
|
||||
context.surface()
|
||||
.selectAll('.layer-mapdata .selected')
|
||||
|
||||
@@ -3,8 +3,6 @@ import {
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
import { d3keybinding as d3_keybinding } from '../lib/d3.keybinding.js';
|
||||
|
||||
import {
|
||||
behaviorBreathe,
|
||||
behaviorHover,
|
||||
@@ -12,14 +10,10 @@ import {
|
||||
behaviorSelect
|
||||
} from '../behavior';
|
||||
|
||||
import {
|
||||
modeDragNode,
|
||||
modeDragNote
|
||||
} from '../modes';
|
||||
|
||||
import { modeBrowse, modeDragNode, modeDragNote } from '../modes';
|
||||
import { services } from '../services';
|
||||
import { modeBrowse } from './browse';
|
||||
import { uiNoteEditor } from '../ui';
|
||||
import { utilKeybinding } from '../util';
|
||||
|
||||
|
||||
export function modeSelectNote(context, selectedNoteID) {
|
||||
@@ -29,7 +23,7 @@ export function modeSelectNote(context, selectedNoteID) {
|
||||
};
|
||||
|
||||
var osm = services.osm;
|
||||
var keybinding = d3_keybinding('select-note');
|
||||
var keybinding = utilKeybinding('select-note');
|
||||
var noteEditor = uiNoteEditor(context)
|
||||
.on('change', function() {
|
||||
context.map().pan([0,0]); // trigger a redraw
|
||||
@@ -101,7 +95,9 @@ export function modeSelectNote(context, selectedNoteID) {
|
||||
|
||||
behaviors.forEach(context.install);
|
||||
keybinding.on('⎋', esc, true);
|
||||
d3_select(document).call(keybinding);
|
||||
|
||||
d3_select(document)
|
||||
.call(keybinding);
|
||||
|
||||
selectNote();
|
||||
|
||||
@@ -118,7 +114,9 @@ export function modeSelectNote(context, selectedNoteID) {
|
||||
|
||||
mode.exit = function() {
|
||||
behaviors.forEach(context.uninstall);
|
||||
keybinding.off();
|
||||
|
||||
d3_select(document)
|
||||
.call(keybinding.unbind);
|
||||
|
||||
context.surface()
|
||||
.selectAll('.layer-notes .selected')
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
/* global Mapillary:false */
|
||||
import _find from 'lodash-es/find';
|
||||
import _flatten from 'lodash-es/flatten';
|
||||
import _forEach from 'lodash-es/forEach';
|
||||
import _map from 'lodash-es/map';
|
||||
import _some from 'lodash-es/some';
|
||||
import _union from 'lodash-es/union';
|
||||
|
||||
import { range as d3_range } from 'd3-array';
|
||||
import { dispatch as d3_dispatch } from 'd3-dispatch';
|
||||
import { request as d3_request } from 'd3-request';
|
||||
import {
|
||||
@@ -213,57 +210,29 @@ function parsePagination(links) {
|
||||
}
|
||||
|
||||
|
||||
// partition viewport into `psize` x `psize` regions
|
||||
function partitionViewport(psize, projection) {
|
||||
var dimensions = projection.clipExtent()[1];
|
||||
psize = psize || 16;
|
||||
var cols = d3_range(0, dimensions[0], psize);
|
||||
var rows = d3_range(0, dimensions[1], psize);
|
||||
var partitions = [];
|
||||
// partition viewport into higher zoom tiles
|
||||
function partitionViewport(projection) {
|
||||
var z = geoScaleToZoom(projection.scale());
|
||||
var z2 = (Math.ceil(z * 2) / 2) + 2.5; // round to next 0.5 and add 2.5
|
||||
var tiler = utilTiler().zoomExtent([z2, z2]);
|
||||
|
||||
rows.forEach(function(y) {
|
||||
cols.forEach(function(x) {
|
||||
var min = [x, y + psize];
|
||||
var max = [x + psize, y];
|
||||
partitions.push(
|
||||
geoExtent(projection.invert(min), projection.invert(max)));
|
||||
});
|
||||
});
|
||||
|
||||
return partitions;
|
||||
return tiler.getTiles(projection)
|
||||
.map(function(tile) { return tile.extent; });
|
||||
}
|
||||
|
||||
|
||||
// no more than `limit` results per partition.
|
||||
function searchLimited(psize, limit, projection, rtree) {
|
||||
limit = limit || 3;
|
||||
function searchLimited(limit, projection, rtree) {
|
||||
limit = limit || 5;
|
||||
|
||||
var partitions = partitionViewport(psize, projection);
|
||||
var results;
|
||||
return partitionViewport(projection)
|
||||
.reduce(function(result, extent) {
|
||||
var found = rtree.search(extent.bbox())
|
||||
.slice(0, limit)
|
||||
.map(function(d) { return d.data; });
|
||||
|
||||
// console.time('previous');
|
||||
results = _flatten(_map(partitions, function(extent) {
|
||||
return rtree.search(extent.bbox())
|
||||
.slice(0, limit)
|
||||
.map(function(d) { return d.data; });
|
||||
}));
|
||||
// console.timeEnd('previous');
|
||||
|
||||
// console.time('new');
|
||||
// results = partitions.reduce(function(result, extent) {
|
||||
// var found = rtree.search(extent.bbox())
|
||||
// .map(function(d) { return d.data; })
|
||||
// .sort(function(a, b) {
|
||||
// return a.loc[1] - b.loc[1];
|
||||
// // return a.key.localeCompare(b.key);
|
||||
// })
|
||||
// .slice(0, limit);
|
||||
|
||||
// return (found.length ? result.concat(found) : result);
|
||||
// }, []);
|
||||
// console.timeEnd('new');
|
||||
|
||||
return results;
|
||||
return (found.length ? result.concat(found) : result);
|
||||
}, []);
|
||||
}
|
||||
|
||||
|
||||
@@ -309,14 +278,14 @@ export default {
|
||||
|
||||
|
||||
images: function(projection) {
|
||||
var psize = 16, limit = 3;
|
||||
return searchLimited(psize, limit, projection, _mlyCache.images.rtree);
|
||||
var limit = 5;
|
||||
return searchLimited(limit, projection, _mlyCache.images.rtree);
|
||||
},
|
||||
|
||||
|
||||
signs: function(projection) {
|
||||
var psize = 32, limit = 3;
|
||||
return searchLimited(psize, limit, projection, _mlyCache.map_features.rtree);
|
||||
var limit = 5;
|
||||
return searchLimited(limit, projection, _mlyCache.map_features.rtree);
|
||||
},
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
import _find from 'lodash-es/find';
|
||||
import _flatten from 'lodash-es/flatten';
|
||||
import _forEach from 'lodash-es/forEach';
|
||||
import _map from 'lodash-es/map';
|
||||
import _union from 'lodash-es/union';
|
||||
|
||||
import { range as d3_range } from 'd3-array';
|
||||
import { dispatch as d3_dispatch } from 'd3-dispatch';
|
||||
import { request as d3_request } from 'd3-request';
|
||||
|
||||
@@ -164,40 +161,29 @@ function loadNextTilePage(which, currZoom, url, tile) {
|
||||
}
|
||||
|
||||
|
||||
// partition viewport into `psize` x `psize` regions
|
||||
function partitionViewport(psize, projection) {
|
||||
var dimensions = projection.clipExtent()[1];
|
||||
psize = psize || 16;
|
||||
var cols = d3_range(0, dimensions[0], psize);
|
||||
var rows = d3_range(0, dimensions[1], psize);
|
||||
var partitions = [];
|
||||
// partition viewport into higher zoom tiles
|
||||
function partitionViewport(projection) {
|
||||
var z = geoScaleToZoom(projection.scale());
|
||||
var z2 = (Math.ceil(z * 2) / 2) + 2.5; // round to next 0.5 and add 2.5
|
||||
var tiler = utilTiler().zoomExtent([z2, z2]);
|
||||
|
||||
rows.forEach(function(y) {
|
||||
cols.forEach(function(x) {
|
||||
var min = [x, y + psize];
|
||||
var max = [x + psize, y];
|
||||
partitions.push(
|
||||
geoExtent(projection.invert(min), projection.invert(max)));
|
||||
});
|
||||
});
|
||||
|
||||
return partitions;
|
||||
return tiler.getTiles(projection)
|
||||
.map(function(tile) { return tile.extent; });
|
||||
}
|
||||
|
||||
|
||||
// no more than `limit` results per partition.
|
||||
function searchLimited(psize, limit, projection, rtree) {
|
||||
limit = limit || 3;
|
||||
function searchLimited(limit, projection, rtree) {
|
||||
limit = limit || 5;
|
||||
|
||||
var partitions = partitionViewport(psize, projection);
|
||||
var results;
|
||||
return partitionViewport(projection)
|
||||
.reduce(function(result, extent) {
|
||||
var found = rtree.search(extent.bbox())
|
||||
.slice(0, limit)
|
||||
.map(function(d) { return d.data; });
|
||||
|
||||
results = _flatten(_map(partitions, function(extent) {
|
||||
return rtree.search(extent.bbox())
|
||||
.slice(0, limit)
|
||||
.map(function(d) { return d.data; });
|
||||
}));
|
||||
return results;
|
||||
return (found.length ? result.concat(found) : result);
|
||||
}, []);
|
||||
}
|
||||
|
||||
|
||||
@@ -237,8 +223,8 @@ export default {
|
||||
|
||||
|
||||
images: function(projection) {
|
||||
var psize = 16, limit = 3;
|
||||
return searchLimited(psize, limit, projection, _oscCache.images.rtree);
|
||||
var limit = 5;
|
||||
return searchLimited(limit, projection, _oscCache.images.rtree);
|
||||
},
|
||||
|
||||
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
import _extend from 'lodash-es/extend';
|
||||
import _find from 'lodash-es/find';
|
||||
import _flatten from 'lodash-es/flatten';
|
||||
import _forEach from 'lodash-es/forEach';
|
||||
import _map from 'lodash-es/map';
|
||||
import _union from 'lodash-es/union';
|
||||
|
||||
import { dispatch as d3_dispatch } from 'd3-dispatch';
|
||||
import { range as d3_range } from 'd3-array';
|
||||
import { timer as d3_timer } from 'd3-timer';
|
||||
|
||||
import {
|
||||
@@ -25,6 +22,7 @@ import {
|
||||
geoMetersToLon,
|
||||
geoPointInPolygon,
|
||||
geoRotate,
|
||||
geoScaleToZoom,
|
||||
geoVecLength
|
||||
} from '../geo';
|
||||
|
||||
@@ -233,45 +231,30 @@ function getBubbles(url, tile, callback) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* partitionViewport() partition viewport into `psize` x `psize` regions.
|
||||
*/
|
||||
function partitionViewport(psize, projection) {
|
||||
var dimensions = projection.clipExtent()[1];
|
||||
psize = psize || 16;
|
||||
|
||||
var cols = d3_range(0, dimensions[0], psize);
|
||||
var rows = d3_range(0, dimensions[1], psize);
|
||||
var partitions = [];
|
||||
// partition viewport into higher zoom tiles
|
||||
function partitionViewport(projection) {
|
||||
var z = geoScaleToZoom(projection.scale());
|
||||
var z2 = (Math.ceil(z * 2) / 2) + 2.5; // round to next 0.5 and add 2.5
|
||||
var tiler = utilTiler().zoomExtent([z2, z2]);
|
||||
|
||||
rows.forEach(function (y) {
|
||||
cols.forEach(function (x) {
|
||||
var min = [x, y + psize];
|
||||
var max = [x + psize, y];
|
||||
partitions.push(geoExtent(projection.invert(min), projection.invert(max)));
|
||||
});
|
||||
});
|
||||
|
||||
return partitions;
|
||||
return tiler.getTiles(projection)
|
||||
.map(function(tile) { return tile.extent; });
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* searchLimited().
|
||||
*/
|
||||
function searchLimited(psize, limit, projection, rtree) {
|
||||
limit = limit || 3;
|
||||
// no more than `limit` results per partition.
|
||||
function searchLimited(limit, projection, rtree) {
|
||||
limit = limit || 5;
|
||||
|
||||
var partitions = partitionViewport(psize, projection);
|
||||
var results;
|
||||
return partitionViewport(projection)
|
||||
.reduce(function(result, extent) {
|
||||
var found = rtree.search(extent.bbox())
|
||||
.slice(0, limit)
|
||||
.map(function(d) { return d.data; });
|
||||
|
||||
results = _flatten(_map(partitions, function (extent) {
|
||||
return rtree.search(extent.bbox())
|
||||
.slice(0, limit)
|
||||
.map(function (d) { return d.data; });
|
||||
}));
|
||||
|
||||
return results;
|
||||
return (found.length ? result.concat(found) : result);
|
||||
}, []);
|
||||
}
|
||||
|
||||
|
||||
@@ -485,8 +468,8 @@ export default {
|
||||
* bubbles()
|
||||
*/
|
||||
bubbles: function (projection) {
|
||||
var psize = 32, limit = 3;
|
||||
return searchLimited(psize, limit, projection, _ssCache.bubbles.rtree);
|
||||
var limit = 5;
|
||||
return searchLimited(limit, projection, _ssCache.bubbles.rtree);
|
||||
},
|
||||
|
||||
|
||||
|
||||
@@ -217,8 +217,8 @@ export function svgMapillaryImages(projection, context, dispatch) {
|
||||
|
||||
|
||||
function drawImages(selection) {
|
||||
var enabled = svgMapillaryImages.enabled,
|
||||
service = getService();
|
||||
var enabled = svgMapillaryImages.enabled;
|
||||
var service = getService();
|
||||
|
||||
layer = selection.selectAll('.layer-mapillary-images')
|
||||
.data(service ? [0] : []);
|
||||
|
||||
@@ -10,8 +10,6 @@ import {
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
import { d3keybinding as d3_keybinding } from '../lib/d3.keybinding.js';
|
||||
|
||||
import { t, textDirection } from '../util/locale';
|
||||
import { svgIcon } from '../svg';
|
||||
import { uiBackgroundDisplayOptions } from './background_display_options';
|
||||
@@ -412,13 +410,9 @@ export function uiBackground(context) {
|
||||
|
||||
update();
|
||||
|
||||
var keybinding = d3_keybinding('background')
|
||||
context.keybinding()
|
||||
.on(key, togglePane)
|
||||
.on(uiCmd('⌘' + key), quickSwitch)
|
||||
.on([t('map_data.key'), t('help.key')], hidePane);
|
||||
|
||||
d3_select(document)
|
||||
.call(keybinding);
|
||||
.on(uiCmd('⌘' + key), quickSwitch);
|
||||
|
||||
uiBackground.hidePane = hidePane;
|
||||
uiBackground.togglePane = togglePane;
|
||||
|
||||
@@ -5,8 +5,6 @@ import {
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
import { d3keybinding as d3_keybinding } from '../lib/d3.keybinding.js';
|
||||
|
||||
import { t } from '../util/locale';
|
||||
import { JXON } from '../util/jxon';
|
||||
import { geoExtent } from '../geo';
|
||||
@@ -16,6 +14,7 @@ import { utilDetect } from '../util/detect';
|
||||
|
||||
import {
|
||||
utilEntityOrMemberSelector,
|
||||
utilKeybinding,
|
||||
utilRebind,
|
||||
utilWrap
|
||||
} from '../util';
|
||||
@@ -23,7 +22,7 @@ import {
|
||||
|
||||
export function uiConflicts(context) {
|
||||
var dispatch = d3_dispatch('cancel', 'save');
|
||||
var keybinding = d3_keybinding('conflicts');
|
||||
var keybinding = utilKeybinding('conflicts');
|
||||
var _origChanges;
|
||||
var _conflictList;
|
||||
|
||||
@@ -35,7 +34,7 @@ export function uiConflicts(context) {
|
||||
|
||||
function keybindingOff() {
|
||||
d3_select(document)
|
||||
.call(keybinding.off);
|
||||
.call(keybinding.unbind);
|
||||
}
|
||||
|
||||
function tryAgain() {
|
||||
|
||||
@@ -3,8 +3,6 @@ import {
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
import { d3keybinding as d3_keybinding } from '../lib/d3.keybinding.js';
|
||||
|
||||
import * as sexagesimal from '@mapbox/sexagesimal';
|
||||
import { t } from '../util/locale';
|
||||
import { dmsCoordinatePair } from '../util/units';
|
||||
@@ -25,7 +23,6 @@ import {
|
||||
|
||||
|
||||
export function uiFeatureList(context) {
|
||||
var keybinding = d3_keybinding('uiFeatureList');
|
||||
var _geocodeResults;
|
||||
|
||||
|
||||
@@ -67,12 +64,9 @@ export function uiFeatureList(context) {
|
||||
context.map()
|
||||
.on('drawn.feature-list', mapDrawn);
|
||||
|
||||
keybinding
|
||||
context.keybinding()
|
||||
.on(uiCmd('⌘F'), focusSearch);
|
||||
|
||||
d3_select(document)
|
||||
.call(keybinding);
|
||||
|
||||
|
||||
function focusSearch() {
|
||||
var mode = context.mode() && context.mode().id;
|
||||
|
||||
@@ -1,18 +1,12 @@
|
||||
import {
|
||||
event as d3_event,
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
import { d3keybinding as d3_keybinding } from '../lib/d3.keybinding.js';
|
||||
import { event as d3_event } from 'd3-selection';
|
||||
|
||||
import { uiCmd } from './cmd';
|
||||
import { utilDetect } from '../util/detect';
|
||||
|
||||
|
||||
export function uiFullScreen(context) {
|
||||
var element = context.container().node(),
|
||||
keybinding = d3_keybinding('full-screen');
|
||||
// button;
|
||||
var element = context.container().node();
|
||||
// var button = d3_select(null);
|
||||
|
||||
|
||||
function getFullScreenFn() {
|
||||
@@ -67,8 +61,7 @@ export function uiFullScreen(context) {
|
||||
|
||||
|
||||
return function() { // selection) {
|
||||
if (!isSupported())
|
||||
return;
|
||||
if (!isSupported()) return;
|
||||
|
||||
// button = selection.append('button')
|
||||
// .attr('title', t('full_screen'))
|
||||
@@ -80,10 +73,7 @@ export function uiFullScreen(context) {
|
||||
// .attr('class', 'icon full-screen');
|
||||
|
||||
var detected = utilDetect();
|
||||
var keys = detected.os === 'mac' ? [uiCmd('⌃⌘F'), 'f11'] : ['f11'];
|
||||
keybinding.on(keys, fullScreen);
|
||||
|
||||
d3_select(document)
|
||||
.call(keybinding);
|
||||
var keys = (detected.os === 'mac' ? [uiCmd('⌃⌘F'), 'f11'] : ['f11']);
|
||||
context.keybinding().on(keys, fullScreen);
|
||||
};
|
||||
}
|
||||
|
||||
+4
-9
@@ -3,10 +3,7 @@ import {
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
import { d3keybinding as d3_keybinding } from '../lib/d3.keybinding.js';
|
||||
|
||||
import marked from 'marked';
|
||||
import { t, textDirection } from '../util/locale';
|
||||
import { svgIcon } from '../svg';
|
||||
import { uiCmd } from './cmd';
|
||||
import { uiBackground } from './background';
|
||||
@@ -14,6 +11,8 @@ import { uiIntro } from './intro';
|
||||
import { uiMapData } from './map_data';
|
||||
import { uiShortcuts } from './shortcuts';
|
||||
import { uiTooltipHtml } from './tooltipHtml';
|
||||
|
||||
import { t, textDirection } from '../util/locale';
|
||||
import { tooltip } from '../util/tooltip';
|
||||
import { icon } from './intro/helper';
|
||||
|
||||
@@ -476,12 +475,8 @@ export function uiHelp(context) {
|
||||
|
||||
clickHelp(docs[0], 0);
|
||||
|
||||
var keybinding = d3_keybinding('help')
|
||||
.on(key, togglePane)
|
||||
.on([t('background.key'), t('map_data.key')], hidePane);
|
||||
|
||||
d3_select(document)
|
||||
.call(keybinding);
|
||||
context.keybinding()
|
||||
.on(key, togglePane);
|
||||
|
||||
uiHelp.hidePane = hidePane;
|
||||
uiHelp.togglePane = togglePane;
|
||||
|
||||
+6
-11
@@ -3,8 +3,6 @@ import {
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
import { d3keybinding as d3_keybinding } from '../lib/d3.keybinding.js';
|
||||
|
||||
import { t } from '../util/locale';
|
||||
import { svgIcon } from '../svg';
|
||||
import { uiCmd } from './cmd';
|
||||
@@ -12,10 +10,10 @@ import { uiInfoPanels } from './panels';
|
||||
|
||||
|
||||
export function uiInfo(context) {
|
||||
var ids = Object.keys(uiInfoPanels),
|
||||
wasActive = ['measurement'],
|
||||
panels = {},
|
||||
active = {};
|
||||
var ids = Object.keys(uiInfoPanels);
|
||||
var wasActive = ['measurement'];
|
||||
var panels = {};
|
||||
var active = {};
|
||||
|
||||
// create panels
|
||||
ids.forEach(function(k) {
|
||||
@@ -118,18 +116,15 @@ export function uiInfo(context) {
|
||||
|
||||
redraw();
|
||||
|
||||
var keybinding = d3_keybinding('info')
|
||||
context.keybinding()
|
||||
.on(uiCmd('⌘' + t('info_panels.key')), toggle);
|
||||
|
||||
ids.forEach(function(k) {
|
||||
var key = t('info_panels.' + k + '.key', { default: null });
|
||||
if (!key) return;
|
||||
keybinding
|
||||
context.keybinding()
|
||||
.on(uiCmd('⌘⇧' + key), function() { toggle(k); });
|
||||
});
|
||||
|
||||
d3_select(document)
|
||||
.call(keybinding);
|
||||
}
|
||||
|
||||
return info;
|
||||
|
||||
+2
-6
@@ -3,8 +3,6 @@ import {
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
import { d3keybinding as d3_keybinding } from '../lib/d3.keybinding.js';
|
||||
|
||||
import { t, textDirection } from '../util/locale';
|
||||
import { tooltip } from '../util/tooltip';
|
||||
|
||||
@@ -298,7 +296,7 @@ export function uiInit(context) {
|
||||
|
||||
|
||||
var panPixels = 80;
|
||||
var keybinding = d3_keybinding('main')
|
||||
context.keybinding()
|
||||
.on('⌫', function() { d3_event.preventDefault(); })
|
||||
.on(t('sidebar.key'), ui.sidebar.toggle)
|
||||
.on('←', pan([panPixels, 0]))
|
||||
@@ -310,9 +308,6 @@ export function uiInit(context) {
|
||||
.on(['⇧→', uiCmd('⌘→')], pan([-map.dimensions()[0], 0]))
|
||||
.on(['⇧↓', uiCmd('⌘↓')], pan([0, -map.dimensions()[1]]));
|
||||
|
||||
d3_select(document)
|
||||
.call(keybinding);
|
||||
|
||||
context.enter(modeBrowse(context));
|
||||
|
||||
if (!_initCounter++) {
|
||||
@@ -373,6 +368,7 @@ export function uiInit(context) {
|
||||
|
||||
|
||||
ui.restart = function(arg) {
|
||||
context.keybinding().clear();
|
||||
context.locale(arg);
|
||||
context.loadLocale(function(err) {
|
||||
if (!err) {
|
||||
|
||||
@@ -3,8 +3,6 @@ import {
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
import { d3keybinding as d3_keybinding } from '../lib/d3.keybinding.js';
|
||||
|
||||
import { svgIcon } from '../svg';
|
||||
import { t, textDirection } from '../util/locale';
|
||||
import { tooltip } from '../util/tooltip';
|
||||
@@ -646,13 +644,9 @@ export function uiMapData(context) {
|
||||
update();
|
||||
setFill(_fillSelected);
|
||||
|
||||
var keybinding = d3_keybinding('features')
|
||||
context.keybinding()
|
||||
.on(key, togglePane)
|
||||
.on(t('area_fill.wireframe.key'), toggleWireframe)
|
||||
.on([t('background.key'), t('help.key')], hidePane);
|
||||
|
||||
d3_select(document)
|
||||
.call(keybinding);
|
||||
.on(t('area_fill.wireframe.key'), toggleWireframe);
|
||||
|
||||
uiMapData.hidePane = hidePane;
|
||||
uiMapData.togglePane = togglePane;
|
||||
|
||||
@@ -10,8 +10,6 @@ import {
|
||||
zoomIdentity as d3_zoomIdentity
|
||||
} from 'd3-zoom';
|
||||
|
||||
import { d3keybinding as d3_keybinding } from '../lib/d3.keybinding.js';
|
||||
|
||||
import { t } from '../util/locale';
|
||||
import {
|
||||
geoRawMercator,
|
||||
@@ -336,11 +334,8 @@ export function uiMapInMap(context) {
|
||||
|
||||
redraw();
|
||||
|
||||
var keybinding = d3_keybinding('map-in-map')
|
||||
context.keybinding()
|
||||
.on(t('background.minimap.key'), toggle);
|
||||
|
||||
d3_select(document)
|
||||
.call(keybinding);
|
||||
}
|
||||
|
||||
return map_in_map;
|
||||
|
||||
+4
-4
@@ -3,13 +3,12 @@ import {
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
import { d3keybinding as d3_keybinding } from '../lib/d3.keybinding.js';
|
||||
|
||||
import { svgIcon } from '../svg';
|
||||
import { utilKeybinding } from '../util';
|
||||
|
||||
|
||||
export function uiModal(selection, blocking) {
|
||||
var keybinding = d3_keybinding('modal');
|
||||
var keybinding = utilKeybinding('modal');
|
||||
var previous = selection.select('div.modal');
|
||||
var animate = previous.empty();
|
||||
|
||||
@@ -35,7 +34,8 @@ export function uiModal(selection, blocking) {
|
||||
.duration(200)
|
||||
.style('top','0px');
|
||||
|
||||
keybinding.off();
|
||||
d3_select(document)
|
||||
.call(keybinding.unbind);
|
||||
};
|
||||
|
||||
|
||||
|
||||
+1
-7
@@ -1,7 +1,6 @@
|
||||
import _debounce from 'lodash-es/debounce';
|
||||
|
||||
import { select as d3_select } from 'd3-selection';
|
||||
import { d3keybinding as d3_keybinding } from '../lib/d3.keybinding.js';
|
||||
|
||||
import {
|
||||
modeAddArea,
|
||||
@@ -56,10 +55,8 @@ export function uiModes(context) {
|
||||
.classed('mode-' + exited.id, false);
|
||||
});
|
||||
|
||||
var keybinding = d3_keybinding('mode-buttons');
|
||||
|
||||
modes.forEach(function(mode) {
|
||||
keybinding.on(mode.key, function() {
|
||||
context.keybinding().on(mode.key, function() {
|
||||
if (mode.id === 'add-note' && !(notesEnabled() && notesEditable())) return;
|
||||
if (mode.id !== 'add-note' && !editable()) return;
|
||||
|
||||
@@ -71,9 +68,6 @@ export function uiModes(context) {
|
||||
});
|
||||
});
|
||||
|
||||
d3_select(document)
|
||||
.call(keybinding);
|
||||
|
||||
|
||||
var debouncedUpdate = _debounce(update, 500, { leading: true, trailing: true });
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@ export function uiPanelBackground(context) {
|
||||
var debouncedRedraw = _debounce(redraw, 250);
|
||||
|
||||
function redraw(selection) {
|
||||
var source = background.baseLayerSource(),
|
||||
isDG = (source.id.match(/^DigitalGlobe/i) !== null);
|
||||
var source = background.baseLayerSource();
|
||||
var isDG = (source.id.match(/^DigitalGlobe/i) !== null);
|
||||
|
||||
if (currSourceName !== source.name()) {
|
||||
currSourceName = source.name();
|
||||
|
||||
+42
-49
@@ -5,8 +5,6 @@ import {
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
import { d3keybinding as d3_keybinding } from '../lib/d3.keybinding.js';
|
||||
|
||||
import { t, textDirection } from '../util/locale';
|
||||
import { actionChangePreset } from '../actions/index';
|
||||
import { operationDelete } from '../operations/index';
|
||||
@@ -14,19 +12,19 @@ import { modeBrowse } from '../modes/index';
|
||||
import { svgIcon } from '../svg/index';
|
||||
import { uiPresetIcon } from './preset_icon';
|
||||
import { uiTagReference } from './tag_reference';
|
||||
import { utilNoAuto, utilRebind } from '../util';
|
||||
import { utilKeybinding, utilNoAuto, utilRebind } from '../util';
|
||||
|
||||
|
||||
export function uiPresetList(context) {
|
||||
var dispatch = d3_dispatch('choose'),
|
||||
id,
|
||||
currentPreset,
|
||||
autofocus = false;
|
||||
var dispatch = d3_dispatch('choose');
|
||||
var _entityID;
|
||||
var _currentPreset;
|
||||
var _autofocus = false;
|
||||
|
||||
|
||||
function presetList(selection) {
|
||||
var entity = context.entity(id),
|
||||
geometry = context.geometry(id);
|
||||
var entity = context.entity(_entityID);
|
||||
var geometry = context.geometry(_entityID);
|
||||
|
||||
// Treat entities on addr:interpolation lines as points, not vertices (#3241)
|
||||
if (geometry === 'vertex' && entity.isOnAddressLine(context.graph())) {
|
||||
@@ -45,11 +43,11 @@ export function uiPresetList(context) {
|
||||
.append('h3')
|
||||
.text(t('inspector.choose'));
|
||||
|
||||
if (context.entity(id).isUsed(context.graph())) {
|
||||
if (context.entity(_entityID).isUsed(context.graph())) {
|
||||
messagewrap
|
||||
.append('button')
|
||||
.attr('class', 'preset-choose')
|
||||
.on('click', function() { dispatch.call('choose', this, currentPreset); })
|
||||
.on('click', function() { dispatch.call('choose', this, _currentPreset); })
|
||||
.call(svgIcon((textDirection === 'rtl') ? '#iD-icon-backward' : '#iD-icon-forward'));
|
||||
} else {
|
||||
messagewrap
|
||||
@@ -64,16 +62,16 @@ export function uiPresetList(context) {
|
||||
function initialKeydown() {
|
||||
// hack to let delete shortcut work when search is autofocused
|
||||
if (search.property('value').length === 0 &&
|
||||
(d3_event.keyCode === d3_keybinding.keyCodes['⌫'] ||
|
||||
d3_event.keyCode === d3_keybinding.keyCodes['⌦'])) {
|
||||
(d3_event.keyCode === utilKeybinding.keyCodes['⌫'] ||
|
||||
d3_event.keyCode === utilKeybinding.keyCodes['⌦'])) {
|
||||
d3_event.preventDefault();
|
||||
d3_event.stopPropagation();
|
||||
operationDelete([id], context)();
|
||||
operationDelete([_entityID], context)();
|
||||
|
||||
// hack to let undo work when search is autofocused
|
||||
} else if (search.property('value').length === 0 &&
|
||||
(d3_event.ctrlKey || d3_event.metaKey) &&
|
||||
d3_event.keyCode === d3_keybinding.keyCodes.z) {
|
||||
d3_event.keyCode === utilKeybinding.keyCodes.z) {
|
||||
d3_event.preventDefault();
|
||||
d3_event.stopPropagation();
|
||||
context.undo();
|
||||
@@ -86,7 +84,7 @@ export function uiPresetList(context) {
|
||||
|
||||
function keydown() {
|
||||
// down arrow
|
||||
if (d3_event.keyCode === d3_keybinding.keyCodes['↓'] &&
|
||||
if (d3_event.keyCode === utilKeybinding.keyCodes['↓'] &&
|
||||
// if insertion point is at the end of the string
|
||||
search.node().selectionStart === search.property('value').length) {
|
||||
d3_event.preventDefault();
|
||||
@@ -137,7 +135,7 @@ export function uiPresetList(context) {
|
||||
searchWrap
|
||||
.call(svgIcon('#iD-icon-search', 'pre-text'));
|
||||
|
||||
if (autofocus) {
|
||||
if (_autofocus) {
|
||||
search.node().focus();
|
||||
}
|
||||
|
||||
@@ -168,7 +166,7 @@ export function uiPresetList(context) {
|
||||
items.enter()
|
||||
.append('div')
|
||||
.attr('class', function(item) { return 'preset-list-item preset-' + item.preset.id.replace('/', '-'); })
|
||||
.classed('current', function(item) { return item.preset === currentPreset; })
|
||||
.classed('current', function(item) { return item.preset === _currentPreset; })
|
||||
.each(function(item) { d3_select(this).call(item); })
|
||||
.style('opacity', 0)
|
||||
.transition()
|
||||
@@ -181,7 +179,7 @@ export function uiPresetList(context) {
|
||||
var parentItem = d3_select(item.node().parentElement.closest('.preset-list-item'));
|
||||
|
||||
// arrow down, move focus to the next, lower item
|
||||
if (d3_event.keyCode === d3_keybinding.keyCodes['↓']) {
|
||||
if (d3_event.keyCode === utilKeybinding.keyCodes['↓']) {
|
||||
d3_event.preventDefault();
|
||||
d3_event.stopPropagation();
|
||||
// the next item in the list at the same level
|
||||
@@ -205,7 +203,7 @@ export function uiPresetList(context) {
|
||||
}
|
||||
|
||||
// arrow up, move focus to the previous, higher item
|
||||
} else if (d3_event.keyCode === d3_keybinding.keyCodes['↑']) {
|
||||
} else if (d3_event.keyCode === utilKeybinding.keyCodes['↑']) {
|
||||
d3_event.preventDefault();
|
||||
d3_event.stopPropagation();
|
||||
// the previous item in the list at the same level
|
||||
@@ -215,8 +213,7 @@ export function uiPresetList(context) {
|
||||
if (previousItem.empty()) {
|
||||
// if there is a parent item
|
||||
if (!parentItem.empty()) {
|
||||
// the item is the first subitem of a sublist,
|
||||
// select the parent item
|
||||
// the item is the first subitem of a sublist select the parent item
|
||||
previousItem = parentItem;
|
||||
}
|
||||
// if the previous item is expanded
|
||||
@@ -224,29 +221,27 @@ export function uiPresetList(context) {
|
||||
// select the last subitem of the sublist of the previous item
|
||||
previousItem = previousItem.select('.subgrid .preset-list-item:last-child');
|
||||
}
|
||||
|
||||
if (!previousItem.empty()) {
|
||||
// focus on the previous item
|
||||
previousItem.select('.preset-list-button').node().focus();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// the focus is at the top of the list, move focus back to the search field
|
||||
var search = d3_select(this.closest('.preset-list-pane')).select('.preset-search-input');
|
||||
search.node().focus();
|
||||
}
|
||||
}
|
||||
|
||||
// arrow left, move focus to the parent item if there is one
|
||||
else if (d3_event.keyCode === d3_keybinding.keyCodes[(textDirection === 'rtl') ? '→' : '←']) {
|
||||
} else if (d3_event.keyCode === utilKeybinding.keyCodes[(textDirection === 'rtl') ? '→' : '←']) {
|
||||
d3_event.preventDefault();
|
||||
d3_event.stopPropagation();
|
||||
|
||||
// if there is a parent item
|
||||
// if there is a parent item, focus on the parent item
|
||||
if (!parentItem.empty()) {
|
||||
// focus on the parent item
|
||||
parentItem.select('.preset-list-button').node().focus();
|
||||
}
|
||||
}
|
||||
|
||||
// arrow right, choose this item
|
||||
else if (d3_event.keyCode === d3_keybinding.keyCodes[(textDirection === 'rtl') ? '←' : '→']) {
|
||||
} else if (d3_event.keyCode === utilKeybinding.keyCodes[(textDirection === 'rtl') ? '←' : '→']) {
|
||||
d3_event.preventDefault();
|
||||
d3_event.stopPropagation();
|
||||
item.datum().choose();
|
||||
@@ -277,12 +272,12 @@ export function uiPresetList(context) {
|
||||
.attr('class', 'preset-list-button')
|
||||
.classed('expanded', false)
|
||||
.call(uiPresetIcon()
|
||||
.geometry(context.geometry(id))
|
||||
.geometry(context.geometry(_entityID))
|
||||
.preset(preset))
|
||||
.on('click', click)
|
||||
.on('keydown', function() {
|
||||
// right arrow, expand the focused item
|
||||
if (d3_event.keyCode === d3_keybinding.keyCodes[(textDirection === 'rtl') ? '←' : '→']) {
|
||||
if (d3_event.keyCode === utilKeybinding.keyCodes[(textDirection === 'rtl') ? '←' : '→']) {
|
||||
d3_event.preventDefault();
|
||||
d3_event.stopPropagation();
|
||||
// if the item isn't expanded
|
||||
@@ -291,7 +286,7 @@ export function uiPresetList(context) {
|
||||
click.call(this);
|
||||
}
|
||||
// left arrow, collapse the focused item
|
||||
} else if (d3_event.keyCode === d3_keybinding.keyCodes[(textDirection === 'rtl') ? '→' : '←']) {
|
||||
} else if (d3_event.keyCode === utilKeybinding.keyCodes[(textDirection === 'rtl') ? '→' : '←']) {
|
||||
d3_event.preventDefault();
|
||||
d3_event.stopPropagation();
|
||||
// if the item is expanded
|
||||
@@ -348,7 +343,6 @@ export function uiPresetList(context) {
|
||||
};
|
||||
|
||||
item.preset = preset;
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
@@ -361,7 +355,7 @@ export function uiPresetList(context) {
|
||||
wrap.append('button')
|
||||
.attr('class', 'preset-list-button')
|
||||
.call(uiPresetIcon()
|
||||
.geometry(context.geometry(id))
|
||||
.geometry(context.geometry(_entityID))
|
||||
.preset(preset))
|
||||
.on('click', item.choose)
|
||||
.on('keydown', itemKeydown)
|
||||
@@ -375,9 +369,8 @@ export function uiPresetList(context) {
|
||||
|
||||
item.choose = function() {
|
||||
context.presets().choose(preset);
|
||||
|
||||
context.perform(
|
||||
actionChangePreset(id, currentPreset, preset),
|
||||
actionChangePreset(_entityID, _currentPreset, preset),
|
||||
t('operations.change_tags.annotation')
|
||||
);
|
||||
|
||||
@@ -390,30 +383,30 @@ export function uiPresetList(context) {
|
||||
};
|
||||
|
||||
item.preset = preset;
|
||||
item.reference = uiTagReference(preset.reference(context.geometry(id)), context);
|
||||
item.reference = uiTagReference(preset.reference(context.geometry(_entityID)), context);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
|
||||
presetList.autofocus = function(_) {
|
||||
if (!arguments.length) return autofocus;
|
||||
autofocus = _;
|
||||
presetList.autofocus = function(val) {
|
||||
if (!arguments.length) return _autofocus;
|
||||
_autofocus = val;
|
||||
return presetList;
|
||||
};
|
||||
|
||||
|
||||
presetList.entityID = function(_) {
|
||||
if (!arguments.length) return id;
|
||||
id = _;
|
||||
presetList.preset(context.presets().match(context.entity(id), context.graph()));
|
||||
presetList.entityID = function(val) {
|
||||
if (!arguments.length) return _entityID;
|
||||
_entityID = val;
|
||||
presetList.preset(context.presets().match(context.entity(_entityID), context.graph()));
|
||||
return presetList;
|
||||
};
|
||||
|
||||
|
||||
presetList.preset = function(_) {
|
||||
if (!arguments.length) return currentPreset;
|
||||
currentPreset = _;
|
||||
presetList.preset = function(val) {
|
||||
if (!arguments.length) return _currentPreset;
|
||||
_currentPreset = val;
|
||||
return presetList;
|
||||
};
|
||||
|
||||
|
||||
+2
-11
@@ -1,11 +1,5 @@
|
||||
import { interpolateRgb as d3_interpolateRgb } from 'd3-interpolate';
|
||||
|
||||
import {
|
||||
event as d3_event,
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
import { d3keybinding as d3_keybinding } from '../lib/d3.keybinding.js';
|
||||
import { event as d3_event } from 'd3-selection';
|
||||
|
||||
import { t } from '../util/locale';
|
||||
import { modeSave } from '../modes';
|
||||
@@ -101,12 +95,9 @@ export function uiSave(context) {
|
||||
updateCount();
|
||||
|
||||
|
||||
var keybinding = d3_keybinding('uiSave')
|
||||
context.keybinding()
|
||||
.on(key, save, true);
|
||||
|
||||
d3_select(document)
|
||||
.call(keybinding);
|
||||
|
||||
context.history()
|
||||
.on('change.save', updateCount);
|
||||
|
||||
|
||||
+19
-25
@@ -3,8 +3,6 @@ import {
|
||||
selectAll as d3_selectAll
|
||||
} from 'd3-selection';
|
||||
|
||||
import { d3keybinding as d3_keybinding } from '../lib/d3.keybinding.js';
|
||||
|
||||
import { t } from '../util/locale';
|
||||
import { dataShortcuts } from '../../data';
|
||||
import { svgIcon } from '../svg';
|
||||
@@ -13,36 +11,32 @@ import { uiModal } from './modal';
|
||||
import { utilDetect } from '../util/detect';
|
||||
|
||||
|
||||
export function uiShortcuts() {
|
||||
export function uiShortcuts(context) {
|
||||
var detected = utilDetect();
|
||||
var activeTab = 0;
|
||||
var modalSelection;
|
||||
var savedSelection;
|
||||
var _activeTab = 0;
|
||||
var _modalSelection;
|
||||
var _selection = d3_select(null);
|
||||
|
||||
|
||||
var keybinding = d3_keybinding('shortcuts')
|
||||
context.keybinding()
|
||||
.on(t('shortcuts.toggle.key'), function () {
|
||||
if (d3_selectAll('.modal-shortcuts').size()) { // already showing
|
||||
if (modalSelection) {
|
||||
modalSelection.close();
|
||||
modalSelection = null;
|
||||
if (_modalSelection) {
|
||||
_modalSelection.close();
|
||||
_modalSelection = null;
|
||||
}
|
||||
} else {
|
||||
modalSelection = uiModal(savedSelection);
|
||||
shortcutsModal(modalSelection);
|
||||
_modalSelection = uiModal(_selection);
|
||||
shortcutsModal(_modalSelection);
|
||||
}
|
||||
});
|
||||
|
||||
d3_select(document)
|
||||
.call(keybinding);
|
||||
|
||||
|
||||
|
||||
function shortcutsModal(modalSelection) {
|
||||
modalSelection.select('.modal')
|
||||
function shortcutsModal(_modalSelection) {
|
||||
_modalSelection.select('.modal')
|
||||
.classed('modal-shortcuts', true);
|
||||
|
||||
var shortcutsModal = modalSelection.select('.content');
|
||||
var shortcutsModal = _modalSelection.select('.content');
|
||||
|
||||
shortcutsModal
|
||||
.append('div')
|
||||
@@ -84,7 +78,7 @@ export function uiShortcuts() {
|
||||
.append('div')
|
||||
.attr('class', 'tab')
|
||||
.on('click', function (d, i) {
|
||||
activeTab = i;
|
||||
_activeTab = i;
|
||||
render(selection);
|
||||
});
|
||||
|
||||
@@ -98,7 +92,7 @@ export function uiShortcuts() {
|
||||
// Update
|
||||
wrapper.selectAll('.tab')
|
||||
.classed('active', function (d, i) {
|
||||
return i === activeTab;
|
||||
return i === _activeTab;
|
||||
});
|
||||
|
||||
|
||||
@@ -246,16 +240,16 @@ export function uiShortcuts() {
|
||||
// Update
|
||||
wrapper.selectAll('.shortcut-tab')
|
||||
.style('display', function (d, i) {
|
||||
return i === activeTab ? 'flex' : 'none';
|
||||
return i === _activeTab ? 'flex' : 'none';
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
return function(selection, show) {
|
||||
savedSelection = selection;
|
||||
_selection = selection;
|
||||
if (show) {
|
||||
modalSelection = uiModal(selection);
|
||||
shortcutsModal(modalSelection);
|
||||
_modalSelection = uiModal(selection);
|
||||
shortcutsModal(_modalSelection);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -5,8 +5,6 @@ import {
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
import { d3keybinding as d3_keybinding } from '../lib/d3.keybinding.js';
|
||||
|
||||
import { t, textDirection } from '../util/locale';
|
||||
import { svgIcon } from '../svg';
|
||||
import { uiCmd } from './cmd';
|
||||
@@ -65,13 +63,10 @@ export function uiUndoRedo(context) {
|
||||
.call(svgIcon('#iD-icon-' + iconName));
|
||||
});
|
||||
|
||||
var keybinding = d3_keybinding('undo')
|
||||
context.keybinding()
|
||||
.on(commands[0].cmd, function() { d3_event.preventDefault(); commands[0].action(); })
|
||||
.on(commands[1].cmd, function() { d3_event.preventDefault(); commands[1].action(); });
|
||||
|
||||
d3_select(document)
|
||||
.call(keybinding);
|
||||
|
||||
|
||||
var debouncedUpdate = _debounce(update, 500, { leading: true, trailing: true });
|
||||
|
||||
|
||||
+4
-11
@@ -3,8 +3,6 @@ import {
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
import { d3keybinding as d3_keybinding } from '../lib/d3.keybinding.js';
|
||||
|
||||
import { t, textDirection } from '../util/locale';
|
||||
import { svgIcon } from '../svg';
|
||||
import { uiCmd } from './cmd';
|
||||
@@ -73,19 +71,14 @@ export function uiZoom(context) {
|
||||
.call(svgIcon('#iD-icon-' + d.icon, 'light'));
|
||||
});
|
||||
|
||||
var keybinding = d3_keybinding('zoom');
|
||||
|
||||
['plus', 'ffplus', '=', 'ffequals'].forEach(function(key) {
|
||||
keybinding.on([key], zoomIn);
|
||||
keybinding.on([uiCmd('⌘' + key)], zoomInFurther);
|
||||
context.keybinding().on([key], zoomIn);
|
||||
context.keybinding().on([uiCmd('⌘' + key)], zoomInFurther);
|
||||
});
|
||||
|
||||
['_', '-', 'ffminus', 'dash'].forEach(function(key) {
|
||||
keybinding.on([key], zoomOut);
|
||||
keybinding.on([uiCmd('⌘' + key)], zoomOutFurther);
|
||||
context.keybinding().on([key], zoomOut);
|
||||
context.keybinding().on([uiCmd('⌘' + key)], zoomOutFurther);
|
||||
});
|
||||
|
||||
d3_select(document)
|
||||
.call(keybinding);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ export { utilGetSetValue } from './get_set_value';
|
||||
export { utilHashcode } from './util';
|
||||
export { utilHighlightEntity } from './util';
|
||||
export { utilIdleWorker } from './idle_worker';
|
||||
export { utilKeybinding } from './keybinding';
|
||||
export { utilNoAuto } from './util';
|
||||
export { utilPrefixCSSProperty } from './util';
|
||||
export { utilPrefixDOMProperty } from './util';
|
||||
|
||||
@@ -1,32 +1,26 @@
|
||||
import _isFunction from 'lodash-es/isFunction';
|
||||
|
||||
import {
|
||||
event as d3_event,
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
|
||||
/*
|
||||
* This code is licensed under the MIT license.
|
||||
*
|
||||
* Copyright © 2013, iD authors.
|
||||
*
|
||||
* Portions copyright © 2011, Keith Cirkel
|
||||
* See https://github.com/keithamus/jwerty
|
||||
*
|
||||
*/
|
||||
export function d3keybinding(namespace) {
|
||||
var bindings = [];
|
||||
export function utilKeybinding(namespace) {
|
||||
var _keybindings = {};
|
||||
|
||||
|
||||
function testBindings(isCapturing) {
|
||||
var didMatch = false,
|
||||
i, binding;
|
||||
var didMatch = false;
|
||||
var bindings = Object.keys(_keybindings).map(function(id) { return _keybindings[id]; });
|
||||
var i, binding;
|
||||
|
||||
// Most key shortcuts will accept either lower or uppercase ('h' or 'H'),
|
||||
// so we don't strictly match on the shift key, but we prioritize
|
||||
// shifted bindings first, and fallback to unshifted only if no match.
|
||||
// shifted keybindings first, and fallback to unshifted only if no match.
|
||||
// (This lets us differentiate between '←'/'⇧←' or '⌘Z'/'⌘⇧Z')
|
||||
|
||||
// priority match shifted bindings first
|
||||
// priority match shifted keybindings first
|
||||
for (i = 0; i < bindings.length; i++) {
|
||||
binding = bindings[i];
|
||||
if (!binding.event.modifiers.shiftKey) continue; // no shift
|
||||
@@ -37,7 +31,7 @@ export function d3keybinding(namespace) {
|
||||
}
|
||||
}
|
||||
|
||||
// then unshifted bindings
|
||||
// then unshifted keybindings
|
||||
if (didMatch) return;
|
||||
for (i = 0; i < bindings.length; i++) {
|
||||
binding = bindings[i];
|
||||
@@ -108,26 +102,53 @@ export function d3keybinding(namespace) {
|
||||
|
||||
function keybinding(selection) {
|
||||
selection = selection || d3_select(document);
|
||||
selection.on('keydown.capture' + namespace, capture, true);
|
||||
selection.on('keydown.bubble' + namespace, bubble, false);
|
||||
selection.on('keydown.capture.' + namespace, capture, true);
|
||||
selection.on('keydown.bubble.' + namespace, bubble, false);
|
||||
return keybinding;
|
||||
}
|
||||
|
||||
|
||||
keybinding.off = function(selection) {
|
||||
bindings = [];
|
||||
// was: keybinding.off()
|
||||
keybinding.unbind = function(selection) {
|
||||
_keybindings = [];
|
||||
selection = selection || d3_select(document);
|
||||
selection.on('keydown.capture' + namespace, null);
|
||||
selection.on('keydown.bubble' + namespace, null);
|
||||
selection.on('keydown.capture.' + namespace, null);
|
||||
selection.on('keydown.bubble.' + namespace, null);
|
||||
return keybinding;
|
||||
};
|
||||
|
||||
|
||||
keybinding.on = function(codes, callback, capture) {
|
||||
keybinding.clear = function() {
|
||||
_keybindings = {};
|
||||
return keybinding;
|
||||
};
|
||||
|
||||
|
||||
// Remove one or more keycode bindings.
|
||||
keybinding.off = function(codes, capture) {
|
||||
var arr = [].concat(codes);
|
||||
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
var code = arr[i];
|
||||
var id = arr[i] + (capture ? '-capture' : '-bubble');
|
||||
delete _keybindings[id];
|
||||
}
|
||||
return keybinding;
|
||||
};
|
||||
|
||||
|
||||
// Add one or more keycode bindings.
|
||||
keybinding.on = function(codes, callback, capture) {
|
||||
if (!_isFunction(callback)) {
|
||||
return keybinding.off(codes, capture);
|
||||
}
|
||||
|
||||
var arr = [].concat(codes);
|
||||
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
var id = arr[i] + (capture ? '-capture' : '-bubble');
|
||||
var binding = {
|
||||
id: id,
|
||||
capture: capture,
|
||||
callback: callback,
|
||||
event: {
|
||||
key: undefined, // preferred
|
||||
keyCode: 0, // fallback
|
||||
@@ -137,38 +158,45 @@ export function d3keybinding(namespace) {
|
||||
altKey: false,
|
||||
metaKey: false
|
||||
}
|
||||
},
|
||||
capture: capture,
|
||||
callback: callback
|
||||
}
|
||||
};
|
||||
|
||||
code = code.toLowerCase().match(/(?:(?:[^+⇧⌃⌥⌘])+|[⇧⌃⌥⌘]|\+\+|^\+$)/g);
|
||||
if (_keybindings[id]) {
|
||||
console.warn('warning: duplicate keybinding for "' + id + '"'); // eslint-disable-line no-console
|
||||
}
|
||||
|
||||
for (var j = 0; j < code.length; j++) {
|
||||
_keybindings[id] = binding;
|
||||
|
||||
var matches = arr[i].toLowerCase().match(/(?:(?:[^+⇧⌃⌥⌘])+|[⇧⌃⌥⌘]|\+\+|^\+$)/g);
|
||||
for (var j = 0; j < matches.length; j++) {
|
||||
// Normalise matching errors
|
||||
if (code[j] === '++') code[j] = '+';
|
||||
if (matches[j] === '++') matches[j] = '+';
|
||||
|
||||
if (code[j] in d3keybinding.modifierCodes) {
|
||||
binding.event.modifiers[d3keybinding.modifierProperties[d3keybinding.modifierCodes[code[j]]]] = true;
|
||||
if (matches[j] in utilKeybinding.modifierCodes) {
|
||||
var prop = utilKeybinding.modifierProperties[utilKeybinding.modifierCodes[matches[j]]];
|
||||
binding.event.modifiers[prop] = true;
|
||||
} else {
|
||||
binding.event.key = d3keybinding.keys[code[j]] || code[j];
|
||||
if (code[j] in d3keybinding.keyCodes) {
|
||||
binding.event.keyCode = d3keybinding.keyCodes[code[j]];
|
||||
binding.event.key = utilKeybinding.keys[matches[j]] || matches[j];
|
||||
if (matches[j] in utilKeybinding.keyCodes) {
|
||||
binding.event.keyCode = utilKeybinding.keyCodes[matches[j]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bindings.push(binding);
|
||||
}
|
||||
|
||||
return keybinding;
|
||||
};
|
||||
|
||||
|
||||
return keybinding;
|
||||
}
|
||||
|
||||
|
||||
d3keybinding.modifierCodes = {
|
||||
/*
|
||||
* See https://github.com/keithamus/jwerty
|
||||
*/
|
||||
|
||||
utilKeybinding.modifierCodes = {
|
||||
// Shift key, ⇧
|
||||
'⇧': 16, shift: 16,
|
||||
// CTRL key, on Mac: ⌃
|
||||
@@ -179,14 +207,14 @@ d3keybinding.modifierCodes = {
|
||||
'⌘': 91, meta: 91, cmd: 91, 'super': 91, win: 91
|
||||
};
|
||||
|
||||
d3keybinding.modifierProperties = {
|
||||
utilKeybinding.modifierProperties = {
|
||||
16: 'shiftKey',
|
||||
17: 'ctrlKey',
|
||||
18: 'altKey',
|
||||
91: 'metaKey'
|
||||
};
|
||||
|
||||
d3keybinding.keys = {
|
||||
utilKeybinding.keys = {
|
||||
// Backspace key, on Mac: ⌫ (Backspace)
|
||||
'⌫': 'Backspace', backspace: 'Backspace',
|
||||
// Tab Key, on Mac: ⇥ (Tab), on Windows ⇥⇥
|
||||
@@ -287,7 +315,7 @@ d3keybinding.keys = {
|
||||
f25: 'F25'
|
||||
};
|
||||
|
||||
d3keybinding.keyCodes = {
|
||||
utilKeybinding.keyCodes = {
|
||||
// Backspace key, on Mac: ⌫ (Backspace)
|
||||
'⌫': 8, backspace: 8,
|
||||
// Tab Key, on Mac: ⇥ (Tab), on Windows ⇥⇥
|
||||
@@ -362,26 +390,26 @@ d3keybinding.keyCodes = {
|
||||
// NUMPAD 0-9
|
||||
var i = 95, n = 0;
|
||||
while (++i < 106) {
|
||||
d3keybinding.keyCodes['num-' + n] = i;
|
||||
utilKeybinding.keyCodes['num-' + n] = i;
|
||||
++n;
|
||||
}
|
||||
|
||||
// 0-9
|
||||
i = 47; n = 0;
|
||||
while (++i < 58) {
|
||||
d3keybinding.keyCodes[n] = i;
|
||||
utilKeybinding.keyCodes[n] = i;
|
||||
++n;
|
||||
}
|
||||
|
||||
// F1-F25
|
||||
i = 111; n = 1;
|
||||
while (++i < 136) {
|
||||
d3keybinding.keyCodes['f' + n] = i;
|
||||
utilKeybinding.keyCodes['f' + n] = i;
|
||||
++n;
|
||||
}
|
||||
|
||||
// a-z
|
||||
i = 64;
|
||||
while (++i < 91) {
|
||||
d3keybinding.keyCodes[String.fromCharCode(i).toLowerCase()] = i;
|
||||
utilKeybinding.keyCodes[String.fromCharCode(i).toLowerCase()] = i;
|
||||
}
|
||||
@@ -111,6 +111,31 @@ export function utilTiler() {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* getGeoJSON() returns a FeatureCollection for debugging tiles
|
||||
*/
|
||||
tiler.getGeoJSON = function(projection) {
|
||||
var features = tiler.getTiles(projection).map(function(tile) {
|
||||
return {
|
||||
type: 'Feature',
|
||||
properties: {
|
||||
id: tile.id,
|
||||
name: tile.id
|
||||
},
|
||||
geometry: {
|
||||
type: 'Polygon',
|
||||
coordinates: [ tile.extent.polygon() ]
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
return {
|
||||
type: 'FeatureCollection',
|
||||
features: features
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
tiler.tileSize = function(val) {
|
||||
if (!arguments.length) return _tileSize;
|
||||
_tileSize = val;
|
||||
|
||||
+1
-1
@@ -78,7 +78,7 @@
|
||||
"osm-community-index": "0.4.7",
|
||||
"phantomjs-prebuilt": "~2.1.11",
|
||||
"request": "^2.88.0",
|
||||
"rollup": "~0.66.0",
|
||||
"rollup": "~0.67.1",
|
||||
"rollup-plugin-commonjs": "^9.0.0",
|
||||
"rollup-plugin-includepaths": "~0.2.3",
|
||||
"rollup-plugin-json": "^3.0.0",
|
||||
|
||||
+1
-1
@@ -81,7 +81,6 @@
|
||||
<script src='spec/geo/vector.js'></script>
|
||||
|
||||
<script src='spec/lib/d3.combobox.js'></script>
|
||||
<script src='spec/lib/d3.keybinding.js'></script>
|
||||
<script src='spec/lib/locale.js'></script>
|
||||
|
||||
<script src='spec/modes/add_point.js'></script>
|
||||
@@ -138,6 +137,7 @@
|
||||
<script src='spec/ui/fields/wikipedia.js'></script>
|
||||
|
||||
<script src='spec/util/clean_tags.js'></script>
|
||||
<script src='spec/util/keybinding.js'></script>
|
||||
<script src='spec/util/session_mutex.js'></script>
|
||||
<script src='spec/util/suggest_names.js'></script>
|
||||
<script src='spec/util/util.js'></script>
|
||||
|
||||
@@ -10,7 +10,7 @@ describe('d3.combobox', function() {
|
||||
];
|
||||
|
||||
function simulateKeypress(key) {
|
||||
var keyCode = iD.lib.d3keybinding.keyCodes[key];
|
||||
var keyCode = iD.utilKeybinding.keyCodes[key];
|
||||
var value = input.property('value');
|
||||
var start = input.property('selectionStart');
|
||||
var finis = input.property('selectionEnd');
|
||||
|
||||
@@ -248,18 +248,19 @@ describe('iD.serviceMapillary', function() {
|
||||
]);
|
||||
});
|
||||
|
||||
it('limits results no more than 3 stacked images in one spot', function() {
|
||||
it('limits results no more than 5 stacked images in one spot', function() {
|
||||
var features = [
|
||||
{ minX: 10, minY: 0, maxX: 10, maxY: 0, data: { key: '0', loc: [10,0], ca: 90 } },
|
||||
{ minX: 10, minY: 0, maxX: 10, maxY: 0, data: { key: '1', loc: [10,0], ca: 90 } },
|
||||
{ minX: 10, minY: 0, maxX: 10, maxY: 0, data: { key: '2', loc: [10,0], ca: 90 } },
|
||||
{ minX: 10, minY: 0, maxX: 10, maxY: 0, data: { key: '3', loc: [10,0], ca: 90 } },
|
||||
{ minX: 10, minY: 0, maxX: 10, maxY: 0, data: { key: '4', loc: [10,0], ca: 90 } }
|
||||
{ minX: 10, minY: 0, maxX: 10, maxY: 0, data: { key: '4', loc: [10,0], ca: 90 } },
|
||||
{ minX: 10, minY: 0, maxX: 10, maxY: 0, data: { key: '5', loc: [10,0], ca: 90 } }
|
||||
];
|
||||
|
||||
mapillary.cache().images.rtree.load(features);
|
||||
var res = mapillary.images(context.projection);
|
||||
expect(res).to.have.length.of.at.most(3);
|
||||
expect(res).to.have.length.of.at.most(5);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -284,7 +285,7 @@ describe('iD.serviceMapillary', function() {
|
||||
]);
|
||||
});
|
||||
|
||||
it('limits results no more than 3 stacked signs in one spot', function() {
|
||||
it('limits results no more than 5 stacked signs in one spot', function() {
|
||||
var detections = [{
|
||||
detection_key: '78vqha63gs1upg15s823qckcmn',
|
||||
image_key: 'bwYs-uXLDvm_meo_EC5Nzw'
|
||||
@@ -294,12 +295,13 @@ describe('iD.serviceMapillary', function() {
|
||||
{ minX: 10, minY: 0, maxX: 10, maxY: 0, data: { key: '1', loc: [10,0], detections: detections } },
|
||||
{ minX: 10, minY: 0, maxX: 10, maxY: 0, data: { key: '2', loc: [10,0], detections: detections } },
|
||||
{ minX: 10, minY: 0, maxX: 10, maxY: 0, data: { key: '3', loc: [10,0], detections: detections } },
|
||||
{ minX: 10, minY: 0, maxX: 10, maxY: 0, data: { key: '4', loc: [10,0], detections: detections } }
|
||||
{ minX: 10, minY: 0, maxX: 10, maxY: 0, data: { key: '4', loc: [10,0], detections: detections } },
|
||||
{ minX: 10, minY: 0, maxX: 10, maxY: 0, data: { key: '5', loc: [10,0], detections: detections } }
|
||||
];
|
||||
|
||||
mapillary.cache().map_features.rtree.load(features);
|
||||
var res = mapillary.signs(context.projection);
|
||||
expect(res).to.have.length.of.at.most(3);
|
||||
expect(res).to.have.length.of.at.most(5);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -244,18 +244,19 @@ describe('iD.serviceOpenstreetcam', function() {
|
||||
]);
|
||||
});
|
||||
|
||||
it('limits results no more than 3 stacked images in one spot', function() {
|
||||
it('limits results no more than 5 stacked images in one spot', function() {
|
||||
var features = [
|
||||
{ minX: 10, minY: 0, maxX: 10, maxY: 0, data: { key: '0', loc: [10,0], ca: 90, sequence_id: '100', sequence_index: 0 } },
|
||||
{ minX: 10, minY: 0, maxX: 10, maxY: 0, data: { key: '1', loc: [10,0], ca: 90, sequence_id: '100', sequence_index: 1 } },
|
||||
{ minX: 10, minY: 0, maxX: 10, maxY: 0, data: { key: '2', loc: [10,0], ca: 90, sequence_id: '100', sequence_index: 2 } },
|
||||
{ minX: 10, minY: 0, maxX: 10, maxY: 0, data: { key: '3', loc: [10,0], ca: 90, sequence_id: '100', sequence_index: 3 } },
|
||||
{ minX: 10, minY: 0, maxX: 10, maxY: 0, data: { key: '4', loc: [10,0], ca: 90, sequence_id: '100', sequence_index: 4 } }
|
||||
{ minX: 10, minY: 0, maxX: 10, maxY: 0, data: { key: '4', loc: [10,0], ca: 90, sequence_id: '100', sequence_index: 4 } },
|
||||
{ minX: 10, minY: 0, maxX: 10, maxY: 0, data: { key: '5', loc: [10,0], ca: 90, sequence_id: '100', sequence_index: 5 } }
|
||||
];
|
||||
|
||||
openstreetcam.cache().images.rtree.load(features);
|
||||
var res = openstreetcam.images(context.projection);
|
||||
expect(res).to.have.length.of.at.most(3);
|
||||
expect(res).to.have.length.of.at.most(5);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -132,18 +132,19 @@ describe('iD.serviceStreetside', function() {
|
||||
]);
|
||||
});
|
||||
|
||||
it('limits results no more than 3 stacked bubbles in one spot', function() {
|
||||
it('limits results no more than 5 stacked bubbles in one spot', function() {
|
||||
var features = [
|
||||
{ minX: 10, minY: 0, maxX: 10, maxY: 0, data: { key: 1, loc: [10, 0], ca: 90, pr: undefined, ne: 2, pano: true, sequence_id: 1 } },
|
||||
{ minX: 10, minY: 0, maxX: 10, maxY: 0, data: { key: 2, loc: [10, 0], ca: 90, pr: 1, ne: 3, pano: true, sequence_id: 1 } },
|
||||
{ minX: 10, minY: 0, maxX: 10, maxY: 0, data: { key: 3, loc: [10, 0], ca: 90, pr: 2, ne: 4, pano: true, sequence_id: 1 } },
|
||||
{ minX: 10, minY: 0, maxX: 10, maxY: 0, data: { key: 4, loc: [10, 0], ca: 90, pr: 3, ne: 5, pano: true, sequence_id: 1 } },
|
||||
{ minX: 10, minY: 0, maxX: 10, maxY: 0, data: { key: 5, loc: [10, 0], ca: 90, pr: 4, ne: undefined, pano: true, sequence_id: 1 } }
|
||||
{ minX: 10, minY: 0, maxX: 10, maxY: 0, data: { key: 5, loc: [10, 0], ca: 90, pr: 4, ne: 6, pano: true, sequence_id: 1 } },
|
||||
{ minX: 10, minY: 0, maxX: 10, maxY: 0, data: { key: 6, loc: [10, 0], ca: 90, pr: 5, ne: undefined, pano: true, sequence_id: 1 } }
|
||||
];
|
||||
|
||||
streetside.cache().bubbles.rtree.load(features);
|
||||
var res = streetside.bubbles(context.projection);
|
||||
expect(res).to.have.length.of.at.most(3);
|
||||
expect(res).to.have.length.of.at.most(5);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
describe('d3.keybinding', function() {
|
||||
describe('utilKeybinding', function() {
|
||||
var keybinding, spy, input;
|
||||
|
||||
beforeEach(function () {
|
||||
keybinding = iD.lib.d3keybinding('keybinding-test');
|
||||
keybinding = iD.utilKeybinding('keybinding-test');
|
||||
spy = sinon.spy();
|
||||
input = d3.select('body')
|
||||
.append('input');
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
keybinding.off(d3.select(document));
|
||||
d3.select(document).call(keybinding.unbind);
|
||||
input.remove();
|
||||
});
|
||||
|
||||
@@ -86,13 +86,13 @@ describe('d3.keybinding', function() {
|
||||
expect(spy).to.have.been.calledOnce;
|
||||
});
|
||||
|
||||
it('resets bindings when keybinding.off is called', function () {
|
||||
it('resets bindings when keybinding.unbind is called', function () {
|
||||
d3.select(document).call(keybinding.on('A', spy));
|
||||
happen.keydown(document, {keyCode: 65});
|
||||
expect(spy).to.have.been.calledOnce;
|
||||
|
||||
spy = sinon.spy();
|
||||
d3.select(document).call(keybinding.off);
|
||||
d3.select(document).call(keybinding.unbind);
|
||||
d3.select(document).call(keybinding.on('A', spy));
|
||||
happen.keydown(document, {keyCode: 65});
|
||||
expect(spy).to.have.been.calledOnce;
|
||||
Reference in New Issue
Block a user