drawing polygon bug fixed

parent a7871b06
......@@ -26,33 +26,33 @@ var makeRequest = function (value) {
dataType : 'json',
success : function(data) {
polygonList = data.polygonList;
while (pol_element.firstChild) {
pol_element.removeChild(pol_element.firstChild);
}
if (polygonList.length <= 0) {
var temp = document.querySelector('#city_list_template');
// filling template
temp.content.querySelector('li').id = '';
temp.content.querySelectorAll('span')[0].textContent = 'No cities matched your search. Try again.';
temp.content.querySelectorAll('span')[1].textContent = '';
temp.content.querySelectorAll('div')[3].textContent = '';
var clone = document.importNode(temp.content, true);
document.querySelector('#polygon-list').appendChild(clone);
} else {
data.polygonList.forEach(function (polygon) {
var temp = document.querySelector('#city_list_template');
// filling template
temp.content.querySelector('li').id = polygon.id;
temp.content.querySelectorAll('span')[0].textContent = polygon.city + ", " + polygon.state;
temp.content.querySelectorAll('span')[1].textContent = polygon.description;
temp.content.querySelectorAll('div')[3].textContent = "Fuente: " + polygon.source;
var clone = document.importNode(temp.content, true);
document.querySelector('#polygon-list').appendChild(clone);
});
......@@ -84,16 +84,16 @@ function drawPolygon(element) {
osmap.removePolygon();
// draw wkt polygon
// osmap.addWKTPolygon(polygon.wkt_polygon);
osmap.addWKTPolygon(polygon.wkt_polygon);
// format coords to draw
var coords = osmap.formatCoords(polygon.geojson.geometry.coordinates);
// var coords = osmap.formatCoords(polygon.geojson.geometry.coordinates);
// get the biggest area
var biggest = osmap.getBiggestPolygon(coords);
// var biggest = osmap.getBiggestPolygon(coords);
// draw coordsR
osmap.addPolygon(biggest);
// osmap.addPolygon(biggest);
}
})
}
......@@ -162,7 +162,7 @@ function drawApiResponse(element) {
function createProductContainer() {
var temp_1 = document.querySelector('#product_cart_1');
// filling template
temp_1.content.querySelector('span').textContent = "Product";
......@@ -178,7 +178,7 @@ $('#ajax-input').focus(function () {
$('#option-list').show();
OPT_LIST_IS_HIDDEN = false;
}
}).blur(function () {
}).blur(function (event) {
INPUT_ON_FOCUS = false;
if (!OPT_LIST_IS_HIDDEN && $(this).val() && $(event.target).closest('#option-list').length) {
$('#option-list').hide();
......@@ -243,13 +243,13 @@ $(document).ready(function () {
typingTimer = setTimeout(makeRequest.bind(null, value), typingInterval);
} else {
$('#option-list').hide();
while (pol_element.firstChild) {
pol_element.removeChild(pol_element.firstChild);
}
OPT_LIST_IS_HIDDEN = true;
return
}
});
......@@ -304,7 +304,7 @@ $(document).ready(function () {
temp.content.querySelectorAll('span')[1].textContent = data.product.identifier;
temp.content.querySelectorAll('span')[2].textContent = data.product.size;
temp.content.querySelectorAll('span')[3].textContent = data.product.instrumentname;
var clone = document.importNode(temp.content, true);
document.querySelector('#product-list-globe').appendChild(clone);
}
......@@ -397,7 +397,7 @@ $(document).ready(function () {
productsToObtain = [];
data.product_list.forEach(function (product) {
var temp_2 = document.querySelector('#product_cart_2');
// filling template
temp_2.content.querySelector('li').id = product.uuid;
temp_2.content.querySelector('h4').id = product.uuid + "-h4";
......@@ -424,7 +424,7 @@ $(document).ready(function () {
}
});
// purchasing products in cart
$('#purchased-product-form').submit(function (event) {
event.preventDefault();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment