in Education by
I am trying to create an app using AngularJS that takes a user's location (from their mobile) and creates a radius that increases in size over time. Here is what I have so far: http://alainwebdesign.ca/doglocate/example/issue-1068-circle-events-doubled.html. The app works for the most part, but the problem is that when you move/drag the map, the radius center changes which is not what I want. I want the center of the radius to be lock in at the specified location. Here is my HTML: <!DOCTYPE html> Dog Locate
And here is my Javascript: (function (window, ng) { ng.module('app', ['uiGmapgoogle-maps']) .controller('MapsCtrl', ['$scope', "uiGmapLogger", "uiGmapGoogleMapApi", "$interval", function ($scope, $log, GoogleMapApi, $interval) { $log.currentLevel = $log.LEVELS.debug; var center = { latitude: 49.22, longitude: -122.66 }; $scope.map = { center: center, pan: false, zoom: 16, refresh: false, events: {}, bounds: {} }; $scope.map.circle = { id: 1, center: center, radius: 500, stroke: { color: '#08B21F', weight: 2, opacity: 1 }, fill: { color: '#08B21F', opacity: 0.5 }, geodesic: false, // optional: defaults to false draggable: false, // optional: defaults to false clickable: true, // optional: defaults to true editable: false, // optional: defaults to false visible: true, // optional: defaults to true events: { dblclick: function () { $log.debug("circle dblclick"); }, radius_changed: function (gObject) { var radius = gObject.getRadius(); $log.debug("circle radius radius_changed " + radius); } } } //Increase Radius: $interval(function(){ $scope.map.circle.radius += 30; }, 1000); } ]); })(window, angular); JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
Solved my own question. I just used Object.freeze(center) after declaring the center variable.

Related questions

0 votes
    I am trying to create an app using AngularJS that takes a user's location (from their mobile) and ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 12, 2022 in Education by JackTerrance
0 votes
    [reposting deleted question with more detail] I've searched for an answer to this but not found a reference ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 19, 2022 in Education by JackTerrance
0 votes
    [reposting deleted question with more detail] I've searched for an answer to this but not found a reference ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 11, 2022 in Education by JackTerrance
0 votes
    [reposting deleted question with more detail] I've searched for an answer to this but not found a reference ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 10, 2022 in Education by JackTerrance
0 votes
    I mean this Datepicker: https://uxsolutions.github.io/bootstrap-datepicker/ HTML: Fecha de inicio Fecha de ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 10, 2022 in Education by JackTerrance
0 votes
    I just added a textarea to my page which is an "include" to another page...I have some script ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    I just added a textarea to my page which is an "include" to another page...I have some script ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    How can I apply my div position x value to a variable? And how to iterate it in a for loop? ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 20, 2022 in Education by JackTerrance
0 votes
    I Know I can do this with static HTML, but I want to create dynamically, and I am struggling a ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 12, 2022 in Education by JackTerrance
0 votes
    I wanted to show a loading icon to users until the page elements are fully loaded. How can I do ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 10, 2022 in Education by JackTerrance
0 votes
    Here is my JSFiddle Preview is shown in div box. I want to add close option on right top. How ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 10, 2022 in Education by JackTerrance
0 votes
    I Know I can do this with static HTML, but I want to create dynamically, and I am struggling a ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 8, 2022 in Education by JackTerrance
0 votes
    I have a landing page with sticky header. When user start scroll and the page displays .second-section . ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 26, 2022 in Education by JackTerrance
0 votes
    I have the access to this DOM node in temp1.$el. And here is the content which the above variable ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 26, 2022 in Education by JackTerrance
0 votes
    I have the access to this DOM node in temp1.$el. And here is the content which the above variable ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 14, 2022 in Education by JackTerrance
...