词条便签逆时针旋转45°(绕箭头尖),命中测试改用实际矩形
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user