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;