飞行漫游
This commit is contained in:
@ -18,6 +18,14 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
|
||||
if (options.repeat) {
|
||||
repeat = Number(options.repeat)
|
||||
}
|
||||
if (options.defaultTime) {
|
||||
let contentElm = document.getElementsByClassName('fly-roam')[0]
|
||||
contentElm.querySelector("input[name='defaultTime']").value = options.defaultTime
|
||||
}
|
||||
if (options.totalTime) {
|
||||
let contentElm = document.getElementsByClassName('fly-roam')[0]
|
||||
contentElm.querySelector("input[name='totalTime']").value = options.totalTime
|
||||
}
|
||||
let viewer = sdk.viewer
|
||||
let tools = new Tools(sdk)
|
||||
let active = 0
|
||||
@ -72,6 +80,23 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
|
||||
nameElm.value = name
|
||||
nameElm.addEventListener('input', () => {
|
||||
name = nameElm.value
|
||||
func({
|
||||
name: name,
|
||||
points: points,
|
||||
repeat: repeat + '',
|
||||
defaultTime: defaultTimeDom.value,
|
||||
totalTime: totalTimeElm.value
|
||||
})
|
||||
})
|
||||
let defaultTimeDom = contentElm.querySelector("input[name='defaultTime']")
|
||||
nameElm.addEventListener('input', () => {
|
||||
func({
|
||||
name: name,
|
||||
points: points,
|
||||
repeat: repeat + '',
|
||||
defaultTime: defaultTimeDom.value,
|
||||
totalTime: totalTimeElm.value
|
||||
})
|
||||
})
|
||||
|
||||
// let addListBtn = document.createElement('button');
|
||||
@ -90,7 +115,9 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
|
||||
func({
|
||||
name: name,
|
||||
points: newPoints,
|
||||
repeat: repeat + ''
|
||||
repeat: repeat + '',
|
||||
defaultTime: defaultTimeDom.value,
|
||||
totalTime: totalTimeElm.value
|
||||
})
|
||||
// _Dialog.clickSavePath && _Dialog.clickSavePath(
|
||||
// {
|
||||
@ -138,6 +165,14 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
|
||||
points.splice(active, 0, data)
|
||||
addTrElm(data)
|
||||
i++
|
||||
|
||||
func({
|
||||
name: name,
|
||||
points: points,
|
||||
repeat: repeat + '',
|
||||
defaultTime: defaultTimeDom.value,
|
||||
totalTime: totalTimeElm.value
|
||||
})
|
||||
})
|
||||
// let modifyBtn = contentElm.getElementsByClassName('modify-point')[0]
|
||||
// modifyBtn.addEventListener('click', () => {
|
||||
@ -184,6 +219,13 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
|
||||
}
|
||||
trList[trList.length - 1].querySelector("input[name='time']").value = 0
|
||||
}
|
||||
func({
|
||||
name: name,
|
||||
points: points,
|
||||
repeat: repeat + '',
|
||||
defaultTime: defaultTimeDom.value,
|
||||
totalTime: totalTimeElm.value
|
||||
})
|
||||
})
|
||||
repeatElm.checked = (repeat === Infinity ? true : false)
|
||||
repeatElm.addEventListener('change', () => {
|
||||
@ -194,6 +236,13 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
|
||||
repeat = 0
|
||||
}
|
||||
currentRepeat = repeat
|
||||
func({
|
||||
name: name,
|
||||
points: points,
|
||||
repeat: repeat + '',
|
||||
defaultTime: defaultTimeDom.value,
|
||||
totalTime: totalTimeElm.value
|
||||
})
|
||||
_Dialog.changeRepeatStateCallBack && _Dialog.changeRepeatStateCallBack(repeatElm.checked)
|
||||
})
|
||||
|
||||
@ -260,7 +309,7 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
|
||||
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) {
|
||||
if (trList[m] === e_delete.parentNode.parentNode.parentNode) {
|
||||
let position = tools.cartesian3Towgs84(viewer.camera.position, viewer)
|
||||
points[m].position = position
|
||||
points[m].orientation = {
|
||||
@ -277,14 +326,14 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
|
||||
|
||||
e_play.addEventListener('click', () => {
|
||||
for (let m = 0; m < trList.length; m++) {
|
||||
if (trList[m] === e_delete.parentNode.parentNode) {
|
||||
if (trList[m] === e_play.parentNode.parentNode.parentNode) {
|
||||
flyTo(sdk, points, m)
|
||||
}
|
||||
}
|
||||
})
|
||||
e_delete.addEventListener("click", (v) => {
|
||||
for (let m = 0; m < trList.length; m++) {
|
||||
if (trList[m] === e_delete.parentNode.parentNode) {
|
||||
if (trList[m] === e_delete.parentNode.parentNode.parentNode) {
|
||||
points.splice(m, 1)
|
||||
points[points.length - 1] && (points[points.length - 1].duration = 0)
|
||||
tableBody.removeChild(tr)
|
||||
@ -322,6 +371,14 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
|
||||
// if (trList.length > 0) {
|
||||
// trList[trList.length - 1].querySelector("input[name='time']").disabled = 'disabled'
|
||||
// }
|
||||
|
||||
func({
|
||||
name: name,
|
||||
points: points,
|
||||
repeat: repeat + '',
|
||||
defaultTime: defaultTimeDom.value,
|
||||
totalTime: totalTimeElm.value
|
||||
})
|
||||
})
|
||||
e_time.addEventListener('input', (v) => {
|
||||
isTotalTimeElm.checked = false
|
||||
|
||||
Reference in New Issue
Block a user