From a4edca57f0b183de1b0b9fc4e7386e21e2678b56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=8F=E5=A4=A7=E8=83=86?= <1101282782@qq.com> Date: Mon, 17 Nov 2025 12:01:34 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A3=9E=E8=A1=8C=E6=BC=AB=E6=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Global/FlyRoam/index.js | 47 ++++++++++++++++++++++------ src/Obj/Element/svg.js | 6 ++-- static/custom/img/icon-delete.svg | 1 + static/custom/img/icon-resetView.svg | 1 + 4 files changed, 42 insertions(+), 13 deletions(-) create mode 100644 static/custom/img/icon-delete.svg create mode 100644 static/custom/img/icon-resetView.svg diff --git a/src/Global/FlyRoam/index.js b/src/Global/FlyRoam/index.js index 24ecc9e..7dab5fc 100644 --- a/src/Global/FlyRoam/index.js +++ b/src/Global/FlyRoam/index.js @@ -117,7 +117,8 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => { let addBtn = contentElm.getElementsByClassName('add-point')[0] addBtn.addEventListener('click', () => { let position = tools.cartesian3Towgs84(viewer.camera.position, viewer) - let time = 0 + let defaultTime = Number(contentElm.querySelector("input[name='defaultTime']").value) + let time = points.length === active ? 0 : defaultTime let data = { duration: time, position: position, @@ -127,6 +128,13 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => { roll: viewer.camera.roll } } + if (points.length === active && active !== 0) { + points[points.length - 1].duration = defaultTime + + let trList = tableBody.getElementsByClassName('tr') + trList[points.length - 1].querySelector("input[name='time']").value = defaultTime + + } points.splice(active, 0, data) addTrElm(data) i++ @@ -147,11 +155,13 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => { // }) let totalTimeElm = contentElm.querySelector("input[name='totalTime']") - let isTotalTimeElm = contentElm.querySelector("input[name='isTotalTime']") + // let isTotalTimeElm = contentElm.querySelector("input[name='isTotalTime']") + let isTotalTimeElm = contentElm.getElementsByClassName('isTotalTime')[0] let repeatElm = contentElm.querySelector("input[name='repeat']") - isTotalTimeElm.addEventListener('change', () => { + isTotalTimeElm.addEventListener('click', () => { let trList = tableBody.getElementsByClassName('tr') - if (isTotalTimeElm.checked && trList.length > 0) { + // if (isTotalTimeElm.checked && trList.length > 0) { + if (trList.length > 0) { let time = Number((Number(totalTimeElm.value) / (trList.length - 1)).toFixed(2)) for (let i = 0; i < trList.length - 1; i++) { points[i].duration = time @@ -211,8 +221,9 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
- + +
` tr.addEventListener('click', (v) => { @@ -245,6 +256,25 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => { let e_play = tr.getElementsByClassName('play')[0] let e_delete = tr.getElementsByClassName('delete')[0] let e_time = tr.querySelector("input[name='time']") + + let modifyBtn = tr.getElementsByClassName('modify-point')[0] + modifyBtn.addEventListener('click', () => { + for (let m = 0; m < trList.length; m++) { + if (trList[m] === e_delete.parentNode.parentNode) { + let position = tools.cartesian3Towgs84(viewer.camera.position, viewer) + points[m].position = position + points[m].orientation = { + heading: viewer.camera.heading, + pitch: viewer.camera.pitch, + roll: viewer.camera.roll + } + tools.message({ text: '更新视角成功' }) + } + } + + + }) + e_play.addEventListener('click', () => { for (let m = 0; m < trList.length; m++) { if (trList[m] === e_delete.parentNode.parentNode) { @@ -294,13 +324,11 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => { // } }) e_time.addEventListener('input', (v) => { - console.log(isTotalTimeElm, 'isTotalTimeElm') isTotalTimeElm.checked = false data.duration = Number(e_time.value) if (data.duration < 0) { data.duration = 0 } - console.log(data.duration, 'duration') }) e_time.addEventListener('blur', () => { e_time.value = Number(Number(e_time.value).toFixed(2)) @@ -322,7 +350,7 @@ const close = () => { // _DialogObject = null // } let contentElm = document.getElementsByClassName('fly-roam')[0] - if(contentElm) { + if (contentElm) { let tableBody = contentElm.getElementsByClassName('table-body')[0]; let trList = tableBody.getElementsByClassName('tr') for (let i = trList.length - 1; i >= 0; i--) { @@ -335,7 +363,6 @@ const close = () => { } const executeFlyTo = (sdk, points = [], index = 0, noStart) => { - console.log(noStart, points, 'noStart') if (clickHandler) { clickHandler.destroy() } diff --git a/src/Obj/Element/svg.js b/src/Obj/Element/svg.js index 3580739..49aeeed 100644 --- a/src/Obj/Element/svg.js +++ b/src/Obj/Element/svg.js @@ -1,4 +1,4 @@ -let list = ['icon-py', 'icon-edit', 'icon-add', 'icon-add2', 'icon-minus', 'icon-play', 'icon-pause', 'icon-updateheight', 'icon-draw', 'icon-positions', 'icon-reset', 'icon-xj', 'icon-yj', 'icon-zj', 'icon-close', 'icon-query', 'icon-route', 'icon-copy', 'icon-load', 'icon-rubric', 'icon-pen', 'icon-cross', 'icom-confirm'] +let list = ['icon-py', 'icon-edit', 'icon-add', 'icon-add2', 'icon-minus', 'icon-play', 'icon-pause', 'icon-updateheight', 'icon-draw', 'icon-positions', 'icon-reset', 'icon-xj', 'icon-yj', 'icon-zj', 'icon-close', 'icon-query', 'icon-route', 'icon-copy', 'icon-load', 'icon-rubric', 'icon-pen', 'icon-cross', 'icom-confirm', 'icon-delete', 'icon-resetView'] function setSvg() { let svgElm = document.createElement('svg'); svgElm.xmlns = 'http://www.w3.org/2000/svg' @@ -14,7 +14,7 @@ function setSvg() { .then(r => r.text()) .then(b => { const xmlDoc = parser.parseFromString(b, 'text/xml').getElementsByTagName('svg')[0] - if(xmlDoc) { + if (xmlDoc) { xmlDoc.id = 'yj-' + name svgElm.appendChild(xmlDoc) } @@ -23,4 +23,4 @@ function setSvg() { } } -export { setSvg } \ No newline at end of file +export { setSvg } diff --git a/static/custom/img/icon-delete.svg b/static/custom/img/icon-delete.svg new file mode 100644 index 0000000..949eb06 --- /dev/null +++ b/static/custom/img/icon-delete.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/custom/img/icon-resetView.svg b/static/custom/img/icon-resetView.svg new file mode 100644 index 0000000..d094c5a --- /dev/null +++ b/static/custom/img/icon-resetView.svg @@ -0,0 +1 @@ + \ No newline at end of file