Compare commits

..
Author SHA1 Message Date
bence 430b32d0c6 Merge pull request 'do not exclude indoor panoramas' (#37) from feature/pano-could-be-indoor into develop
default-pipeline default-pipeline #179
Reviewed-on: https://gitea.e5tv.hu/esoko/mapguesser/pulls/37
2021-05-02 18:44:40 +02:00
bence 11eee64895 do not exclude indoor panoramas
default-pipeline default-pipeline #166
2021-05-02 18:38:29 +02:00
balazs cc24f96395 Merge pull request 'radius calculation for new panorama search based on latitude and mercator projection for google maps' (#36) from feature/more-accurate-new-selection-in-mapeditor-on-google-maps into develop
default-pipeline default-pipeline #165
Reviewed-on: https://gitea.e5tv.hu/esoko/mapguesser/pulls/36
Reviewed-by: Pőcze Bence <bence@pocze.ch>
2021-05-02 18:02:28 +02:00
balazs c3e5a6db1c radius calculation for new panorama search based on latitude and mercator projection for google maps
default-pipeline default-pipeline #164
2021-05-02 16:57:47 +02:00
bence 398204c5d5 Merge pull request 'feature/place-streetview-cover-to-the-map' (#35) from feature/place-streetview-cover-to-the-map into develop
default-pipeline default-pipeline #162
Reviewed-on: https://gitea.e5tv.hu/esoko/mapguesser/pulls/35
2021-05-02 16:27:41 +02:00
bence aaa5a1daba Merge pull request 'bugfix/streetviewcontrol-is-still-visible' (#34) from bugfix/streetviewcontrol-is-still-visible into develop
default-pipeline default-pipeline #161
Reviewed-on: https://gitea.e5tv.hu/esoko/mapguesser/pulls/34
2021-05-02 16:27:34 +02:00
bence c112a25409 move street view cover button to the map as circleControl
default-pipeline default-pipeline #160
2021-05-02 15:04:14 +02:00
bence 35cab17c21 make circle control items more general 2021-05-02 15:04:14 +02:00
bence f9c1829a00 enable zoomControl for Leaflet map to be consistent with Google map
default-pipeline default-pipeline #157
2021-05-02 13:45:34 +02:00
bence e03850ce05 switch off streetViewControl explicitly 2021-05-02 13:42:46 +02:00
7 changed files with 99 additions and 75 deletions

No files matched your search

-42
View File
@@ -150,39 +150,9 @@
} }
#navigation { #navigation {
position: absolute;
z-index: 2; z-index: 2;
} }
#navigation .navigationItem {
margin-top: 10px;
opacity: 70%;
cursor: pointer;
}
#navigation .navigationItem:hover {
opacity: 100%;
}
#navigation .navigationItem div {
position: absolute;
}
#navigation .circleBackground {
width: 100%;
height: 100%;
opacity: 50%;
}
#navigation .navigationIcon {
width: 75%;
height: 75%;
margin: auto;
margin-top: 50%;
transform: translateY(-50%);
-ms-transform: translateY(-50%);
}
@media screen and (max-width: 599px) { @media screen and (max-width: 599px) {
#mapName { #mapName {
display: none; display: none;
@@ -209,10 +179,6 @@
#navigation { #navigation {
bottom: 25px; bottom: 25px;
left: 10px; left: 10px;
width: 45px;
}
#navigation .navigationItem {
height: 45px;
} }
} }
@@ -260,10 +226,6 @@
#navigation { #navigation {
bottom: 50px; bottom: 50px;
left: 20px; left: 20px;
width: 60px;
}
#navigation .navigationItem {
height: 60px;
} }
@media screen and (max-height: 424px) { @media screen and (max-height: 424px) {
#guess { #guess {
@@ -282,10 +244,6 @@
#navigation { #navigation {
bottom: 30px; bottom: 30px;
left: 10px; left: 10px;
width: 45px;
}
#navigation .navigationItem {
height: 45px;
} }
} }
} }
+6
View File
@@ -55,6 +55,12 @@
visibility: hidden; visibility: hidden;
} }
#overlayControl {
bottom: 20px;
right: 10px;
z-index: 3;
}
#deleteButton { #deleteButton {
display: none; display: none;
} }
+49
View File
@@ -443,6 +443,43 @@ div.box {
box-sizing: border-box; box-sizing: border-box;
} }
.circleControl {
position: absolute;
width: 60px;
bottom: 20px;
right: 10px;
}
.circleControl .controlItem {
height: 60px;
margin-top: 10px;
opacity: 70%;
cursor: pointer;
}
.circleControl .controlItem:hover {
opacity: 100%;
}
.circleControl .controlItem div {
position: absolute;
}
.circleControl .controlBackground {
width: 100%;
height: 100%;
opacity: 50%;
}
.circleControl .controlIcon {
width: 75%;
height: 75%;
margin: auto;
margin-top: 50%;
transform: translateY(-50%);
-ms-transform: translateY(-50%);
}
@media screen and (max-width: 599px) { @media screen and (max-width: 599px) {
header h1 span { header h1 span {
display: none; display: none;
@@ -469,6 +506,12 @@ div.box {
div.box { div.box {
width: initial; width: initial;
} }
.circleControl {
width: 45px;
}
.circleControl .controlItem {
height: 45px;
}
} }
@media screen and (min-width: 600px) { @media screen and (min-width: 600px) {
@@ -498,6 +541,12 @@ div.box {
padding-top: 10px; padding-top: 10px;
padding-bottom: 10px; padding-bottom: 10px;
} }
.circleControl {
width: 45px;
}
.circleControl .controlItem {
height: 45px;
}
} }
@media screen and (min-height: 400px) and (max-height: 499px) { @media screen and (min-height: 400px) and (max-height: 499px) {
+25 -13
View File
@@ -80,22 +80,16 @@
MapEditor.panorama.setPano(panoLocationData.pano); MapEditor.panorama.setPano(panoLocationData.pano);
}, },
requestPanoData: function (location, canBeIndoor) { requestPanoData: function (location) {
var sv = new google.maps.StreetViewService(); var sv = new google.maps.StreetViewService();
sv.getPanorama({ sv.getPanorama({
location: location, location: location,
preference: google.maps.StreetViewPreference.NEAREST, preference: google.maps.StreetViewPreference.NEAREST,
radius: 100, radius: MapEditor.map.getSearchRadius(location),
source: canBeIndoor ? google.maps.StreetViewSource.DEFAULT : google.maps.StreetViewSource.OUTDOOR
}, function (data, status) { }, function (data, status) {
var panoLocationData = status === google.maps.StreetViewStatus.OK ? data.location : null; var panoLocationData = status === google.maps.StreetViewStatus.OK ? data.location : null;
if (panoLocationData === null && !canBeIndoor) {
MapEditor.requestPanoData(location, true);
return;
}
document.getElementById('loading').style.visibility = 'hidden'; document.getElementById('loading').style.visibility = 'hidden';
MapEditor.loadPanoForNewPlace(panoLocationData); MapEditor.loadPanoForNewPlace(panoLocationData);
@@ -377,8 +371,7 @@
LMapWrapper.divId = divId; LMapWrapper.divId = divId;
LMapWrapper.map = L.map(LMapWrapper.divId, { LMapWrapper.map = L.map(LMapWrapper.divId, {
center: { lat: 0., lng: 0. }, center: { lat: 0., lng: 0. },
zoom: 2, zoom: 2
zoomControl: false
}); });
LMapWrapper.map.on('click', function (e) { LMapWrapper.map.on('click', function (e) {
@@ -404,7 +397,7 @@
LMapWrapper.loadMarkers(places); LMapWrapper.loadMarkers(places);
document.getElementById('streetViewCoverSelector').disabled = true; document.getElementById('streetViewCoverSelector').style.display = 'none';
}, },
hide: function () { hide: function () {
@@ -474,7 +467,11 @@
LMapWrapper.markers.removeLayer(marker); LMapWrapper.markers.removeLayer(marker);
}, },
toggleStreetViewCover: function () { } toggleStreetViewCover: function () { },
getSearchRadius: function (location) {
return 100;
}
}; };
var GMapWrapper = { var GMapWrapper = {
@@ -517,6 +514,7 @@
zoomControlOptions: { zoomControlOptions: {
position: google.maps.ControlPosition.LEFT_BOTTOM position: google.maps.ControlPosition.LEFT_BOTTOM
}, },
streetViewControl: false,
draggableCursor: 'crosshair' draggableCursor: 'crosshair'
}); });
@@ -536,7 +534,7 @@
GMapWrapper.loadMarkers(places); GMapWrapper.loadMarkers(places);
document.getElementById('streetViewCoverSelector').disabled = false; document.getElementById('streetViewCoverSelector').style.display = 'block'
}, },
hide: function () { hide: function () {
@@ -626,6 +624,20 @@
GMapWrapper.streetViewCover.setMap(GMapWrapper.map); GMapWrapper.streetViewCover.setMap(GMapWrapper.map);
GMapWrapper.streetViewCoverOn = true; GMapWrapper.streetViewCoverOn = true;
} }
},
getSearchRadius: function (location) {
// source: https://www.yorku.ca/mack/CHI01.htm
var movementOffset = 4;
// source: https://groups.google.com/g/google-maps-js-api-v3/c/hDRO4oHVSeM/m/osOYQYXg2oUJ?pli=1
var metersPerPixel = 156543.03392 * Math.cos(location.lat * Math.PI / 180) / Math.pow(2, GMapWrapper.map.getZoom());
var minSearchRadius = 5;
var searchRadius = Math.max(minSearchRadius, Math.round(movementOffset * metersPerPixel));
return searchRadius;
} }
}; };
+2 -8
View File
@@ -140,7 +140,7 @@ class Place extends Model
return $this->pov->getZoom(); return $this->pov->getZoom();
} }
public function getFreshPanoId(bool $canBeIndoor = false): ?string public function getFreshPanoId(): ?string
{ {
if ( if (
$this->panoIdCachedTimestamp !== null && $this->panoIdCachedTimestamp !== null &&
@@ -152,19 +152,13 @@ class Place extends Model
$request = new Request('https://maps.googleapis.com/maps/api/streetview/metadata', Request::HTTP_GET); $request = new Request('https://maps.googleapis.com/maps/api/streetview/metadata', Request::HTTP_GET);
$request->setQuery([ $request->setQuery([
'key' => $_ENV['GOOGLE_MAPS_SERVER_API_KEY'], 'key' => $_ENV['GOOGLE_MAPS_SERVER_API_KEY'],
'location' => $this->position->getLat() . ',' . $this->position->getLng(), 'location' => $this->position->getLat() . ',' . $this->position->getLng()
'source' => $canBeIndoor ? 'default' : 'outdoor'
]); ]);
$response = $request->send(); $response = $request->send();
$panoData = json_decode($response->getBody(), true); $panoData = json_decode($response->getBody(), true);
$panoId = $panoData['status'] === 'OK' ? $panoData['pano_id'] : null; $panoId = $panoData['status'] === 'OK' ? $panoData['pano_id'] : null;
// enable indoor panos if no outdoor found
if ($panoId === null && !$canBeIndoor) {
return $this->getFreshPanoId(true);
}
$this->panoIdCached = $panoId; $this->panoIdCached = $panoId;
$this->panoIdCachedTimestamp = new DateTime(); $this->panoIdCachedTimestamp = new DateTime();
+10 -5
View File
@@ -18,11 +18,6 @@
<img src="<?= $_ENV['STATIC_ROOT'] ?>/img/map.svg?rev=<?= REVISION ?>" alt="Map Selector" /> <img src="<?= $_ENV['STATIC_ROOT'] ?>/img/map.svg?rev=<?= REVISION ?>" alt="Map Selector" />
</button> </button>
</span><!-- </span><!--
--><span class="inline hideOnMobile" id="mapSelection">
<button id="streetViewCoverSelector">
<img src="<?= $_ENV['STATIC_ROOT'] ?>/img/street-view-cover.svg?rev=<?= REVISION ?>" alt="Street View Conver" />
</button>
</span><!--
--><span class="inline hideOnMobile"> --><span class="inline hideOnMobile">
<input type="text" id="jumpCoordinates" placeholder="Insert coordinates here" /> <input type="text" id="jumpCoordinates" placeholder="Insert coordinates here" />
<button id="jumpButton" disabled >Jump</button> <button id="jumpButton" disabled >Jump</button>
@@ -71,6 +66,16 @@
<div id="map" class="map"> <div id="map" class="map">
<div id="lmap" class="map"></div> <div id="lmap" class="map"></div>
<div id="gmap" class="map"></div> <div id="gmap" class="map"></div>
<div id="overlayControl" class="circleControl">
<div id="streetViewCoverSelector" class="controlItem" title="Toggle Street View Cover">
<div>
<img src="<?= $_ENV['STATIC_ROOT'] ?>/img/circle_background.svg?rev=<?= REVISION ?>" alt="Circle Background" class="controlBackground" />
</div>
<div>
<img src="<?= $_ENV['STATIC_ROOT'] ?>/img/street-view-cover.svg?rev=<?= REVISION ?>" alt="Street View Cover" class="controlIcon" />
</div>
</div>
</div>
</div> </div>
<div id="panorama"></div> <div id="panorama"></div>
<div id="noPano"> <div id="noPano">
+7 -7
View File
@@ -59,21 +59,21 @@
<button id="startNewGameButton" class="fullWidth">Play this map again</button> <button id="startNewGameButton" class="fullWidth">Play this map again</button>
</div> </div>
</div> </div>
<div id="navigation"> <div id="navigation" class="circleControl">
<div id="compassContainer" class="navigationItem"> <div id="compassContainer" class="controlItem">
<div> <div>
<img src="<?= $_ENV['STATIC_ROOT'] ?>/img/circle_background.svg?rev=<?= REVISION ?>" alt="Circle Background" class="circleBackground" /> <img src="<?= $_ENV['STATIC_ROOT'] ?>/img/circle_background.svg?rev=<?= REVISION ?>" alt="Circle Background" class="controlBackground" />
</div> </div>
<div> <div>
<img id="compass" src="<?= $_ENV['STATIC_ROOT'] ?>/img/compass.svg?rev=<?= REVISION ?>" alt="compass icon" class="navigationIcon" /> <img id="compass" src="<?= $_ENV['STATIC_ROOT'] ?>/img/compass.svg?rev=<?= REVISION ?>" alt="compass icon" class="controlIcon" />
</div> </div>
</div> </div>
<div id="returnToStart" class="navigationItem"> <div id="returnToStart" class="controlItem">
<div> <div>
<img src="<?= $_ENV['STATIC_ROOT'] ?>/img/circle_background.svg?rev=<?= REVISION ?>" alt="Circle Background" class="circleBackground" /> <img src="<?= $_ENV['STATIC_ROOT'] ?>/img/circle_background.svg?rev=<?= REVISION ?>" alt="Circle Background" class="controlBackground" />
</div> </div>
<div> <div>
<img src="<?= $_ENV['STATIC_ROOT'] ?>/img/house-fill.svg?rev=<?= REVISION ?>" alt="Return to Start icon" class="navigationIcon" /> <img src="<?= $_ENV['STATIC_ROOT'] ?>/img/house-fill.svg?rev=<?= REVISION ?>" alt="Return to Start icon" class="controlIcon" />
</div> </div>
</div> </div>
</div> </div>