Giter Club home page Giter Club logo

Comments (9)

nmccready avatar nmccready commented on July 20, 2024

From @stefan-niedermann on February 9, 2015 8:14

Hi, look here: http://tombatossals.github.io/angular-leaflet-directive/#!/examples/events

You can watch events. If this does not help you, i can post a piece of code how to listen the drag event and get the new coordinates.

Hint: You don't need to watch leafletDirectiveMap-Event, there is a leafletDirectiveMarker-Event which you can listen to.

from ui-leaflet.

nmccready avatar nmccready commented on July 20, 2024

From @praveenkumararepalliGit on February 9, 2015 9:22

Hi Stefan,
Thanks for you reply.
Can you post a piece of code .

from ui-leaflet.

nmccready avatar nmccready commented on July 20, 2024

From @praveenkumararepalliGit on February 9, 2015 11:20

Hi Stefen,
Actually I wanted to show default location by setting lat = 12 and lng =80;

      angular.extend($scope, {
               city: {
                   lat: 12,
                   lng: 80,
                   zoom: 12
               },
               markers: {
                   cityName: {
                       lat:12,
                       lng:80,
                       message: "You are here!",
                       focus: true,
                       draggable: true
                   }
               },
               defaults: {
                   scrollWheelZoom: true
               },events: {
                    map: {
                        enable: ['zoomstart', 'drag', 'click', 'mousemove'],
                        logic: 'emit'
                    }
                }
           });

Here i am watching drag event.

    $scope.$on('leafletDirectiveMarker.drag', function(event){
    var draggedLat=event.targetScope.markers.cityName.lat;
    var draggedLng=event.targetScope.markers.cityName.lng;
    console.log(draggedLat,draggedLng); //here am getting 12 ,80  every time
    console.log(event); // Here i can see new coordinates
    console.log(event.targetScope.markers.cityName.lat,event.targetScope.markers.cityName.lng);
   });

Can you Tell where the issue is ?

from ui-leaflet.

nmccready avatar nmccready commented on July 20, 2024

From @stefan-niedermann on February 9, 2015 12:19

sry, can't tell it by rote. i currently don't have access to my notebook. i'll post today evening, hope thats early enough. hmm, maybe the event is wrong? did you try leafletDirectiveMarker.dragend ?

from ui-leaflet.

nmccready avatar nmccready commented on July 20, 2024

From @praveenkumararepalliGit on February 9, 2015 12:28

Yes Stefen. But Coordinates are wrong
can I achieve by doing this code?
Default location is 12,80 once i drop marker to new location still its giving 12,80 only
But dropping point is different

     $scope.$on('leafletDirectiveMarker.dragend', function(event){
    var coordinatesObject = event;
            var draggedLat=coordinatesObject.targetScope.markers.cityName.lat;
            var draggedLng=coordinatesObject.targetScope.markers.cityName.lng;
        console.log(draggedLat,draggedLng);
           console.log(event.targetScope.markers.cityName.lat,
                          event.targetScope.markers.cityName.lng);  
     });

from ui-leaflet.

nmccready avatar nmccready commented on July 20, 2024

From @stefan-niedermann on February 9, 2015 21:25

I am sorry, i am not able to reproduce this behaviour

$scope.$on('leafletDirectiveMarker.dragend', function(event) {
    console.log($scope.markers.mymarker.lat);
    console.log($scope.markers.mymarker.lng);
}

this works fine for me...

from ui-leaflet.

nmccready avatar nmccready commented on July 20, 2024

From @praveenkumararepalliGit on February 10, 2015 9:55

Yes,i can see the new coordinates only for one image.

I have 3 Images side by side.When click any image making call to

     $scope.imageLocationDetails(imageData,$index);

Then "imageLocationDetails()" will start executes and there am checking for

imageViewPage.jsp

     <leaflet defaults="defaults" markers="markers"  center="city" height="320px" width="320px"></leaflet>

imageController.js

          $scope.imageLocationDetails = function (image,imageIndex) {
          //Here i can read the EXIF data from Image (EXIF data may have lat and lng)
         $scope.imageIndex = imageIndex;
           if (image.lat && image.lng) {
                 angular.extend($scope, {
                      city: {
                           lat: latt,
                           lng: longi,
                           zoom: 12
                        },
                     markers: {
                        cityName: {
                                  lat:latt,
                                  lng:longi,
                                  message: "You are here!",
                                  focus: true,
                                 draggable: true
                                }
                        },
                       defaults: {
                              scrollWheelZoom: true
                        },events: {
                          map: {
                              enable: ['zoomstart', 'drag', 'click', 'mousemove'],
                                 logic: 'emit'
                         }
                   }
              });
                } else {
                      angular.extend($scope, {
               city: {
                   lat: 12,
                   lng: 80,
                   zoom: 12
               },
               markers: {
                   cityName: {
                       lat:12,
                       lng:80,
                       message: "You are here!",
                       focus: true,
                       draggable: true
                   }
               },
               defaults: {
                   scrollWheelZoom: true
               },events: {
                    map: {
                        enable: ['zoomstart', 'drag', 'click', 'mousemove'],
                        logic: 'emit'
                    }
                }
           });
                 }

             }


          $scope.$on('leafletDirectiveMarker.dragend', function(event,gh,mmm){
          console.log($scope.markers.cityName.lat);
          console.log($scope.markers.cityName.lng);
         //Here i wanted to get the latest coordnates and put into image(Based on image ID)
                $scope.imageList[$scope.imageIndex].lat =   $scope.markers.cityName.lat;
                $scope.imageList[$scope.imageIndex].lng =   $scope.markers.cityName.lng;
            });

Is this correct approach stefen?

from ui-leaflet.

nmccready avatar nmccready commented on July 20, 2024

From @stefan-niedermann on February 10, 2015 10:9

hmm @tombatossals any idea?

from ui-leaflet.

nmccready avatar nmccready commented on July 20, 2024

See rest of original issue tombatossals/angular-leaflet-directive#626

Rest of issue import broke.

from ui-leaflet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.