test
This commit is contained in:
1 parent
cc23858c07
commit
5876d842c5
3 files changed
+8
-16
No files matched your search
+8
-3
@@ -264,8 +264,14 @@ onMounted(async () => {
|
||||
const terrainPosition = await getTerrainPosition(cartographic)
|
||||
// 直接创建Wayline实例,第一个创建的点就是航点
|
||||
window.wayline = new Wayline()
|
||||
// 将点击位置作为第一个航点
|
||||
window.wayline.createWayPoint(terrainPosition)
|
||||
// 将点击位置作为第一个航点,并添加初始高度
|
||||
const cartographicWithHeight = Cartographic.fromCartesian(terrainPosition)
|
||||
const elevatedPosition = Cartesian3.fromRadians(
|
||||
cartographicWithHeight.longitude,
|
||||
cartographicWithHeight.latitude,
|
||||
cartographicWithHeight.height + 120 // 使用120作为初始高度
|
||||
)
|
||||
window.wayline.createWayPoint(elevatedPosition)
|
||||
|
||||
// 不移除点击事件,因为用户可能需要创建多个航线
|
||||
}
|
||||
@@ -443,7 +449,6 @@ async function getTerrainPosition(cartographic: Cartographic) {
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="store.pointList.length === 0" class="empty-message">
|
||||
暂无航点,按空格键创建航点
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -14,7 +14,6 @@ export interface WayPointInfo {
|
||||
}
|
||||
|
||||
export type LensMode = 'wide' | 'zoom';
|
||||
export type WaylineMode = 'edit' | 'preview';
|
||||
|
||||
export const useStore = defineStore('main', {
|
||||
state: () => ({
|
||||
@@ -23,7 +22,6 @@ export const useStore = defineStore('main', {
|
||||
pointList: [] as WayPointInfo[],
|
||||
gimbalPitch: 0, // 云台俯仰角(度)
|
||||
yawAngle: 0, // 偏航角(度)
|
||||
waylineMode: 'edit' as WaylineMode
|
||||
}),
|
||||
actions: {
|
||||
updateZoomFactor(zoomFactor: number) {
|
||||
@@ -38,9 +36,6 @@ export const useStore = defineStore('main', {
|
||||
updateGimbalData(pitch: number, yaw: number) {
|
||||
this.gimbalPitch = pitch;
|
||||
this.yawAngle = yaw;
|
||||
},
|
||||
setWaylineMode(mode: WaylineMode) {
|
||||
this.waylineMode = mode;
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -144,7 +144,6 @@ export class Wayline {
|
||||
|
||||
const scene = viewer.scene
|
||||
handler.setInputAction((click: ScreenSpaceEventHandler.PositionedEvent) => {
|
||||
if (store.waylineMode === 'preview') return
|
||||
const object = scene.pick(click.position)
|
||||
if (object && object.id) {
|
||||
// 检查是否点击了高度调整按钮
|
||||
@@ -163,7 +162,6 @@ export class Wayline {
|
||||
}, ScreenSpaceEventType.LEFT_DOWN)
|
||||
|
||||
handler.setInputAction((click: ScreenSpaceEventHandler.PositionedEvent) => {
|
||||
if (store.waylineMode === 'preview') return
|
||||
const object = scene.pick(click.position)
|
||||
if (object && object.id && (object.id as any).wayPoint && (object.id as any).wayPoint.selected) {
|
||||
isLifting = true
|
||||
@@ -190,10 +188,6 @@ export class Wayline {
|
||||
}, ScreenSpaceEventType.LEFT_UP, KeyboardEventModifier.ALT)
|
||||
|
||||
handler.setInputAction((movement: ScreenSpaceEventHandler.MotionEvent) => {
|
||||
if (store.waylineMode === 'preview') {
|
||||
scene.canvas.style.cursor = 'default'
|
||||
return
|
||||
}
|
||||
const object = scene.pick(movement.endPosition)
|
||||
if (object && object.id) {
|
||||
if ((object.id as any).heightAdjustButton) {
|
||||
@@ -239,7 +233,6 @@ export class Wayline {
|
||||
}, ScreenSpaceEventType.MOUSE_MOVE)
|
||||
|
||||
handler.setInputAction((movement: ScreenSpaceEventHandler.MotionEvent) => {
|
||||
if (store.waylineMode === 'preview') return
|
||||
if (isLifting && draggingWayPoint) {
|
||||
const lngLat = Cartographic.fromCartesian(draggingWayPoint.position)
|
||||
|
||||
@@ -274,7 +267,6 @@ export class Wayline {
|
||||
|
||||
window.addEventListener('keydown', (event: KeyboardEvent) => {
|
||||
if (event.code === 'Space') {
|
||||
if (store.waylineMode === 'preview') return
|
||||
const position = minimapViewer.camera.position.clone()
|
||||
this.createWayPoint(position)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user