UI: scrollwheel, minimap

This commit is contained in:
marc tobias 2017-10-21 13:24:02 +02:00
parent fcf7fcee03
commit da4a2b7b6e
13 changed files with 31 additions and 19 deletions

View File

@ -13,8 +13,10 @@
<form class="form-inline" role="search" accept-charset="UTF-8" action="<?php echo CONST_Website_BaseURL; ?>reverse.php"> <form class="form-inline" role="search" accept-charset="UTF-8" action="<?php echo CONST_Website_BaseURL; ?>reverse.php">
<div class="form-group"> <div class="form-group">
<input name="format" type="hidden" value="html"> <input name="format" type="hidden" value="html">
lat
<input name="lat" type="text" class="form-control input-sm" placeholder="latitude" value="<?php echo $fLat; ?>" > <input name="lat" type="text" class="form-control input-sm" placeholder="latitude" value="<?php echo $fLat; ?>" >
<span id="switch-coords">&lt;&gt;</span> <span id="switch-coords" title="switch lat and lon">&lt;&gt;</span>
lon
<input name="lon" type="text" class="form-control input-sm" placeholder="longitude" value="<?php echo $fLon; ?>" > <input name="lon" type="text" class="form-control input-sm" placeholder="longitude" value="<?php echo $fLon; ?>" >
max zoom max zoom

View File

@ -10,4 +10,5 @@
<script src="js/jquery.min.js"></script> <script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script> <script src="js/bootstrap.min.js"></script>
<script src="js/leaflet.min.js"></script> <script src="js/leaflet.min.js"></script>
<script src="js/Control.Minimap.min.js"></script>
<script src="js/nominatim-ui.js"></script> <script src="js/nominatim-ui.js"></script>

View File

@ -8,5 +8,6 @@
<base href="<?php echo CONST_Website_BaseURL;?>" /> <base href="<?php echo CONST_Website_BaseURL;?>" />
<link href="nominatim.xml" rel="search" title="Nominatim Search" type="application/opensearchdescription+xml" /> <link href="nominatim.xml" rel="search" title="Nominatim Search" type="application/opensearchdescription+xml" />
<link href="css/leaflet.css" rel="stylesheet" /> <link href="css/leaflet.css" rel="stylesheet" />
<link href="css/Control.Minimap.min.css" rel="stylesheet" />
<link href="css/bootstrap-theme.min.css" rel="stylesheet" /> <link href="css/bootstrap-theme.min.css" rel="stylesheet" />
<link href="css/bootstrap.min.css" rel="stylesheet" /> <link href="css/bootstrap.min.css" rel="stylesheet" />

View File

@ -21,8 +21,8 @@
About &amp; Help <span class="caret"></span> About &amp; Help <span class="caret"></span>
</button> </button>
<ul class="dropdown-menu dropdown-menu-right"> <ul class="dropdown-menu dropdown-menu-right">
<li><a href="http://wiki.openstreetmap.org/wiki/Nominatim" target="_blank">Documentation</a></li> <li><a href="https://wiki.openstreetmap.org/wiki/Nominatim" target="_blank">Documentation</a></li>
<li><a href="http://wiki.openstreetmap.org/wiki/Nominatim/FAQ" target="_blank">FAQ</a></li> <li><a href="https://wiki.openstreetmap.org/wiki/Nominatim/FAQ" target="_blank">FAQ</a></li>
<li role="separator" class="divider"></li> <li role="separator" class="divider"></li>
<li><a href="#" class="" data-toggle="modal" data-target="#report-modal">Report problem with results</a></li> <li><a href="#" class="" data-toggle="modal" data-target="#report-modal">Report problem with results</a></li>
</ul> </ul>

View File

@ -1,9 +1,9 @@
<h2>Welcome to Nominatim</h2> <h2>Welcome to Nominatim</h2>
<p>Nominatim is a search engine for <a href="http://www.openstreetmap.org">OpenStreetMap</a> <p>Nominatim is a search engine for <a href="https://www.openstreetmap.org">OpenStreetMap</a>
data. This is the debugging interface. You may search for a name or address(forward search) or data. This is the debugging interface. You may search for a name or address(forward search) or
look up data by its geographic coordinate(reverse search). Each result comes with a look up data by its geographic coordinate(reverse search). Each result comes with a
link to a details page where you can inspect what data about the object is saved in link to a details page where you can inspect what data about the object is saved in
the database and investigate how the address of the object has been computed.</p> the database and investigate how the address of the object has been computed.</p>
For more information visit the <a href="http://wiki.openstreetmap.org/wiki/Nominatim">Nominatim wiki page</a>. For more information visit the <a href="https://wiki.openstreetmap.org/wiki/Nominatim">Nominatim wiki page</a>.

View File

@ -1,7 +1,7 @@
<p> <p>
Before reporting problems please read the <a target="_blank" href="http://wiki.openstreetmap.org/wiki/Nominatim">user documentation</a> Before reporting problems please read the <a target="_blank" href="https://wiki.openstreetmap.org/wiki/Nominatim">user documentation</a>
and and
<a target="_blank" href="http://wiki.openstreetmap.org/wiki/Nominatim/FAQ">FAQ</a>. <a target="_blank" href="https://wiki.openstreetmap.org/wiki/Nominatim/FAQ">FAQ</a>.
If your problem relates to the address of a particular search result please use the 'details' link If your problem relates to the address of a particular search result please use the 'details' link
to check how the address was generated before reporting a problem. to check how the address was generated before reporting a problem.

View File

@ -94,7 +94,7 @@ if (isset($_GET['debug']) && $_GET['debug']) @define('CONST_Debug', true);
@define('CONST_Default_Lat', 20.0); @define('CONST_Default_Lat', 20.0);
@define('CONST_Default_Lon', 0.0); @define('CONST_Default_Lon', 0.0);
@define('CONST_Default_Zoom', 2); @define('CONST_Default_Zoom', 2);
@define('CONST_Map_Tile_URL', 'http://{s}.tile.osm.org/{z}/{x}/{y}.png'); @define('CONST_Map_Tile_URL', 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png');
@define('CONST_Map_Tile_Attribution', ''); // Set if tile source isn't osm.org @define('CONST_Map_Tile_Attribution', ''); // Set if tile source isn't osm.org
@define('CONST_Search_AreaPolygons', true); @define('CONST_Search_AreaPolygons', true);

1
website/css/Control.Minimap.min.css vendored Normal file
View File

@ -0,0 +1 @@
.leaflet-control-minimap{border:rgba(255,255,255,1) solid;box-shadow:0 1px 5px rgba(0,0,0,.65);border-radius:3px;background:#f8f8f9;transition:all .6s}.leaflet-control-minimap a{background-color:rgba(255,255,255,1);background-repeat:no-repeat;z-index:99999;transition:all .6s}.leaflet-control-minimap a.minimized-bottomright{-webkit-transform:rotate(180deg);transform:rotate(180deg);border-radius:0}.leaflet-control-minimap a.minimized-topleft{-webkit-transform:rotate(0deg);transform:rotate(0deg);border-radius:0}.leaflet-control-minimap a.minimized-bottomleft{-webkit-transform:rotate(270deg);transform:rotate(270deg);border-radius:0}.leaflet-control-minimap a.minimized-topright{-webkit-transform:rotate(90deg);transform:rotate(90deg);border-radius:0}.leaflet-control-minimap-toggle-display{background-image:url(images/toggle.svg);background-size:cover;position:absolute;border-radius:3px 0 0}.leaflet-oldie .leaflet-control-minimap-toggle-display{background-image:url(images/toggle.png)}.leaflet-control-minimap-toggle-display-bottomright{bottom:0;right:0}.leaflet-control-minimap-toggle-display-topleft{top:0;left:0;-webkit-transform:rotate(180deg);transform:rotate(180deg)}.leaflet-control-minimap-toggle-display-bottomleft{bottom:0;left:0;-webkit-transform:rotate(90deg);transform:rotate(90deg)}.leaflet-control-minimap-toggle-display-topright{top:0;right:0;-webkit-transform:rotate(270deg);transform:rotate(270deg)}.leaflet-oldie .leaflet-control-minimap{border:1px solid #999}.leaflet-oldie .leaflet-control-minimap a{background-color:#fff}.leaflet-oldie .leaflet-control-minimap a.minimized{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2)}

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="18" width="18"><defs><marker orient="auto" overflow="visible"><path d="M-2.6-2.828L-5.428 0-2.6 2.828.228 0-2.6-2.828z" fill-rule="evenodd" stroke="#000" stroke-width=".4pt"/></marker><marker orient="auto" overflow="visible"><g fill="none" stroke="#000" stroke-width=".8" stroke-linecap="round"><path d="M4.566 4.75L-.652 0"/><path d="M1.544 4.75L-3.674 0"/><path d="M-1.566 4.75L-6.784 0"/><path d="M4.566-5.013L-.652-.263"/><path d="M1.544-5.013l-5.218 4.75"/><path d="M-1.566-5.013l-5.218 4.75"/></g></marker><marker orient="auto" overflow="visible"><path d="M-5.6-5.657L-11.257 0-5.6 5.657.057 0-5.6-5.657z" fill-rule="evenodd" stroke="#000" stroke-width=".8pt"/></marker><marker orient="auto" overflow="visible"><path d="M4.616 0l-6.92 4v-8l6.92 4z" fill-rule="evenodd" stroke="#000" stroke-width=".8pt"/></marker><marker orient="auto" overflow="visible"><path d="M-10.69-4.437L1.328-.017l-12.018 4.42c1.92-2.61 1.91-6.18 0-8.84z" font-size="12" fill-rule="evenodd" stroke-width=".6875" stroke-linejoin="round"/></marker><marker orient="auto" overflow="visible"><path d="M-4.616 0l6.92-4v8l-6.92-4z" fill-rule="evenodd" stroke="#000" stroke-width=".8pt"/></marker><marker orient="auto" overflow="visible"><path d="M10 0l4-4L0 0l14 4-4-4z" fill-rule="evenodd" stroke="#000" stroke-width=".8pt"/></marker><marker orient="auto" overflow="visible"><path d="M10.69 4.437L-1.328.017l12.018-4.42c-1.92 2.61-1.91 6.18 0 8.84z" font-size="12" fill-rule="evenodd" stroke-width=".6875" stroke-linejoin="round"/></marker></defs><path d="M13.18 13.146v-5.81l-5.81 5.81h5.81z" stroke="#000" stroke-width="1.643"/><path d="M12.762 12.727l-6.51-6.51" fill="none" stroke="#000" stroke-width="2.482" stroke-linecap="round"/></svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -8,9 +8,9 @@ form #q {
min-width: 500px; min-width: 500px;
} }
@media (max-width: 850px) { @media (max-width: 850px) {
form #q { form #q {
min-width: 400px; min-width: 400px;
} }
} }
form .checkbox-inline { form .checkbox-inline {
margin-left: 10px; margin-left: 10px;
@ -43,7 +43,7 @@ form label {
#map-wrapper { #map-wrapper {
position: relative; position: relative;
min-height: 700px; min-height: 500px;
width: 75%; width: 75%;
padding-right: 20px; padding-right: 20px;
display: inline-block; display: inline-block;
@ -51,8 +51,8 @@ form label {
} }
#map { #map {
height: 100%; height: 90%;
min-height: 700px; min-height: 500px;
background:#eee; background:#eee;
} }

1
website/js/Control.Minimap.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -27,7 +27,7 @@ jQuery(document).on('ready', function(){
map = new L.map('map', { map = new L.map('map', {
attributionControl: (nominatim_map_init.tile_attribution && nominatim_map_init.tile_attribution.length), attributionControl: (nominatim_map_init.tile_attribution && nominatim_map_init.tile_attribution.length),
scrollWheelZoom: !L.Browser.touch, scrollWheelZoom: true, // !L.Browser.touch,
touchZoom: false touchZoom: false
}); });
@ -39,6 +39,9 @@ jQuery(document).on('ready', function(){
map.setView([nominatim_map_init.lat, nominatim_map_init.lon], nominatim_map_init.zoom); map.setView([nominatim_map_init.lat, nominatim_map_init.lon], nominatim_map_init.zoom);
var osm2 = new L.TileLayer(nominatim_map_init.tile_url, {minZoom: 0, maxZoom: 13, attribution: (nominatim_map_init.tile_attribution || null )});
var miniMap = new L.Control.MiniMap(osm2, {toggleDisplay: true}).addTo(map);
if ( is_reverse_search ){ if ( is_reverse_search ){
// We don't need a marker, but an L.circle instance changes radius once you zoom in/out // We don't need a marker, but an L.circle instance changes radius once you zoom in/out
var cm = L.circleMarker([nominatim_map_init.lat,nominatim_map_init.lon], { radius: 5, weight: 2, fillColor: '#ff7800', color: 'red', opacity: 0.75, clickable: false}); var cm = L.circleMarker([nominatim_map_init.lat,nominatim_map_init.lon], { radius: 5, weight: 2, fillColor: '#ff7800', color: 'red', opacity: 0.75, clickable: false});
@ -90,9 +93,9 @@ jQuery(document).on('ready', function(){
$('#map-position-inner').html([html_center,html_zoom,html_viewbox,html_click,html_mouse].join('<br/>')); $('#map-position-inner').html([html_center,html_zoom,html_viewbox,html_click,html_mouse].join('<br/>'));
var reverse_params = { var reverse_params = {
lat: map.getCenter().lat.toFixed(5), // lat: map.getCenter().lat.toFixed(5),
lon: map.getCenter().lng.toFixed(5), // lon: map.getCenter().lng.toFixed(5),
zoom: map.getZoom(), // zoom: 2,
format: 'html' format: 'html'
} }
$('#switch-to-reverse').attr('href', 'reverse.php?' + $.param(reverse_params)); $('#switch-to-reverse').attr('href', 'reverse.php?' + $.param(reverse_params));
@ -258,7 +261,7 @@ jQuery(document).on('ready', function(){
// center: [nominatim_map_init.lat, nominatim_map_init.lon], // center: [nominatim_map_init.lat, nominatim_map_init.lon],
// zoom: nominatim_map_init.zoom, // zoom: nominatim_map_init.zoom,
attributionControl: (nominatim_map_init.tile_attribution && nominatim_map_init.tile_attribution.length), attributionControl: (nominatim_map_init.tile_attribution && nominatim_map_init.tile_attribution.length),
scrollWheelZoom: false, scrollWheelZoom: true, // !L.Browser.touch,
touchZoom: false, touchZoom: false,
}); });
@ -268,6 +271,8 @@ jQuery(document).on('ready', function(){
attribution: (nominatim_map_init.tile_attribution || null ) //'&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors' attribution: (nominatim_map_init.tile_attribution || null ) //'&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map); }).addTo(map);
var osm2 = new L.TileLayer(nominatim_map_init.tile_url, {minZoom: 0, maxZoom: 13, attribution: (nominatim_map_init.tile_attribution || null )});
var miniMap = new L.Control.MiniMap(osm2, {toggleDisplay: true}).addTo(map);
var layerGroup = new L.layerGroup().addTo(map); var layerGroup = new L.layerGroup().addTo(map);