feat: add map rotation controls (90° left/right/reset) in map visualization
This commit is contained in:
@@ -47,8 +47,18 @@
|
|||||||
<p v-if="mapMsg" class="hint">{% raw %}{{ mapMsg }}{% endraw %}</p>
|
<p v-if="mapMsg" class="hint">{% raw %}{{ mapMsg }}{% endraw %}</p>
|
||||||
</section>
|
</section>
|
||||||
<section class="card" v-if="mapLoaded" style="margin-top:16px">
|
<section class="card" v-if="mapLoaded" style="margin-top:16px">
|
||||||
|
<div style="display:flex;align-items:center;justify-content:space-between">
|
||||||
<h2>地图可视化</h2>
|
<h2>地图可视化</h2>
|
||||||
|
<div style="display:flex;gap:8px;align-items:center">
|
||||||
|
<span style="font-size:12px;color:#888">旋转:</span>
|
||||||
|
<button class="btn btn-secondary" style="padding:4px 10px;font-size:12px" @click="rotateMap(-90)">↶ 90°</button>
|
||||||
|
<button class="btn btn-secondary" style="padding:4px 10px;font-size:12px" @click="rotateMap(90)">↷ 90°</button>
|
||||||
|
<button class="btn btn-secondary" style="padding:4px 10px;font-size:12px" @click="mapRotation = 0">重置</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="map-container" style="position:relative;background:#111;border-radius:8px;overflow:hidden">
|
<div class="map-container" style="position:relative;background:#111;border-radius:8px;overflow:hidden">
|
||||||
|
<!-- 地图旋转 wrapper -->
|
||||||
|
<div :style="{ transform: 'rotate(' + mapRotation + 'deg)', transition: 'transform 0.3s ease' }">
|
||||||
<img :src="mapImageUrl" @error="onMapError" style="width:100%;display:block">
|
<img :src="mapImageUrl" @error="onMapError" style="width:100%;display:block">
|
||||||
<!-- 地图覆盖层:显示点位坐标 -->
|
<!-- 地图覆盖层:显示点位坐标 -->
|
||||||
<div class="map-overlay">
|
<div class="map-overlay">
|
||||||
@@ -60,6 +70,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ createApp({
|
|||||||
mapLoaded: false,
|
mapLoaded: false,
|
||||||
mapImageUrl: '',
|
mapImageUrl: '',
|
||||||
mapMeta: null,
|
mapMeta: null,
|
||||||
|
mapRotation: 0,
|
||||||
// 点位
|
// 点位
|
||||||
points: [],
|
points: [],
|
||||||
newPointName: '',
|
newPointName: '',
|
||||||
@@ -110,6 +111,9 @@ createApp({
|
|||||||
onMapError() {
|
onMapError() {
|
||||||
this.mapMsg = '❌ 地图图像加载失败'
|
this.mapMsg = '❌ 地图图像加载失败'
|
||||||
},
|
},
|
||||||
|
rotateMap(deg) {
|
||||||
|
this.mapRotation = (this.mapRotation + deg) % 360
|
||||||
|
},
|
||||||
getMapX(coords) {
|
getMapX(coords) {
|
||||||
if (!coords || !this.mapMeta) return 50
|
if (!coords || !this.mapMeta) return 50
|
||||||
const [x, y, yaw] = coords
|
const [x, y, yaw] = coords
|
||||||
|
|||||||
Reference in New Issue
Block a user