File size: 4,113 Bytes
a62f8b4
 
7613c99
a62f8b4
 
 
 
 
 
e3855b0
a62f8b4
 
 
 
 
 
 
 
 
 
 
f8fa21c
4e2d9ce
 
a62f8b4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
// ==================== ENTRY POINT ====================

const apiClient = new ApiClient(location.hostname === 'localhost' ? 'http://localhost:4000/api' : '/api');
//top-left : 10.947849, 106.532560, 17z bottom-right: 10.629144, 106.828837, 17z
// Shared state
let locationsData = [];
let filteredLocations = [];

window.addEventListener('load', async () => {
    await window.loadTileCenters(); // load tile centers trước khi render pointr
    await loadLocations();
    enableGalleryDragScroll();
    initGalleryClickListener();
    initPathSvg();
    initContainerScrollListener();
    initKeyboardListener();
    await initFilterListeners();
    initPointrDrag();
    initEditorListener();
    initSettings();
    initSearch();
    initStreetPanel();
    await loadPois();
    initPoiInteractions();

    // Test pointr
    const allPointrs = [
      {
        "name": "Trung Tâm Y Khoa Diag",
        "latitude": 10.829389,
        "longitude": 106.681626
      },
      {
        "name": "Trung Tâm Y Khoa Diag",
        "latitude": 10.799748,
        "longitude": 106.669596
      },
      {
        "name": "Trung Tâm Y Khoa Diag - Cách Mạng Tháng 8",
        "latitude": 10.791971,
        "longitude": 106.655432
      },
      {
        "name": "Phòng chờ xe Hải Vân Limousine Hồ Chí Minh - Vũng Tàu",
        "latitude": 10.769824,
        "longitude": 106.700088
      },
      {
        "name": "Diag Laboratories",
        "latitude": 10.818625,
        "longitude": 106.678662
      },
      {
        "name": "Tan Binh Hospital",
        "latitude": 10.7945055,
        "longitude": 106.65498559999999
      },
      {
        "name": "Thong Nhat Hospital",
        "latitude": 10.7915459,
        "longitude": 106.65347419999999
      },
      {
        "name": "Binh Tan District Hospital",
        "latitude": 10.7643601,
        "longitude": 106.6032103
      },
      {
        "name": "Tan Phu District Hospital",
        "latitude": 10.783638,
        "longitude": 106.6422004
      },
      {
        "name": "Tan Phu District Hospital",
        "latitude": 10.783638,
        "longitude": 106.6422004
      },
      {
        "name": "Tam Tri Saigon General Hospital",
        "latitude": 10.83175,
        "longitude": 106.62183
      },
      {
        "name": "Quoc Anh General Hospital",
        "latitude": 10.753473399999999,
        "longitude": 106.5931056
      },
      {
        "name": "International Neurosurgery Hospital (INH)",
        "latitude": 10.7612331,
        "longitude": 106.63213739999999
      },
      {
        "name": "District 10 Hospital",
        "latitude": 10.7762318,
        "longitude": 106.6666796
      },
      {
        "name": "Hyvong Hospital",
        "latitude": 10.789941599999999,
        "longitude": 106.6283078
      },
      {
        "name": "Tam Anh Hospital",
        "latitude": 10.802484999999999,
        "longitude": 106.6660436
      },
      {
        "name": "Cho Ray Hospital",
        "latitude": 10.7578646,
        "longitude": 106.6595131
      },
      {
        "name": "Benh Vien Xuyen A",
        "latitude": 10.92804,
        "longitude": 106.55816
      },
      {
        "name": "Hoan My Sai Gon General Hospital",
        "latitude": 10.800158699999999,
        "longitude": 106.684242
      },
      {
        "name": "Mỹ Đức General Hospital",
        "latitude": 10.7999169,
        "longitude": 106.6415827
      },
      {
        "name": "Trung tâm y tế quận Tân Phú",
        "latitude": 10.7871291,
        "longitude": 106.6334301
      }
    ];
    const coordinates = document.querySelector('.coordinates');
    let nSize = parseInt(document.getElementById('sSize').value);
    console.log('New size:', nSize);
    sizePer  = nSize/2400;

    setTimeout(() => {
      return;
      allPointrs.forEach(({ name, latitude, longitude }) => {
          const pos = latLonToPixel(latitude, longitude, sizePer);
          const { pointr } = createPointr(pos.left, pos.top, name, latitude, longitude);
          coordinates.appendChild(pointr);
      });
    }, 2000);

});