词条便签逆时针旋转45°(绕箭头尖),命中测试改用实际矩形
This commit is contained in:
@@ -418,6 +418,8 @@ export class CesiumGlobe {
|
|||||||
m.screenX = -1e9;
|
m.screenX = -1e9;
|
||||||
m.screenY = -1e9;
|
m.screenY = -1e9;
|
||||||
el.style.backgroundImage = `url("${m.normalUrl}")`;
|
el.style.backgroundImage = `url("${m.normalUrl}")`;
|
||||||
|
el.style.transform = 'rotate(-45deg)';
|
||||||
|
el.style.transformOrigin = `${m.tipX}px ${m.tipY}px`;
|
||||||
this._markerLayer.appendChild(el);
|
this._markerLayer.appendChild(el);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -462,13 +464,14 @@ export class CesiumGlobe {
|
|||||||
viewer.screenSpaceEventHandler.setInputAction((movement) => {
|
viewer.screenSpaceEventHandler.setInputAction((movement) => {
|
||||||
const x = movement.position.x;
|
const x = movement.position.x;
|
||||||
const y = movement.position.y;
|
const y = movement.position.y;
|
||||||
|
const canvasRect = viewer.canvas.getBoundingClientRect();
|
||||||
for (const m of this.markers) {
|
for (const m of this.markers) {
|
||||||
if (!m.el || m.el.style.display === 'none') continue;
|
const el = m.el;
|
||||||
const w = m.noteNormal.width;
|
if (!el || el.style.display === 'none') continue;
|
||||||
const h = m.noteNormal.height;
|
const r = el.getBoundingClientRect();
|
||||||
if (
|
if (
|
||||||
x >= m.screenX && x <= m.screenX + w &&
|
x >= r.left - canvasRect.left && x <= r.right - canvasRect.left &&
|
||||||
y >= m.screenY && y <= m.screenY + h
|
y >= r.top - canvasRect.top && y <= r.bottom - canvasRect.top
|
||||||
) {
|
) {
|
||||||
this.onPick?.(m.index);
|
this.onPick?.(m.index);
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user