From f11dcb0ea58c2407b18ec04ed6c4fa8123619db7 Mon Sep 17 00:00:00 2001 From: fukunee Date: Sat, 19 Sep 2026 17:44:32 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=8D=E6=9D=A1=E4=BE=BF=E7=AD=BE=E9=80=86?= =?UTF-8?q?=E6=97=B6=E9=92=88=E6=97=8B=E8=BD=AC45=C2=B0=EF=BC=88=E7=BB=95?= =?UTF-8?q?=E7=AE=AD=E5=A4=B4=E5=B0=96=EF=BC=89=EF=BC=8C=E5=91=BD=E4=B8=AD?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=94=B9=E7=94=A8=E5=AE=9E=E9=99=85=E7=9F=A9?= =?UTF-8?q?=E5=BD=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/scene/CesiumGlobe.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/scene/CesiumGlobe.js b/src/scene/CesiumGlobe.js index fb05964..2dafe65 100644 --- a/src/scene/CesiumGlobe.js +++ b/src/scene/CesiumGlobe.js @@ -418,6 +418,8 @@ export class CesiumGlobe { m.screenX = -1e9; m.screenY = -1e9; el.style.backgroundImage = `url("${m.normalUrl}")`; + el.style.transform = 'rotate(-45deg)'; + el.style.transformOrigin = `${m.tipX}px ${m.tipY}px`; this._markerLayer.appendChild(el); } @@ -462,13 +464,14 @@ export class CesiumGlobe { viewer.screenSpaceEventHandler.setInputAction((movement) => { const x = movement.position.x; const y = movement.position.y; + const canvasRect = viewer.canvas.getBoundingClientRect(); for (const m of this.markers) { - if (!m.el || m.el.style.display === 'none') continue; - const w = m.noteNormal.width; - const h = m.noteNormal.height; + const el = m.el; + if (!el || el.style.display === 'none') continue; + const r = el.getBoundingClientRect(); if ( - x >= m.screenX && x <= m.screenX + w && - y >= m.screenY && y <= m.screenY + h + x >= r.left - canvasRect.left && x <= r.right - canvasRect.left && + y >= r.top - canvasRect.top && y <= r.bottom - canvasRect.top ) { this.onPick?.(m.index); break;