From 5799f818e1124c126c264bc2b9744315b6caf369 Mon Sep 17 00:00:00 2001 From: Katerina Date: Thu, 16 Jul 2020 13:09:44 +1000 Subject: [PATCH] testing dragable pins --- public/item.js | 14 ++++++++++++++ views/new-item.ejs | 3 --- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/public/item.js b/public/item.js index 880c030..609a9cf 100644 --- a/public/item.js +++ b/public/item.js @@ -52,11 +52,25 @@ const reverseGeocode = function (e) { //Make the reverse geocode request. searchManager.reverseGeocode(searchRequest); + // var greenPin = new Microsoft.Maps.Pushpin(new Microsoft.Maps.Location(center.latitude, center.longitude - 0.1), { color: '#0f0', draggable: true }); + // map.entities.push(greenPin); + var pin = new Microsoft.Maps.Pushpin(e.location, { + draggable: true, // title: address // color: 'green' }); map.entities.push(pin); + + Microsoft.Maps.Events.addHandler(pin, 'drag', function (e) { + highlight('pushpinDrag', e); + }); + Microsoft.Maps.Events.addHandler(pin, 'dragend', function (e) { + highlight('pushpinDragEnd', e); + }); + Microsoft.Maps.Events.addHandler(pin, 'dragstart', function (e) { + highlight('pushpinDragStart', e); + }); console.log(map.entities); } }; diff --git a/views/new-item.ejs b/views/new-item.ejs index d727124..3503607 100644 --- a/views/new-item.ejs +++ b/views/new-item.ejs @@ -16,9 +16,6 @@ /> - <% d = new Date()%> <% month = '' + (d.getMonth() + 1)%> <% day = '' +