Skip to content

Commit

Permalink
dynamic feed for search based on map
Browse files Browse the repository at this point in the history
  • Loading branch information
Ko71k committed Nov 25, 2024
1 parent 990506f commit db22bc2
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion public/components/Search/Search.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 // Устанавливаем всплывающее содержимое
}, {
Expand Down

0 comments on commit db22bc2

Please sign in to comment.