From db22bc21cadb8fb2dc9955ec756f258e77b5ff45 Mon Sep 17 00:00:00 2001 From: Rassmagin Alexander Date: Mon, 25 Nov 2024 10:09:04 +0300 Subject: [PATCH] dynamic feed for search based on map --- public/components/Search/Search.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/public/components/Search/Search.js b/public/components/Search/Search.js index 26a783b..57f104e 100644 --- a/public/components/Search/Search.js +++ b/public/components/Search/Search.js @@ -287,12 +287,25 @@ export class Search { * @param {string} description - The description of the event. * @param {string} image - The image URL of the event. */ + console.log("topLeftLatitude: ", document.getElementById("topLeftLatitude").value); + console.log("topLeftLongitude: ",document.getElementById("topLeftLongitude").value); + console.log("botRightLatitude: ",document.getElementById("botRightLatitude").value); + console.log("botRightLongitude: ",document.getElementById("botRightLongitude").value); Object.entries(feed.events).forEach( (elem) => { const {id, title, image, Latitude, Longitude} = elem[1]; const feedElement = new FeedElement(id, title, `${endpoint}/${image}`).renderTemplate(); - feedContent.appendChild(feedElement); + + + // console.log(elem, Latitude, Longitude); const coordinates = [Latitude, Longitude]; // Создаем массив координат + if ( + Latitude >= document.getElementById("topLeftLatitude").value && + Latitude <= document.getElementById("botRightLatitude").value && + Longitude >= document.getElementById("topLeftLongitude").value && + Longitude <= document.getElementById("botRightLongitude").value) { + feedContent.appendChild(feedElement); + } const placemark = new ymaps.Placemark(coordinates, { hintContent: title // Устанавливаем всплывающее содержимое }, {