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 ad50814e81be9bea3cade61530ce3c6231639ced..37fd6ee91fefa3afc5797cd7d1527aad53cc0ddd 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 @@ -153,7 +153,26 @@ const regionChooser = (function(){ var sketch_percentage = Math.round(intersectionArea / polygonArea * 100); var id = feature.getId(); intersections.addFeature(intersection); - var link = '<li onmouseover="regionChooser.highlightPolygon(' + id + ')" onmouseout="regionChooser.resetHighlight(' + id +')">'; + + //TODO: Clean this mess. No jquery + + li = document.createElement('li'); + li.feature = feature; + + 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')); + checkbox.type = 'checkbox' + checkbox.id = "citygml_" + feature.getId(); + let label = li.appendChild(document.createElement('label')); + label.setAttribute('for', "citygml_" + feature.getId()); + label.textContent = feature.name; + checkbox.setAttribute('onclick', "regionChooser.isDownloadPossible()"); + + +/* 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>'; @@ -161,16 +180,14 @@ const regionChooser = (function(){ if (sketch_percentage == 100) { link += ", all inside"; } - dataPanel.append(link + ")\n"); +*/ dataPanel[0].appendChild(li); } - publicScope.highlightPolygon = function(i) { - var feature = kml_source.getFeatureById(i); + publicScope.highlightPolygon = function(feature) { feature.setStyle(styles.highlighted); } - publicScope.resetHighlight = function(i) { - var feature = kml_source.getFeatureById(i); + publicScope.resetHighlight = function(feature) { refreshStyle(feature); }