>>53
// グローバル変数
var currentPos = new google.maps.LatLng({lat: 32.xxx, lng: 130.xxx});
//---------------------------------------------------------------------
// watchPositionSuccessCallback() 現在位置取得Success
//---------------------------------------------------------------------
function watchPositionSuccessCallback(pos) {
currentPos = {lat: pos.coords.latitude, lng: pos.coords.longitude}; // あ、これがダメなのか?ここでnewしろと?
var from = new google.maps.LatLng(currentPos); // ここで from に new しないで
var to = google.maps.geometry.spherical.computeOffset(from, 350, heading); // 直に currentPos を使うとエラーが出ます
currentPos = {lat: a, lng: b};
って構文は
currentPos変数が保持してるLatLngオブジェクトのlatにaを代入、lngにbを代入する、
って思ってたんだけど違うのかなぁ?
ガベコレに関しては、ググると、
意図的にnullを代入すればメモリから消される、的なことを見たのだけどめんどくさいですよね。
上の例だと、
currentPos = null;
currentPos = new google.maps.LatLng({lat: 32, lng: 130});
最近のPCやスマフォはメモリ数GBとかあるしもう忘れることにしますw
きっとガーベージが増えたらGoogleChromeさんが勝手に掃除してくれますよね!
JavaScript情報交換所(プログラミング既習者専用) [無断転載禁止]©2ch.net
2016/02/12(金) 23:30:42.28ID:ZoV9Wx9d
レスを投稿する
