feat: add iframe camera postMessage for view switching (长地轨/短地轨/关节)
This commit is contained in:
@@ -38,7 +38,7 @@
|
||||
<div class="rightLine"></div>
|
||||
|
||||
<div class="main-content">
|
||||
<iframe v-if="iframeAddress" allowtransparency="true" class="model-bg-frame" :src="iframeAddress" title="三维模型"></iframe>
|
||||
<iframe id="dmtIframe" v-if="iframeAddress" allowtransparency="true" class="model-bg-frame" :src="iframeAddress" title="三维模型"></iframe>
|
||||
<div v-else class="model-placeholder">等待配置三维模型地址</div>
|
||||
|
||||
<div class="left-box">
|
||||
@@ -270,6 +270,23 @@ export default {
|
||||
{ label: '短地轨视角', value: 'shortRail' },
|
||||
{ label: '关节视角', value: 'joint' }
|
||||
],
|
||||
cameraViews: {
|
||||
longRail: {
|
||||
target: { x: -5.725619423653396, y: 1.559219531820475, z: -5.23360272959924 },
|
||||
position: { x: -15.805974184853365, y: 1.6199255013441012, z: 10.689003987116454 },
|
||||
zoom0: 1
|
||||
},
|
||||
shortRail: {
|
||||
target: { x: -5.814177085428968, y: 16.255194514605996, z: -5.3456965650308055 },
|
||||
position: { x: -15.390514108568938, y: 16.312865185653482, z: 9.780779815848938 },
|
||||
zoom0: 1
|
||||
},
|
||||
joint: {
|
||||
target: { x: 2.7622940494890424, y: 15.83905572715569, z: 0.08552052688719107 },
|
||||
position: { x: -3.2731867066688367, y: 15.875402633541817, z: 9.618973337149745 },
|
||||
zoom0: 1
|
||||
}
|
||||
},
|
||||
lineMonitorRows: [
|
||||
{
|
||||
name: '长地轨',
|
||||
@@ -518,6 +535,18 @@ export default {
|
||||
},
|
||||
changeView(value) {
|
||||
this.activeView = value
|
||||
const camera = this.cameraViews[value]
|
||||
if (!camera) return
|
||||
const iframe = document.getElementById('dmtIframe')
|
||||
if (!iframe || !iframe.contentWindow) return
|
||||
iframe.contentWindow.postMessage({
|
||||
type: 'set_camera',
|
||||
data: {
|
||||
target: camera.target,
|
||||
position: camera.position,
|
||||
zoom0: camera.zoom0
|
||||
}
|
||||
}, '*')
|
||||
},
|
||||
initAlarmPieChart() {
|
||||
if (!this.$refs.alarmPieChart) {
|
||||
|
||||
Reference in New Issue
Block a user