页面分离修改
This commit is contained in:
@ -5,7 +5,7 @@
|
||||
import Dialog from '../../BaseDialog';
|
||||
import { html } from "./_element";
|
||||
import Tools from "../../Tools";
|
||||
import { closeRotateAround, closeViewFollow} from '../../Global/global'
|
||||
import { closeRotateAround, closeViewFollow } from '../../Global/global'
|
||||
let _DialogObject = null
|
||||
let clickHandler
|
||||
let repeat = 0
|
||||
@ -13,32 +13,33 @@ let currentRepeat = 0
|
||||
|
||||
|
||||
const open = async (sdk, options = {}, _Dialog = {}) => {
|
||||
let name = options.name || '漫游路径'
|
||||
let name = options.name || '飞线漫游'
|
||||
options.points || (options.points = [])
|
||||
if(options.repeat) {
|
||||
if (options.repeat) {
|
||||
repeat = Number(options.repeat)
|
||||
}
|
||||
let viewer = sdk.viewer
|
||||
let tools = new Tools(sdk)
|
||||
let active = 0
|
||||
|
||||
if (_DialogObject && _DialogObject.close) {
|
||||
_DialogObject.close()
|
||||
_DialogObject = null
|
||||
}
|
||||
// if (_DialogObject && _DialogObject.close) {
|
||||
// _DialogObject.close()
|
||||
// _DialogObject = null
|
||||
// }
|
||||
|
||||
_DialogObject = await new Dialog(viewer._container, {
|
||||
title: '飞行漫游', left: '180px', top: '100px',
|
||||
closeCallBack: () => {
|
||||
cease({ viewer })
|
||||
},
|
||||
})
|
||||
await _DialogObject.init()
|
||||
let contentElm = document.createElement('div');
|
||||
contentElm.className = 'fly-roam'
|
||||
contentElm.innerHTML = html()
|
||||
_DialogObject.contentAppChild(contentElm)
|
||||
// _DialogObject = await new Dialog(viewer._container, {
|
||||
// title: '飞行漫游', left: '180px', top: '100px',
|
||||
// closeCallBack: () => {
|
||||
// cease({ viewer })
|
||||
// },
|
||||
// })
|
||||
// await _DialogObject.init()
|
||||
// let contentElm = document.createElement('div');
|
||||
// contentElm.className = 'fly-roam'
|
||||
// contentElm.innerHTML = html()
|
||||
// _DialogObject.contentAppChild(contentElm)
|
||||
|
||||
let contentElm = document.getElementsByClassName('fly-roam')[0]
|
||||
let all_elm = contentElm.getElementsByTagName("*")
|
||||
// EventBinding(all_elm)
|
||||
|
||||
@ -84,15 +85,15 @@ const open = async (sdk, options = {}, _Dialog = {}) => {
|
||||
points.map((item) => {
|
||||
newPoints.push(item)
|
||||
})
|
||||
_Dialog.clickSavePath && _Dialog.clickSavePath(
|
||||
{
|
||||
name: name,
|
||||
points: newPoints,
|
||||
repeat: repeat+''
|
||||
}
|
||||
)
|
||||
// _Dialog.clickSavePath && _Dialog.clickSavePath(
|
||||
// {
|
||||
// name: name,
|
||||
// points: newPoints,
|
||||
// repeat: repeat + ''
|
||||
// }
|
||||
// )
|
||||
})
|
||||
_DialogObject.footAppChild(addListBtn)
|
||||
// _DialogObject.footAppChild(addListBtn)
|
||||
|
||||
let endBtn = contentElm.getElementsByClassName('cease')[0]
|
||||
endBtn.addEventListener('click', () => {
|
||||
@ -135,7 +136,7 @@ const open = async (sdk, options = {}, _Dialog = {}) => {
|
||||
pitch: viewer.camera.pitch,
|
||||
roll: viewer.camera.roll
|
||||
}
|
||||
tools.message({text: '操作成功'})
|
||||
tools.message({ text: '操作成功' })
|
||||
})
|
||||
|
||||
let totalTimeElm = contentElm.querySelector("input[name='totalTime']")
|
||||
@ -248,7 +249,7 @@ const open = async (sdk, options = {}, _Dialog = {}) => {
|
||||
for (let m = 0; m < trList.length; m++) {
|
||||
if (trList[m] === e_delete.parentNode.parentNode) {
|
||||
points.splice(m, 1)
|
||||
points[points.length-1] && (points[points.length-1].duration = 0)
|
||||
points[points.length - 1] && (points[points.length - 1].duration = 0)
|
||||
tableBody.removeChild(tr)
|
||||
if (active > m + 1) {
|
||||
active--
|
||||
@ -307,10 +308,20 @@ const open = async (sdk, options = {}, _Dialog = {}) => {
|
||||
}
|
||||
|
||||
const close = () => {
|
||||
if (_DialogObject && _DialogObject.close) {
|
||||
_DialogObject.close()
|
||||
_DialogObject = null
|
||||
// if (_DialogObject && _DialogObject.close) {
|
||||
// _DialogObject.close()
|
||||
// _DialogObject = null
|
||||
// }
|
||||
let contentElm = document.getElementsByClassName('fly-roam')[0]
|
||||
|
||||
let tableBody = contentElm.getElementsByClassName('table-body')[0];
|
||||
let trList = tableBody.getElementsByClassName('tr')
|
||||
for (let i = trList.length - 1; i >= 0; i--) {
|
||||
tableBody.removeChild(trList[i])
|
||||
}
|
||||
|
||||
repeat = 0
|
||||
currentRepeat = 0
|
||||
}
|
||||
|
||||
const executeFlyTo = (sdk, points = [], index = 0, noStart) => {
|
||||
@ -387,4 +398,4 @@ const cease = (sdk) => {
|
||||
}
|
||||
}
|
||||
|
||||
export { open, close, flyTo, setRepeat, cease }
|
||||
export { open, close, flyTo, setRepeat, cease }
|
||||
|
||||
Reference in New Issue
Block a user