Compare commits
12
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8218883faf | ||
|
|
145cb5f637 | ||
|
|
6d3f74f911 | ||
|
|
b22f13887f | ||
|
|
2a3f2212a7 | ||
|
|
98df08e5fa | ||
|
|
d42280eb10 | ||
|
|
0739c65961 | ||
|
|
ea599809b8 | ||
|
|
08c38c6374 | ||
|
|
854775011c | ||
|
|
e33d8c02e9 |
No files matched your search
@@ -0,0 +1,5 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
|
||||||
|
<polygon id="needleNorth" points="50,0 33,50 66,50" style="fill:red;stroke:black;stroke-width:1" />
|
||||||
|
<polygon id="needleSouth" points="50,100 33,50 66,50" style="fill:white;stroke:black;stroke-width:1" />
|
||||||
|
Sorry, your browser does not support inline SVG.
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 328 B |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -387,6 +387,10 @@
|
|||||||
document.getElementById('currentRound').innerHTML = String(Game.rounds.length) + '/' + String(Game.NUMBER_OF_ROUNDS);
|
document.getElementById('currentRound').innerHTML = String(Game.rounds.length) + '/' + String(Game.NUMBER_OF_ROUNDS);
|
||||||
|
|
||||||
Game.loadPano(Game.panoId, Game.pov);
|
Game.loadPano(Game.panoId, Game.pov);
|
||||||
|
|
||||||
|
// update the compass
|
||||||
|
const heading = Game.panorama.getPov().heading;
|
||||||
|
document.getElementById("compass").style.transform = "translateY(-50%) rotate(" + heading + "deg)";
|
||||||
},
|
},
|
||||||
|
|
||||||
handleErrorResponse: function (error) {
|
handleErrorResponse: function (error) {
|
||||||
@@ -863,6 +867,9 @@
|
|||||||
|
|
||||||
Game.panorama.addListener('pov_changed', function () {
|
Game.panorama.addListener('pov_changed', function () {
|
||||||
Game.rewriteGoogleLink();
|
Game.rewriteGoogleLink();
|
||||||
|
|
||||||
|
const heading = Game.panorama.getPov().heading;
|
||||||
|
document.getElementById("compass").style.transform = "translateY(-50%) rotate(" + heading + "deg)";
|
||||||
});
|
});
|
||||||
|
|
||||||
if (COOKIES_CONSENT) {
|
if (COOKIES_CONSENT) {
|
||||||
@@ -950,4 +957,8 @@
|
|||||||
document.getElementById('returnToStart').onclick = function () {
|
document.getElementById('returnToStart').onclick = function () {
|
||||||
Game.loadPano(Game.panoId, Game.pov);
|
Game.loadPano(Game.panoId, Game.pov);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
document.getElementById('compassContainer').onclick = function () {
|
||||||
|
Game.panorama.setPov({ heading: 0, pitch: Game.panorama.getPov().pitch });
|
||||||
|
}
|
||||||
})();
|
})();
|
||||||
+78
-232
@@ -7,6 +7,7 @@
|
|||||||
description: null
|
description: null
|
||||||
},
|
},
|
||||||
map: null,
|
map: null,
|
||||||
|
markers: null,
|
||||||
panorama: null,
|
panorama: null,
|
||||||
selectedMarker: null,
|
selectedMarker: null,
|
||||||
added: {},
|
added: {},
|
||||||
@@ -123,7 +124,10 @@
|
|||||||
MapEditor.panorama.setVisible(false);
|
MapEditor.panorama.setVisible(false);
|
||||||
|
|
||||||
if (marker.placeId) {
|
if (marker.placeId) {
|
||||||
MapEditor.map.changeMarkerIcon(marker, MapEditor.map.iconCollection.iconBlue);
|
MapEditor.markers.removeLayer(MapEditor.selectedMarker);
|
||||||
|
MapEditor.map.addLayer(MapEditor.selectedMarker);
|
||||||
|
marker.setIcon(IconCollection.iconBlue);
|
||||||
|
marker.setZIndexOffset(2000);
|
||||||
|
|
||||||
document.getElementById('deleteButton').style.display = 'block';
|
document.getElementById('deleteButton').style.display = 'block';
|
||||||
|
|
||||||
@@ -161,13 +165,13 @@
|
|||||||
var placeId = MapEditor.selectedMarker.placeId
|
var placeId = MapEditor.selectedMarker.placeId
|
||||||
|
|
||||||
if (places[placeId].id && !del) {
|
if (places[placeId].id && !del) {
|
||||||
MapEditor.map.changeMarkerIcon(
|
MapEditor.map.removeLayer(MapEditor.selectedMarker);
|
||||||
MapEditor.selectedMarker,
|
MapEditor.markers.addLayer(MapEditor.selectedMarker);
|
||||||
places[placeId].noPano ? MapEditor.map.iconCollection.iconRed : MapEditor.map.iconCollection.iconGreen
|
MapEditor.selectedMarker.setIcon(places[placeId].noPano ? IconCollection.iconRed : IconCollection.iconGreen);
|
||||||
);
|
MapEditor.selectedMarker.setZIndexOffset(1000);
|
||||||
} else {
|
} else {
|
||||||
delete places[placeId];
|
delete places[placeId];
|
||||||
MapEditor.map.removeMarker(MapEditor.selectedMarker);
|
MapEditor.map.removeLayer(MapEditor.selectedMarker);
|
||||||
}
|
}
|
||||||
|
|
||||||
document.getElementById('deleteButton').style.display = 'none';
|
document.getElementById('deleteButton').style.display = 'none';
|
||||||
@@ -306,9 +310,42 @@
|
|||||||
var placeId = addedPlaces[i].id;
|
var placeId = addedPlaces[i].id;
|
||||||
places[tempId].id = placeId;
|
places[tempId].id = placeId;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// TODO: check whether marker is already existing on the map for the coordinates
|
||||||
|
// or alternatively block saving for matching coordinates
|
||||||
|
placeMarker: function (latlng) {
|
||||||
|
var marker = L.marker(latlng, {
|
||||||
|
icon: IconCollection.iconBlue,
|
||||||
|
zIndexOffset: 2000
|
||||||
|
})
|
||||||
|
.addTo(MapEditor.map)
|
||||||
|
.on('click', function () {
|
||||||
|
MapEditor.select(this);
|
||||||
|
});
|
||||||
|
|
||||||
|
MapEditor.select(marker);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var IconCollection = {
|
||||||
|
iconGreen: L.icon({
|
||||||
|
iconUrl: STATIC_ROOT + '/img/markers/marker-green.svg?rev' + REVISION,
|
||||||
|
iconSize: [24, 32],
|
||||||
|
iconAnchor: [12, 32]
|
||||||
|
}),
|
||||||
|
iconRed: L.icon({
|
||||||
|
iconUrl: STATIC_ROOT + '/img/markers/marker-red.svg?rev=' + REVISION,
|
||||||
|
iconSize: [24, 32],
|
||||||
|
iconAnchor: [12, 32]
|
||||||
|
}),
|
||||||
|
iconBlue: L.icon({
|
||||||
|
iconUrl: STATIC_ROOT + '/img/markers/marker-blue.svg?rev=' + REVISION,
|
||||||
|
iconSize: [24, 32],
|
||||||
|
iconAnchor: [12, 32]
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
|
||||||
var Util = {
|
var Util = {
|
||||||
getHighResData: function () {
|
getHighResData: function () {
|
||||||
if (window.devicePixelRatio >= 4) {
|
if (window.devicePixelRatio >= 4) {
|
||||||
@@ -347,243 +384,52 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var LMapWrapper = {
|
MapEditor.map = L.map('map', {
|
||||||
map: null,
|
zoomControl: false
|
||||||
markers: null,
|
});
|
||||||
iconCollection: {
|
|
||||||
iconGreen: L.icon({
|
|
||||||
iconUrl: STATIC_ROOT + '/img/markers/marker-green.svg?rev' + REVISION,
|
|
||||||
iconSize: [24, 32],
|
|
||||||
iconAnchor: [12, 32]
|
|
||||||
}),
|
|
||||||
iconRed: L.icon({
|
|
||||||
iconUrl: STATIC_ROOT + '/img/markers/marker-red.svg?rev=' + REVISION,
|
|
||||||
iconSize: [24, 32],
|
|
||||||
iconAnchor: [12, 32]
|
|
||||||
}),
|
|
||||||
iconBlue: L.icon({
|
|
||||||
iconUrl: STATIC_ROOT + '/img/markers/marker-blue.svg?rev=' + REVISION,
|
|
||||||
iconSize: [24, 32],
|
|
||||||
iconAnchor: [12, 32]
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
init: function (divId, places) {
|
MapEditor.map.on('click', function (e) {
|
||||||
LMapWrapper.map = L.map('map', {
|
MapEditor.placeMarker(e.latlng);
|
||||||
zoomControl: false
|
});
|
||||||
});
|
|
||||||
|
|
||||||
LMapWrapper.map.on('click', function (e) {
|
var highResData = Util.getHighResData();
|
||||||
LMapWrapper.placeMarker(e.latlng);
|
|
||||||
});
|
|
||||||
|
|
||||||
var highResData = Util.getHighResData();
|
L.tileLayer(tileUrl, {
|
||||||
|
attribution: tileAttribution,
|
||||||
|
subdomains: '1234',
|
||||||
|
ppi: highResData.ppi,
|
||||||
|
tileSize: highResData.tileSize,
|
||||||
|
zoomOffset: highResData.zoomOffset,
|
||||||
|
minZoom: highResData.minZoom,
|
||||||
|
maxZoom: highResData.maxZoom
|
||||||
|
}).addTo(MapEditor.map);
|
||||||
|
|
||||||
L.tileLayer(tileUrl, {
|
MapEditor.map.fitBounds(L.latLngBounds({ lat: mapBounds.south, lng: mapBounds.west }, { lat: mapBounds.north, lng: mapBounds.east }));
|
||||||
attribution: tileAttribution,
|
|
||||||
subdomains: '1234',
|
|
||||||
ppi: highResData.ppi,
|
|
||||||
tileSize: highResData.tileSize,
|
|
||||||
zoomOffset: highResData.zoomOffset,
|
|
||||||
minZoom: highResData.minZoom,
|
|
||||||
maxZoom: highResData.maxZoom
|
|
||||||
}).addTo(LMapWrapper.map);
|
|
||||||
|
|
||||||
LMapWrapper.map.fitBounds(L.latLngBounds({ lat: mapBounds.south, lng: mapBounds.west }, { lat: mapBounds.north, lng: mapBounds.east }));
|
MapEditor.markers = L.markerClusterGroup({
|
||||||
|
maxClusterRadius: 50
|
||||||
|
});
|
||||||
|
|
||||||
LMapWrapper.loadMarkers(places);
|
for (var placeId in places) {
|
||||||
},
|
if (!places.hasOwnProperty(placeId)) {
|
||||||
|
continue;
|
||||||
loadMarkers: function (places) {
|
|
||||||
|
|
||||||
LMapWrapper.markers = L.markerClusterGroup({
|
|
||||||
maxClusterRadius: 50
|
|
||||||
});
|
|
||||||
|
|
||||||
for (var placeId in places) {
|
|
||||||
if (!places.hasOwnProperty(placeId)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
var place = places[placeId];
|
|
||||||
|
|
||||||
var marker = L.marker({ lat: place.lat, lng: place.lng }, {
|
|
||||||
icon: place.noPano ? LMapWrapper.iconCollection.iconRed : LMapWrapper.iconCollection.iconGreen,
|
|
||||||
zIndexOffset: 1000
|
|
||||||
})
|
|
||||||
.addTo(LMapWrapper.markers)
|
|
||||||
.on('click', function () {
|
|
||||||
MapEditor.select(this);
|
|
||||||
});
|
|
||||||
|
|
||||||
marker.placeId = place.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
LMapWrapper.map.addLayer(LMapWrapper.markers);
|
|
||||||
},
|
|
||||||
|
|
||||||
// TODO: check whether marker is already existing on the map for the coordinates
|
|
||||||
// or alternatively block saving for matching coordinates
|
|
||||||
placeMarker: function (latLng) {
|
|
||||||
var marker = L.marker(latLng, {
|
|
||||||
icon: LMapWrapper.iconCollection.iconBlue,
|
|
||||||
zIndexOffset: 2000
|
|
||||||
})
|
|
||||||
.addTo(LMapWrapper.map)
|
|
||||||
.on('click', function () {
|
|
||||||
MapEditor.select(this);
|
|
||||||
});
|
|
||||||
|
|
||||||
MapEditor.select(marker);
|
|
||||||
},
|
|
||||||
|
|
||||||
panTo: function (latLng) {
|
|
||||||
LMapWrapper.map.panTo(latLng);
|
|
||||||
},
|
|
||||||
|
|
||||||
invalidateSize: function (invalid) {
|
|
||||||
LMapWrapper.map.invalidateSize(invalid);
|
|
||||||
},
|
|
||||||
|
|
||||||
changeMarkerIcon: function (marker, icon) {
|
|
||||||
LMapWrapper.markers.removeLayer(marker);
|
|
||||||
LMapWrapper.map.addLayer(marker);
|
|
||||||
marker.setIcon(icon);
|
|
||||||
marker.setZIndexOffset(2000);
|
|
||||||
},
|
|
||||||
|
|
||||||
removeMarker: function (marker) {
|
|
||||||
LMapWrapper.map.removeLayer(marker);
|
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
var GMapWrapper = {
|
var place = places[placeId];
|
||||||
map: null,
|
|
||||||
markers: null,
|
|
||||||
iconCollection: {
|
|
||||||
iconGreen: {
|
|
||||||
url: STATIC_ROOT + '/img/markers/marker-green.svg?rev' + REVISION,
|
|
||||||
scaledSize: new google.maps.Size(24, 32), // scaled size
|
|
||||||
origin: new google.maps.Point(0, 0), // origin
|
|
||||||
anchor: new google.maps.Point(12, 32) // anchor
|
|
||||||
},
|
|
||||||
iconRed: {
|
|
||||||
url: STATIC_ROOT + '/img/markers/marker-red.svg?rev' + REVISION,
|
|
||||||
scaledSize: new google.maps.Size(24, 32), // scaled size
|
|
||||||
origin: new google.maps.Point(0, 0), // origin
|
|
||||||
anchor: new google.maps.Point(12, 32) // anchor
|
|
||||||
},
|
|
||||||
iconBlue: {
|
|
||||||
url: STATIC_ROOT + '/img/markers/marker-blue.svg?rev' + REVISION,
|
|
||||||
scaledSize: new google.maps.Size(24, 32), // scaled size
|
|
||||||
origin: new google.maps.Point(0, 0), // origin
|
|
||||||
anchor: new google.maps.Point(12, 32) // anchor
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
init: function (divId, places) {
|
var marker = L.marker({ lat: place.lat, lng: place.lng }, {
|
||||||
GMapWrapper.map = new google.maps.Map(document.getElementById(divId), {
|
icon: place.noPano ? IconCollection.iconRed : IconCollection.iconGreen,
|
||||||
center: { lat: 48.2207779, lng: 16.3098489 },
|
zIndexOffset: 1000
|
||||||
zoom: 2,
|
})
|
||||||
fullscreenControl: false,
|
.addTo(MapEditor.markers)
|
||||||
zoomControl: true,
|
.on('click', function () {
|
||||||
zoomControlOptions: {
|
|
||||||
position: google.maps.ControlPosition.LEFT_BOTTOM
|
|
||||||
},
|
|
||||||
streetViewControl: true,
|
|
||||||
streetViewControlOptions: {
|
|
||||||
position: google.maps.ControlPosition.LEFT_BOTTOM
|
|
||||||
},
|
|
||||||
draggableCursor: 'crosshair'
|
|
||||||
});
|
|
||||||
|
|
||||||
GMapWrapper.map.addListener('click', function (mapsMouseEvent) {
|
|
||||||
GMapWrapper.placeMarker({
|
|
||||||
lat: mapsMouseEvent.latLng.lat(),
|
|
||||||
lng: mapsMouseEvent.latLng.lng()
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
GMapWrapper.loadMarkers(places);
|
|
||||||
},
|
|
||||||
|
|
||||||
loadMarkers: function (places) {
|
|
||||||
GMapWrapper.markers = new MarkerClusterer(GMapWrapper.map, [], {
|
|
||||||
imagePath: STATIC_ROOT + '/img/markers/m',
|
|
||||||
imageExtension: 'png?rev' + REVISION
|
|
||||||
});
|
|
||||||
|
|
||||||
for (var placeId in places) {
|
|
||||||
if (!places.hasOwnProperty(placeId)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
var place = places[placeId];
|
|
||||||
|
|
||||||
var marker = new google.maps.Marker({
|
|
||||||
position: {
|
|
||||||
lat: place.lat,
|
|
||||||
lng: place.lng
|
|
||||||
},
|
|
||||||
icon: place.noPano ? GMapWrapper.iconCollection.iconRed : GMapWrapper.iconCollection.iconGreen
|
|
||||||
});
|
|
||||||
|
|
||||||
marker.getLatLng = function () { return { lat: this.getPosition().lat(), lng: this.getPosition().lng() } };
|
|
||||||
marker.setLatLng = function (coords) { this.setPosition(coords) };
|
|
||||||
|
|
||||||
marker.addListener('click', function () {
|
|
||||||
MapEditor.select(this);
|
|
||||||
});
|
|
||||||
|
|
||||||
marker.placeId = place.id;
|
|
||||||
|
|
||||||
GMapWrapper.markers.addMarker(marker);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// TODO: check whether marker is already existing on the map for the coordinates
|
|
||||||
// or alternatively block saving for matching coordinates
|
|
||||||
placeMarker: function (latLng) {
|
|
||||||
var marker = new google.maps.Marker({
|
|
||||||
map: GMapWrapper.map,
|
|
||||||
position: latLng,
|
|
||||||
icon: GMapWrapper.iconCollection.iconBlue,
|
|
||||||
});
|
|
||||||
|
|
||||||
marker.getLatLng = function () { return { lat: this.getPosition().lat(), lng: this.getPosition().lng() } };
|
|
||||||
marker.setLatLng = function (coords) { this.setPosition(coords) };
|
|
||||||
|
|
||||||
marker.addListener('click', function () {
|
|
||||||
MapEditor.select(this);
|
MapEditor.select(this);
|
||||||
});
|
});
|
||||||
|
|
||||||
GMapWrapper.markers.addMarker(marker);
|
marker.placeId = place.id;
|
||||||
|
}
|
||||||
|
|
||||||
MapEditor.select(marker);
|
MapEditor.map.addLayer(MapEditor.markers);
|
||||||
},
|
|
||||||
|
|
||||||
panTo: function (latLng) {
|
|
||||||
GMapWrapper.map.panTo(latLng);
|
|
||||||
},
|
|
||||||
|
|
||||||
invalidateSize: function (invalid) {
|
|
||||||
if (invalid) {
|
|
||||||
google.maps.event.trigger(GMapWrapper.map, 'resize');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
changeMarkerIcon: function (marker, icon) {
|
|
||||||
marker.setIcon(icon);
|
|
||||||
},
|
|
||||||
|
|
||||||
removeMarker: function (marker) {
|
|
||||||
GMapWrapper.markers.removeMarker(marker);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// MapEditor.map = LMapWrapper;
|
|
||||||
MapEditor.map = GMapWrapper;
|
|
||||||
MapEditor.map.init('map', places);
|
|
||||||
|
|
||||||
MapEditor.panorama = new google.maps.StreetViewPanorama(document.getElementById('panorama'), {
|
MapEditor.panorama = new google.maps.StreetViewPanorama(document.getElementById('panorama'), {
|
||||||
// switch off fullscreenControl because positioning doesn't work
|
// switch off fullscreenControl because positioning doesn't work
|
||||||
@@ -632,7 +478,7 @@
|
|||||||
var coordinates = Util.extractCoordinates(coordinatesStr);
|
var coordinates = Util.extractCoordinates(coordinatesStr);
|
||||||
|
|
||||||
if (coordinates.valid) {
|
if (coordinates.valid) {
|
||||||
MapEditor.map.placeMarker(coordinates.latlng);
|
MapEditor.placeMarker(coordinates.latlng);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -645,7 +491,7 @@
|
|||||||
jumpButton.disabled = false;
|
jumpButton.disabled = false;
|
||||||
|
|
||||||
if (e.key == 'Enter') {
|
if (e.key == 'Enter') {
|
||||||
MapEditor.map.placeMarker(coordinates.latlng);
|
MapEditor.placeMarker(coordinates.latlng);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
@js(node_modules/leaflet/dist/leaflet.js)
|
@js(node_modules/leaflet/dist/leaflet.js)
|
||||||
@js(node_modules/leaflet.markercluster/dist/leaflet.markercluster.js)
|
@js(node_modules/leaflet.markercluster/dist/leaflet.markercluster.js)
|
||||||
@js(https://maps.googleapis.com/maps/api/js?key=<?= $_ENV['GOOGLE_MAPS_JS_API_KEY'] ?>)
|
@js(https://maps.googleapis.com/maps/api/js?key=<?= $_ENV['GOOGLE_MAPS_JS_API_KEY'] ?>)
|
||||||
@js(https://unpkg.com/@googlemaps/markerclustererplus/dist/index.min.js)
|
|
||||||
@js(js/map_editor.js)
|
@js(js/map_editor.js)
|
||||||
|
|
||||||
@extends(templates/layout_full)
|
@extends(templates/layout_full)
|
||||||
|
|||||||
@@ -60,6 +60,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="navigation">
|
<div id="navigation">
|
||||||
|
<div id="compassContainer" class="navigationItem">
|
||||||
|
<div>
|
||||||
|
<img src="<?= $_ENV['STATIC_ROOT'] ?>/img/circle_background.svg?rev=<?= REVISION ?>" alt="Circle Background" class="circleBackground" />
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<img id="compass" src="<?= $_ENV['STATIC_ROOT'] ?>/img/compass.svg?rev=<?= REVISION ?>" alt="compass icon" class="navigationIcon" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div id="returnToStart" class="navigationItem">
|
<div id="returnToStart" class="navigationItem">
|
||||||
<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="circleBackground" />
|
||||||
|
|||||||
Reference in new issue
Block a user