소스 검색

HUE-8354 [dashboard] Fix 'Search as I move the map' functionality on the Leaflet widget

Enrico Berti 7 년 전
부모
커밋
a0e9290fa1

+ 8 - 6
desktop/core/src/desktop/static/desktop/js/ko.charts.leaflet.js

@@ -118,8 +118,8 @@
                 });
 
                 _command.onAdd = function (map) {
-                  var div = L.DomUtil.create("div", "leaflet-search-command leaflet-bar");
-                  div.innerHTML = '<label class="checkbox" style="font-size: 11px"><input id="command' + $(element).parents(".card-widget").attr("id") + '" type="checkbox"/> ' + (_options.moveCheckboxLabel ? _options.moveCheckboxLabel : 'Search as I move the map') + '</label>';
+                  var div = L.DomUtil.create("div", "leaflet-search-command leaflet-bar leaflet-move-label");
+                  div.innerHTML = '<button id="command' + $(element).parents(".card-widget").attr("id") + '" type="button" class="btn btn-mini disable-feedback"><i class="fa fa-fw fa-square-o"></i> ' + (_options.moveCheckboxLabel ? _options.moveCheckboxLabel : 'Search as I move the map') + '</button>';
                   return div;
                 };
 
@@ -133,8 +133,10 @@
                 var _onRegionChange = function () {
                 };
 
-                $("#command" + $(element).parents(".card-widget").attr("id")).on("change", function () {
-                  if ($(this).is(":checked")) {
+                $('#command' + $(element).parents('.card-widget').attr('id')).on('click', function (e) {
+                  $(this).toggleClass('btn-primary');
+                  $(this).find('.fa-fw').toggleClass('fa-check-square');
+                  if ($(this).hasClass("btn-primary")) {
                     if (_options.onRegionChange != null) {
                       _onRegionChange = _options.onRegionChange;
                     }
@@ -145,8 +147,8 @@
                   }
                 });
 
-                ko.utils.domNodeDisposal.addDisposeCallback(element, function() {
-                  $("#command" + $(element).parents(".card-widget").attr("id")).off("change");
+                ko.utils.domNodeDisposal.addDisposeCallback(element, function () {
+                  $('#command' + $(element).parents('.card-widget').attr('id')).off('click');
                 });
 
                 _map.on("boxzoomend", function (e) {

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
desktop/libs/dashboard/src/dashboard/static/dashboard/css/common_dashboard.css


+ 4 - 0
desktop/libs/dashboard/src/dashboard/static/dashboard/less/common_dashboard.less

@@ -457,6 +457,10 @@
     display: block;
   }
 
+  .leaflet-bar {
+    box-shadow: none;
+  }
+
   .leaflet-align {
     text-align: center;
   }

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.