Upload deploy/globe/app.js with huggingface_hub
Browse files528 unmodified lines5295305315325335345 unmodified lines540541542543544545546528 unmodified linesconst el = document.createElement('div');el.className = 'cty2';el.textContent = p.cn || p.NAME;state.cLabels.push(new maplibregl.Marker({ element: el, anchor: 'center' }).setLngLat([p.cx, p.cy]).addTo(map));});5 unmodified linesconst coarse = on && z > 2.05 && z <= 3.3;const fine = on && z > 3.3;state.markers.forEach((m) => m.getElement().classList.toggle('on', coarse));(state.cLabels || []).forEach((m) => m.getElement().classList.toggle('on', fine));}/* ---------------- 过滤 ---------------- */528 unmodified lines5295305315325335345355365375385395405415425435445455465475 unmodified lines553554555556557558559560561562563564528 unmodified linesconst el = document.createElement('div');el.className = 'cty2';el.textContent = p.cn || p.NAME;// 粗略面积:经度跨度 × cos(纬度) × 纬度跨度,用来滤掉小国标签let span = 0;try {const c = f.geometry.coordinates;const rings = f.geometry.type === 'Polygon' ? c : c.flat();let x0 = 180, x1 = -180, y0 = 90, y1 = -90;rings.forEach((r) => r.forEach(([x, y]) => {if (x < x0) x0 = x; if (x > x1) x1 = x;if (y < y0) y0 = y; if (y > y1) y1 = y;}));span = (x1 - x0) * Math.cos((Math.max(Math.abs(y0), Math.abs(y1)) * Math.PI) / 180) * (y1 - y0);} catch (e) { span = 0; }el.dataset.span = span.toFixed(1);state.cLabels.push(new maplibregl.Marker({ element: el, anchor: 'center' }).setLngLat([p.cx, p.cy]).addTo(map));});5 unmodified linesconst coarse = on && z > 2.05 && z <= 3.3;const fine = on && z > 3.3;state.markers.forEach((m) => m.getElement().classList.toggle('on', coarse));(state.cLabels || []).forEach((m) => {const el = m.getElement();const span = Number(el.dataset.span || 0);const big = z > 4.4 || span > (z > 3.9 ? 5 : 16);el.classList.toggle('on', fine && big);});}/* ---------------- 过滤 ---------------- */
deploy/globe/app.js+19-1