diff --git a/src/main/resources/eu/simstadt/regionchooser/website/script/simstadt_openlayers.js b/src/main/resources/eu/simstadt/regionchooser/website/script/simstadt_openlayers.js index 9090de8c32914e6f2e097be8758d9a75678f50aa..54a9b9692f2740136537bb2a0299f60c2178f224 100644 --- a/src/main/resources/eu/simstadt/regionchooser/website/script/simstadt_openlayers.js +++ b/src/main/resources/eu/simstadt/regionchooser/website/script/simstadt_openlayers.js @@ -161,27 +161,25 @@ const regionChooser = (function(){ li.onmouseover = function(){ regionChooser.highlightPolygon(this.feature) }; li.onmouseout = function(){ regionChooser.resetHighlight(this.feature) }; -/* li.setAttribute('onmouseover', 'regionChooser.highlightPolygon(' + id + ')"'); - li.setAttribute('onmouseout', 'regionChooser.resetHighlight(' + id + ')"'); -*/ let checkbox = li.appendChild(document.createElement('input')); + let checkbox = li.appendChild(document.createElement('input')); checkbox.type = 'checkbox' checkbox.id = "citygml_" + feature.getId(); checkbox.className = "select_citygml"; + checkbox.feature = feature; + checkbox.setAttribute('onclick', "regionChooser.isDownloadPossible()"); + let label = li.appendChild(document.createElement('label')); label.setAttribute('for', "citygml_" + feature.getId()); - label.textContent = feature.name; - checkbox.setAttribute('onclick', "regionChooser.isDownloadPossible()"); + var text = feature.name; - -/* var link = '<li onmouseover="regionChooser.highlightPolygon(' + id + ')" onmouseout="regionChooser.resetHighlight(' + id +')">'; - link += '<input type="checkbox" id="citygml_' + feature.getId() + '" class="select_citygml" onclick="regionChooser.isDownloadPossible();">' - + '<label for="citygml_' + feature.getId() + '">' + feature['name'] + '</label>'; - - link += " (" + citygml_percentage + "%"; + text += " (" + citygml_percentage + "%"; if (sketch_percentage == 100) { - link += ", all inside"; + text += ", all inside"; } -*/ dataPanel[0].appendChild(li); + + label.textContent = text + ")\n"; + + dataPanel[0].appendChild(li); } publicScope.highlightPolygon = function(feature) { @@ -204,7 +202,6 @@ const regionChooser = (function(){ //TODO: Dry var selectedFeatures = Array.from(document.querySelectorAll("input.select_citygml")).filter(c => c.checked).map(c => c.feature); - console.log(selectedFeatures); selectedFeatures.forEach(f => refreshStyle(f, "selected")); document.getElementById("download_region_button").disabled = (selectedFeatures.length == 0);