|
90 | 90 | document.getElementById('select-feature').addEventListener('click', selectFeature) |
91 | 91 | }) |
92 | 92 |
|
| 93 | + // Custom rendering functions |
| 94 | + const markerRender = (element, markerSize, feature) => { |
| 95 | + element.textContent = feature.properties.mag |
| 96 | + |
| 97 | + buildCss(element, { |
| 98 | + 'background-color': 'green', |
| 99 | + 'border-radius': '100%', |
| 100 | + 'justify-content': 'center', |
| 101 | + 'align-items': 'center', |
| 102 | + 'display': 'flex', |
| 103 | + 'color': 'white', |
| 104 | + 'width': `${markerSize}px`, |
| 105 | + 'height': `${markerSize}px`, |
| 106 | + 'cursor': 'pointer' |
| 107 | + }); |
| 108 | + } |
| 109 | + |
| 110 | + const pinMarkerRender = (coords, offset) => { |
| 111 | + return new maplibregl.Marker({ |
| 112 | + scale: 1.3, |
| 113 | + color: '#f44336', |
| 114 | + anchor: 'bottom' |
| 115 | + }) |
| 116 | + .setLngLat(coords) |
| 117 | + .setOffset(offset) |
| 118 | + } |
| 119 | + |
93 | 120 | const clusterRender = (element, props) => { |
94 | 121 | element.innerHTML = props.point_count.toLocaleString(); |
95 | 122 |
|
|
107 | 134 | }); |
108 | 135 | } |
109 | 136 |
|
| 137 | + // Specific features showcase functions |
110 | 138 | const loadData = async () => { |
111 | 139 | const url = document.getElementById('custom-url').value |
112 | 140 |
|
|
131 | 159 | }) |
132 | 160 | } |
133 | 161 |
|
134 | | - const markerRender = (element, markerSize, feature) => { |
135 | | - element.textContent = feature.properties.mag |
136 | | - |
137 | | - buildCss(element, { |
138 | | - 'background-color': 'green', |
139 | | - 'border-radius': '100%', |
140 | | - 'justify-content': 'center', |
141 | | - 'align-items': 'center', |
142 | | - 'display': 'flex', |
143 | | - 'color': 'white', |
144 | | - 'width': `${markerSize}px`, |
145 | | - 'height': `${markerSize}px`, |
146 | | - 'cursor': 'pointer' |
147 | | - }); |
148 | | - } |
149 | | - |
150 | | - const pinMarkerRender = (coords, offset) => { |
151 | | - return new maplibregl.Marker({ |
152 | | - scale: 1.3, |
153 | | - color: '#f44336', |
154 | | - anchor: 'bottom' |
155 | | - }) |
156 | | - .setLngLat(coords) |
157 | | - .setOffset(offset) |
158 | | - } |
159 | | - |
160 | 162 | const selectFeature = async () => { |
161 | 163 | const id = document.getElementById('feature-id').value |
162 | 164 |
|
|
0 commit comments