介紹:
需求
(a) 母項目(landmarkCluster)
點擊母項目標題或淺藍色區域後
exec. function goto_landmarkCluster(cluster_id)
其他的母項目與其下的子項目都deselected
會從API讀取一筆帶有GPS的地點,並呈現在展開的子項目
左邊的地圖根據這一筆GPS地點zoom in 到適當的大小,並以marker cluster加入到地圖中 所謂適當的大小:地圖中包含這一筆所有GPS,GPS距離地圖的邊界最小大約25%
d. 右邊該母項目與子項目的checkbox的狀態都變為selected
點擊母項目前方的checkbox
母項目中點擊specific function要可以執行特定的(spec_func(<cluster_id>),其中id 是母項目的序號
function spec_func(id) {
console.log(id)
}
當再點一次checkbox或藍色區域,地圖中的marker cluster 消失,右圖中該母項目與子項目的checkbox都deselected.
(b) 子項目(landmark)
當子項目標題被點擊後
當子項目前方的checkbox被點擊
子項目中點擊specific function要可以執行特定的(spec_func(<id>),其中id 是子項目的序號
function spec_func(id) {
console.log(id)
}
(c) functions which need implementation
function get_landmarks(){
...
return output
}
output:
{
"landmark_cluster":[
{
"cluster":"washinton",
"landmarks":[
{
"id":4,
"name":"United States Capitol",
},
...
},
{
"cluster":"new york",
"landmarks":[
{
"id":1,
"name":"Statue of Liberty National Monument",
},
...
],
}
]
}
function goto(landmark_id){
// zoom in to landmark(landmark_id)
}
function goto_landmarkCluster(cluster_id){
// zoom in and view all landmarks in the specific cluster.
}