Parcourir la source

Merge branch 'test-gwendal-move-point-main' of FFDN/celutz into master

Samuel il y a 8 ans
Parent
commit
3009b8dda3

+ 0 - 16
panorama/static/panorama/css/celutz.css

@@ -281,22 +281,6 @@ fieldset#adding {
     margin: 2px;
     margin: 2px;
     right: 0;
     right: 0;
 }
 }
-/* Expand button of the minimap on the panorama view*/
-#expandmap {
-    background-color: #fff; 
-    position: absolute;
-    bottom: 266px;
-    right: 12px;
-    height: 26px;
-    width: 26px;
-    line-height: 26px;
-    font-size: 18px;
-    text-indent: 1px;
-    text-align: center;
-    border: 1px solid #ccc;
-    border-radius: 4px;
-    z-index: 1;
-}
 
 
 /* menu items on pano viewer */
 /* menu items on pano viewer */
 @media (min-width: 768px) {
 @media (min-width: 768px) {

+ 0 - 19
panorama/static/panorama/js/pano.js

@@ -1281,7 +1281,6 @@ function load_map(){
         // update the panorama & minimap
         // update the panorama & minimap
         change_angle(); // update panorama & minimap
         change_angle(); // update panorama & minimap
     });
     });
-    hide_map()
 };
 };
 
 
 function update_map(){
 function update_map(){
@@ -1305,21 +1304,3 @@ function update_map(){
     viewDirection.addTo(map);
     viewDirection.addTo(map);
 
 
 }
 }
-
-function hide_map(){
-    /* Hide or show the map on panorama view
-    */
-    var map = $('#mapid')
-    $('#expandmap').click(function() {
-        if(map.css('visibility')=='visible'){
-            map.css('visibility','hidden');
-            $('#expandmap').css({'bottom': '12px','right':'12px'})
-            $('#expandmap').attr('class', 'fa fa-expand');
-        } else {
-            map.css('visibility','visible');
-            $('#expandmap').css({'bottom':'266px','right':'12px'})
-            $('#expandmap').attr('class', 'fa fa-compress');
-        }
-    });
-
- }

+ 23 - 5
panorama/templates/panorama/main.html

@@ -116,8 +116,10 @@
             });
             });
         }
         }
         function fillCoord() {
         function fillCoord() {
-            var lat = map.getCenter().lat.toFixed(5);
-            var lng = map.getCenter().lng.toFixed(5);
+            //var lat = map.getCenter().lat.toFixed(5);
+            //var lng = map.getCenter().lng.toFixed(5);
+            var lat = crosshair.getLatLng().lat.toFixed(5);
+            var lng = crosshair.getLatLng().lng.toFixed(5);
             $('#id_custompoint-latitude').val(lat);
             $('#id_custompoint-latitude').val(lat);
             $('#id_newpano-latitude').val(lat);
             $('#id_newpano-latitude').val(lat);
             $('#id_newrefpoint-latitude').val(lat);
             $('#id_newrefpoint-latitude').val(lat);
@@ -195,20 +197,36 @@
             map.addLayer(osm);
             map.addLayer(osm);
     
     
             // Add in a crosshair for the map
             // Add in a crosshair for the map
-            crosshair = new L.marker(map.getCenter(), {clickable:false,icon:crosshairIcon});
+            crosshair = new L.marker(map.getCenter(),{icon:crosshairIcon,draggable:true});
             crosshair.addTo(map);
             crosshair.addTo(map);
+
+            // Change crosshair lat/lon when click on the map
+            map.on('click', function(e) {
+                crosshair.setLatLng(e.latlng)
+                if ($("#locate-gps,#new-pano,#new-refpoint").hasClass("collapse in")){
+                    fillCoord();
+                }
+
+            });
     
     
             // Move the crosshair to the center of the map when the user pans
             // Move the crosshair to the center of the map when the user pans
-            map.on('move', function(e) {
+            /*map.on('move', function(e) {
                 crosshair.setLatLng(map.getCenter());
                 crosshair.setLatLng(map.getCenter());
             });
             });
-    
+            
             // Autofill forms while moving crosshair and expanding menus
             // Autofill forms while moving crosshair and expanding menus
             map.on('moveend', function(e) {
             map.on('moveend', function(e) {
                 if ($("#locate-gps,#new-pano,#new-refpoint").hasClass("collapse in")){
                 if ($("#locate-gps,#new-pano,#new-refpoint").hasClass("collapse in")){
                     fillCoord();
                     fillCoord();
                 }
                 }
             });
             });
+            */
+            // Autofill forms while moving crosshair and expanding menus
+            crosshair.on('moveend', function(e) {
+                if ($("#locate-gps,#new-pano,#new-refpoint").hasClass("collapse in")){
+                    fillCoord();
+                }
+            });
             $('#locate-gps-btn, #new-pano-btn, #new-refpoint-btn').click(function(e) {
             $('#locate-gps-btn, #new-pano-btn, #new-refpoint-btn').click(function(e) {
                 fillCoord();
                 fillCoord();
             });
             });

+ 0 - 1
panorama/templates/panorama/view.html

@@ -183,7 +183,6 @@ style="padding-left:0px"
       <input type="button" id="do-delete" class="btn btn-danger btn-sm" value={% trans "Delete" %} />
       <input type="button" id="do-delete" class="btn btn-danger btn-sm" value={% trans "Delete" %} />
       <input type="button" id="do-cancel" class="btn btn-warning btn-sm" value={% trans "Cancel" %} />
       <input type="button" id="do-cancel" class="btn btn-warning btn-sm" value={% trans "Cancel" %} />
     </p>
     </p>
-    <a href="#" title="Hide/show map"><i id="expandmap" class="fa fa-compress" aria-hidden="true"></i></a>
     <div id="mapid"></div>
     <div id="mapid"></div>
 {% endblock pano %}
 {% endblock pano %}