Compare commits
17 Commits
838f39ba40
...
d1dd920fd2
Author | SHA1 | Date | |
---|---|---|---|
d1dd920fd2 | |||
a69034a18e | |||
7fc4f14756 | |||
feff8c3a76 | |||
58b8c6a897 | |||
349c91f8df | |||
92ef4a68fd | |||
623a220cbf | |||
e8258d96d0 | |||
d0a682f233 | |||
65441ddff4 | |||
7f3b04eb08 | |||
9289d08f24 | |||
f9a3ffb359 | |||
f5d915bd58 | |||
91cc200917 | |||
0c4c956868 |
@ -101,6 +101,7 @@ function getFlagFromKeyboard(key) {
|
|||||||
*/
|
*/
|
||||||
function keyDown(event) {
|
function keyDown(event) {
|
||||||
let _viewer = this
|
let _viewer = this
|
||||||
|
|
||||||
// 判断是否有输入框聚焦
|
// 判断是否有输入框聚焦
|
||||||
function isInputFocused() {
|
function isInputFocused() {
|
||||||
const activeElement = document.activeElement;
|
const activeElement = document.activeElement;
|
||||||
@ -164,32 +165,51 @@ function keyUp(event) {
|
|||||||
* @return {*}
|
* @return {*}
|
||||||
*/
|
*/
|
||||||
function keyboardMapRoamingRender(_viewer) {
|
function keyboardMapRoamingRender(_viewer) {
|
||||||
if(!_viewer.scene.screenSpaceCameraController.enableTilt) {
|
if(!_viewer || !_viewer.scene || !_viewer.scene.screenSpaceCameraController.enableTilt) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let camera = _viewer.camera;
|
let camera = _viewer.camera;
|
||||||
let ellipsoid = _viewer.scene.globe.ellipsoid;
|
let ellipsoid = _viewer.scene.globe.ellipsoid;
|
||||||
let cameraHeight = ellipsoid.cartesianToCartographic(camera.position).height;
|
let cameraHeight = ellipsoid.cartesianToCartographic(camera.position).height;
|
||||||
|
let cameraHeight2 = camera.positionCartographic.height;
|
||||||
|
|
||||||
|
|
||||||
// 根据相机高度设置移动距离,比默认距离移动效果更好
|
// 根据相机高度设置移动距离,比默认距离移动效果更好
|
||||||
let moveRate = cameraHeight / 20.0;
|
let moveRate = cameraHeight / 20.0;
|
||||||
let rotationRate = moveRate / 500000 / Cesium.Math.toDegrees(camera.pitch);
|
let rotationRate = moveRate / 500000 / Cesium.Math.toDegrees(camera.pitch);
|
||||||
|
let moveRate2 = cameraHeight2 / 100.0;
|
||||||
|
|
||||||
if (flags.moveForward) {
|
if (flags.moveForward) {
|
||||||
// camera.moveForward(moveRate);
|
if(_viewer.scene.mode == 2) {
|
||||||
camera.rotate(camera.right, -rotationRate);
|
camera.moveUp(moveRate2);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
camera.rotate(camera.right, -rotationRate);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (flags.moveBackward) {
|
if (flags.moveBackward) {
|
||||||
// camera.moveBackward(moveRate);
|
if(_viewer.scene.mode == 2) {
|
||||||
camera.rotate(camera.right, rotationRate);
|
camera.moveDown(moveRate2);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
camera.rotate(camera.right, rotationRate);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (flags.moveLeft) {
|
if (flags.moveLeft) {
|
||||||
// camera.moveLeft(moveRate);
|
if(_viewer.scene.mode == 2) {
|
||||||
camera.rotate(camera.up, -rotationRate);
|
camera.moveLeft(moveRate2);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
camera.rotate(camera.up, -rotationRate);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (flags.moveRight) {
|
if (flags.moveRight) {
|
||||||
// camera.moveRight(moveRate);
|
if(_viewer.scene.mode == 2) {
|
||||||
camera.rotate(camera.up, rotationRate);
|
camera.moveRight(moveRate2);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
camera.rotate(camera.up, rotationRate);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (flags.moveUp) {
|
if (flags.moveUp) {
|
||||||
camera.moveUp(moveRate);
|
camera.moveUp(moveRate);
|
||||||
|
@ -157,7 +157,12 @@ async function syncData2(sdk, id, entityId) {
|
|||||||
if (that.showView == 3) {
|
if (that.showView == 3) {
|
||||||
options.show = false
|
options.show = false
|
||||||
}
|
}
|
||||||
let newObject = await new that.constructor(sdk2D, options)
|
let callback
|
||||||
|
if(that.type === 'TextBox') {
|
||||||
|
callback = that.callback
|
||||||
|
}
|
||||||
|
|
||||||
|
let newObject = await new that.constructor(sdk2D, options, callback)
|
||||||
newObject.onClick = that.onClick
|
newObject.onClick = that.onClick
|
||||||
newObject.onRightClick = that.onRightClick
|
newObject.onRightClick = that.onRightClick
|
||||||
newObject.onMouseMove = that.onMouseMove
|
newObject.onMouseMove = that.onMouseMove
|
||||||
@ -252,7 +257,11 @@ async function syncData2(sdk, id, entityId) {
|
|||||||
if(target) {
|
if(target) {
|
||||||
await target.remove()
|
await target.remove()
|
||||||
}
|
}
|
||||||
target = await new obj.constructor(sdk2D, options)
|
let callback
|
||||||
|
if(obj.type === 'TextBox') {
|
||||||
|
callback = obj.callback
|
||||||
|
}
|
||||||
|
target = await new obj.constructor(sdk2D, options, callback)
|
||||||
target.onClick = obj.onClick
|
target.onClick = obj.onClick
|
||||||
target.onRightClick = obj.onRightClick
|
target.onRightClick = obj.onRightClick
|
||||||
target.onMouseMove = obj.onMouseMove
|
target.onMouseMove = obj.onMouseMove
|
||||||
|
@ -102,11 +102,20 @@ function off() {
|
|||||||
let leftCanvas = leftBox.getElementsByTagName('canvas')[0]
|
let leftCanvas = leftBox.getElementsByTagName('canvas')[0]
|
||||||
leftBox.style.width = '100%'
|
leftBox.style.width = '100%'
|
||||||
leftCanvas.style.width = '100%'
|
leftCanvas.style.width = '100%'
|
||||||
|
let billboardAttributeBoxs = sdkP.viewer._element.getElementsByClassName('billboard-attribute-box')
|
||||||
|
for (let i = 0; i < billboardAttributeBoxs.length; i++) {
|
||||||
|
billboardAttributeBoxs[i].style.display = 'block'
|
||||||
|
}
|
||||||
sdkP = null
|
sdkP = null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async function init(sdk) {
|
async function init(sdk) {
|
||||||
|
let billboardAttributeBoxs = sdk.viewer._element.getElementsByClassName('billboard-attribute-box')
|
||||||
|
for (let i = 0; i < billboardAttributeBoxs.length; i++) {
|
||||||
|
billboardAttributeBoxs[i].style.display = 'none'
|
||||||
|
}
|
||||||
|
|
||||||
sdk.entityMap.forEach((item, key) => {
|
sdk.entityMap.forEach((item, key) => {
|
||||||
if (item.type && item.type == 'TrajectoryMotion' && item.viewFollow) {
|
if (item.type && item.type == 'TrajectoryMotion' && item.viewFollow) {
|
||||||
item.viewFollow = false
|
item.viewFollow = false
|
||||||
@ -137,10 +146,8 @@ async function init(sdk) {
|
|||||||
rightElm.style.position = 'absolute'
|
rightElm.style.position = 'absolute'
|
||||||
rightElm.style.right = 'calc(50% - 50px)'
|
rightElm.style.right = 'calc(50% - 50px)'
|
||||||
|
|
||||||
if (!activeIds || activeIds.length == 0) {
|
leftElm.style.display = 'none'
|
||||||
leftElm.style.display = 'none'
|
rightElm.style.display = 'none'
|
||||||
rightElm.style.display = 'none'
|
|
||||||
}
|
|
||||||
|
|
||||||
sdk.viewer._element.appendChild(leftElm)
|
sdk.viewer._element.appendChild(leftElm)
|
||||||
sdk.viewer._element.appendChild(rightElm)
|
sdk.viewer._element.appendChild(rightElm)
|
||||||
@ -149,6 +156,12 @@ async function init(sdk) {
|
|||||||
let right = 0
|
let right = 0
|
||||||
if (activeIds) {
|
if (activeIds) {
|
||||||
for (let i = 0; i < activeIds.length; i++) {
|
for (let i = 0; i < activeIds.length; i++) {
|
||||||
|
let thatP = sdk.entityMap.get(activeIds[i])
|
||||||
|
if (!thatP || (thatP.type === 'terrain' || !thatP.show) || thatP.type === 'TextBox') {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
leftElm.style.display = 'unset'
|
||||||
|
rightElm.style.display = 'unset'
|
||||||
let status = statusMap.get(activeIds[i])
|
let status = statusMap.get(activeIds[i])
|
||||||
if (status) {
|
if (status) {
|
||||||
if (status.P) {
|
if (status.P) {
|
||||||
@ -911,7 +924,7 @@ async function setSplitDirection(v, id, isoff = false, entityId) {
|
|||||||
}
|
}
|
||||||
if (thatP.type === 'GroundSvg' && thatP.text) {
|
if (thatP.type === 'GroundSvg' && thatP.text) {
|
||||||
thatP.text.show = thatP.textShow
|
thatP.text.show = thatP.textShow
|
||||||
target.textShow = false
|
target && (target.textShow = false)
|
||||||
}
|
}
|
||||||
if (thatP.label && thatP.labelShow) {
|
if (thatP.label && thatP.labelShow) {
|
||||||
thatP.label.entity.show = true
|
thatP.label.entity.show = true
|
||||||
@ -1281,6 +1294,8 @@ function setActiveId(ids = []) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (leftElm && rightElm) {
|
if (leftElm && rightElm) {
|
||||||
|
leftElm.style.display = 'none'
|
||||||
|
rightElm.style.display = 'none'
|
||||||
let left = 0
|
let left = 0
|
||||||
let right = 0
|
let right = 0
|
||||||
for (let i = 0; i < activeIds.length; i++) {
|
for (let i = 0; i < activeIds.length; i++) {
|
||||||
@ -1298,10 +1313,8 @@ function setActiveId(ids = []) {
|
|||||||
|
|
||||||
|
|
||||||
let thatP = sdkP.entityMap.get(activeIds[i])
|
let thatP = sdkP.entityMap.get(activeIds[i])
|
||||||
let thatD = sdkD.entityMap.get(activeIds[i])
|
// let thatD = sdkD.entityMap.get(activeIds[i])
|
||||||
if (!thatP || (thatP.type === 'terrain' || !thatP.show)) {
|
if (!thatP || (thatP.type === 'terrain' || !thatP.show) || thatP.type === 'TextBox') {
|
||||||
leftElm.style.display = 'none'
|
|
||||||
rightElm.style.display = 'none'
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
leftElm.style.display = 'unset'
|
leftElm.style.display = 'unset'
|
||||||
|
@ -38,7 +38,7 @@ class BatchModel extends Base {
|
|||||||
this.options.name = options.name || '批量模型'
|
this.options.name = options.name || '批量模型'
|
||||||
this.options.type = options.type || '面'
|
this.options.type = options.type || '面'
|
||||||
this.options.url = options.url || ''
|
this.options.url = options.url || ''
|
||||||
this.options.spacing = options.spacing || 50
|
this.options.spacing = options.spacing * 1 || 50
|
||||||
this.options.positions = options.positions || []
|
this.options.positions = options.positions || []
|
||||||
this.options.show = (options.show || options.show === false) ? options.show : true
|
this.options.show = (options.show || options.show === false) ? options.show : true
|
||||||
this.callback = callback
|
this.callback = callback
|
||||||
@ -50,6 +50,10 @@ class BatchModel extends Base {
|
|||||||
let tools = new Tools(sdk)
|
let tools = new Tools(sdk)
|
||||||
// BatchModel.computeDis(this)
|
// BatchModel.computeDis(this)
|
||||||
// if (this.options.positions.length > 0 || this.options.positions.lng) {
|
// if (this.options.positions.length > 0 || this.options.positions.lng) {
|
||||||
|
if (this.options.spacing < 0 || options.spacing * 1 === 0) {
|
||||||
|
tools.message({ type: 'warning', text: '请输入正确的间距!' })
|
||||||
|
return;
|
||||||
|
}
|
||||||
if ((options.type && options.spacing != undefined) || options.type == '点') {
|
if ((options.type && options.spacing != undefined) || options.type == '点') {
|
||||||
// BatchModel.computeDis(this)
|
// BatchModel.computeDis(this)
|
||||||
|
|
||||||
@ -76,8 +80,8 @@ class BatchModel extends Base {
|
|||||||
})
|
})
|
||||||
let dis1 = Cesium.Cartesian3.distance(posi[0], posi[1])
|
let dis1 = Cesium.Cartesian3.distance(posi[0], posi[1])
|
||||||
let dis2 = Cesium.Cartesian3.distance(posi[1], posi[2])
|
let dis2 = Cesium.Cartesian3.distance(posi[1], posi[2])
|
||||||
let num1 = dis1 / options.spacing
|
let num1 = dis1 / this.options.spacing
|
||||||
let num2 = dis2 / options.spacing
|
let num2 = dis2 / this.options.spacing
|
||||||
if (num1 * num2 > 100) {
|
if (num1 * num2 > 100) {
|
||||||
tools.message({ type: 'warning', text: '数量大于100,请重新绘制' })
|
tools.message({ type: 'warning', text: '数量大于100,请重新绘制' })
|
||||||
return;
|
return;
|
||||||
@ -90,7 +94,7 @@ class BatchModel extends Base {
|
|||||||
for (let i = 0; i < posi.length - 2; i++) {
|
for (let i = 0; i < posi.length - 2; i++) {
|
||||||
dis += Cesium.Cartesian3.distance(posi[i], posi[i + 1])
|
dis += Cesium.Cartesian3.distance(posi[i], posi[i + 1])
|
||||||
}
|
}
|
||||||
if (dis / options.spacing > 100) {
|
if (dis / this.options.spacing > 100) {
|
||||||
tools.message({ type: 'warning', text: '数量大于100,请重新绘制' })
|
tools.message({ type: 'warning', text: '数量大于100,请重新绘制' })
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,8 @@ import MouseTip from '../../../MouseTip'
|
|||||||
import {
|
import {
|
||||||
setSplitDirection,
|
setSplitDirection,
|
||||||
syncSplitData,
|
syncSplitData,
|
||||||
setActiveId
|
setActiveId,
|
||||||
|
getState
|
||||||
} from '../../../Global/SplitScreen'
|
} from '../../../Global/SplitScreen'
|
||||||
import {
|
import {
|
||||||
setActiveViewer,
|
setActiveViewer,
|
||||||
@ -197,7 +198,9 @@ class BillboardObject extends Base {
|
|||||||
|
|
||||||
this.#_destroyMouseEvent = () => {
|
this.#_destroyMouseEvent = () => {
|
||||||
this.attributeElm && (this.attributeElm.style.pointerEvents = 'unset')
|
this.attributeElm && (this.attributeElm.style.pointerEvents = 'unset')
|
||||||
this.sdk.viewer._element.onmousemove = null
|
if(this.sdk && this.sdk.viewer && this.sdk.viewer._element) {
|
||||||
|
this.sdk.viewer._element.onmousemove = null
|
||||||
|
}
|
||||||
document.removeEventListener('mouseup', this.#_destroyMouseEvent)
|
document.removeEventListener('mouseup', this.#_destroyMouseEvent)
|
||||||
document.removeEventListener('mouseleave', this.#_destroyMouseEvent)
|
document.removeEventListener('mouseleave', this.#_destroyMouseEvent)
|
||||||
}
|
}
|
||||||
@ -2943,6 +2946,9 @@ class BillboardObject extends Base {
|
|||||||
attributeElm.style.left = '0px'
|
attributeElm.style.left = '0px'
|
||||||
attributeElm.style.width = 0
|
attributeElm.style.width = 0
|
||||||
attributeElm.style.height = 0
|
attributeElm.style.height = 0
|
||||||
|
if(getState()) {
|
||||||
|
attributeElm.style.display = 'none'
|
||||||
|
}
|
||||||
// attributeElm.innerHTML = this.options.richTextContent
|
// attributeElm.innerHTML = this.options.richTextContent
|
||||||
this.sdk.viewer._element.appendChild(attributeElm)
|
this.sdk.viewer._element.appendChild(attributeElm)
|
||||||
let linkHtml = ''
|
let linkHtml = ''
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
* 文本框
|
* 文本框
|
||||||
*/
|
*/
|
||||||
import Base from "../index";
|
import Base from "../index";
|
||||||
|
import { syncData, getSdk } from '../../../Global/MultiViewportMode'
|
||||||
import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../Global/global'
|
import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../Global/global'
|
||||||
class TextBox extends Base {
|
class TextBox extends Base {
|
||||||
/**
|
/**
|
||||||
@ -29,7 +30,15 @@ class TextBox extends Base {
|
|||||||
this.textDom = undefined
|
this.textDom = undefined
|
||||||
this.create(this)
|
this.create(this)
|
||||||
this.sdk.addIncetance(this.options.id, this)
|
this.sdk.addIncetance(this.options.id, this)
|
||||||
|
|
||||||
this.callback = callback
|
this.callback = callback
|
||||||
|
|
||||||
|
// syncData(this.sdk, this.options.id)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
get type() {
|
||||||
|
return 'TextBox'
|
||||||
}
|
}
|
||||||
|
|
||||||
async create(that) {
|
async create(that) {
|
||||||
@ -38,6 +47,7 @@ class TextBox extends Base {
|
|||||||
let dom = document.createElement('span');
|
let dom = document.createElement('span');
|
||||||
dom.id = that.options.id
|
dom.id = that.options.id
|
||||||
dom.className = 'popup-textarea'
|
dom.className = 'popup-textarea'
|
||||||
|
dom.style.zIndex = 1
|
||||||
// 创建textarea元素
|
// 创建textarea元素
|
||||||
var textarea = document.createElement('textarea');
|
var textarea = document.createElement('textarea');
|
||||||
textarea.className = 'textarea'
|
textarea.className = 'textarea'
|
||||||
@ -125,10 +135,46 @@ class TextBox extends Base {
|
|||||||
async getwords(words) {
|
async getwords(words) {
|
||||||
this.options.text = words
|
this.options.text = words
|
||||||
this.callback(this.options)
|
this.callback(this.options)
|
||||||
|
let { sdkP } = getSdk()
|
||||||
|
if (this.sdk === sdkP && sdkP) {//三维
|
||||||
|
syncData(this.sdk, this.options.id)
|
||||||
|
}
|
||||||
|
else if (sdkP) {//二维
|
||||||
|
sdkP.entityMap.get(this.options.id).text = words
|
||||||
|
sdkP.entityMap.get(this.options.id).twoToThree(this.options.position)
|
||||||
|
} else if (!sdkP) {
|
||||||
|
syncData(this.sdk, this.options.id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async twoToThree(position) {
|
||||||
|
let that = this
|
||||||
|
that.sdk.viewer.scene.postRender.removeEventListener(that.handler);
|
||||||
|
let posi = Cesium.Cartesian3.fromDegrees(position.lng, position.lat, position.alt)
|
||||||
|
|
||||||
|
that.handler = function () {
|
||||||
|
const position = Cesium.SceneTransforms.wgs84ToWindowCoordinates(
|
||||||
|
that.sdk.viewer.scene, posi
|
||||||
|
);
|
||||||
|
if (position) {
|
||||||
|
let width = that.textDom.clientWidth * 1
|
||||||
|
let height = that.textDom.clientHeight * 1
|
||||||
|
that.textDom.style.left = `${position.x - width / 2}px`;
|
||||||
|
that.textDom.style.top = `${position.y - height}px`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
that.sdk.viewer.scene.postRender.addEventListener(that.handler);
|
||||||
}
|
}
|
||||||
async returnFun() {
|
async returnFun() {
|
||||||
return this.handler
|
return this.handler
|
||||||
}
|
}
|
||||||
|
get text() {
|
||||||
|
return this.options.text
|
||||||
|
}
|
||||||
|
set text(val) {
|
||||||
|
this.options.text = val
|
||||||
|
this.textDom.querySelector('textarea').value = val
|
||||||
|
this.callback(this.options)
|
||||||
|
}
|
||||||
get onClick() {
|
get onClick() {
|
||||||
return this.clickCallBack
|
return this.clickCallBack
|
||||||
}
|
}
|
||||||
@ -145,6 +191,7 @@ class TextBox extends Base {
|
|||||||
set show(v) {
|
set show(v) {
|
||||||
this.options.show = v
|
this.options.show = v
|
||||||
this.textDom && (this.textDom.style.display = v ? 'block' : 'none');
|
this.textDom && (this.textDom.style.display = v ? 'block' : 'none');
|
||||||
|
syncData(this.sdk, this.options.id)
|
||||||
}
|
}
|
||||||
get position() {
|
get position() {
|
||||||
return this.options.position
|
return this.options.position
|
||||||
@ -235,6 +282,7 @@ class TextBox extends Base {
|
|||||||
if (this.textDom && this.textDom.parentNode) {
|
if (this.textDom && this.textDom.parentNode) {
|
||||||
this.sdk.viewer.cesiumWidget.container.removeChild(this.textDom);
|
this.sdk.viewer.cesiumWidget.container.removeChild(this.textDom);
|
||||||
}
|
}
|
||||||
|
await this.sdk.removeIncetance(this.options.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
flicker() { }
|
flicker() { }
|
||||||
|
@ -137,7 +137,7 @@ class Base extends Tools {
|
|||||||
this.originalOptions.show = v
|
this.originalOptions.show = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.entity._showView = this.showView
|
this.entity && (this.entity._showView = this.showView)
|
||||||
if (this.type == 'layer') {
|
if (this.type == 'layer') {
|
||||||
if (this.entity) {
|
if (this.entity) {
|
||||||
this.entity._objectState = this.options.show
|
this.entity._objectState = this.options.show
|
||||||
|
@ -100,7 +100,7 @@ function attributeElm(that) {
|
|||||||
let tr = `
|
let tr = `
|
||||||
<div class="tr">
|
<div class="tr">
|
||||||
<div class="td">
|
<div class="td">
|
||||||
<input type="checkbox" value="${'ID' in data.data.list[i] ? data.data.list[i].ID : data.data.list[i].id}">
|
<input type="checkbox" value="${data.data.list[i].deviceId}">
|
||||||
<span>绑定</span>
|
<span>绑定</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="td">${data.data.list[i].cameraName}</div>
|
<div class="td">${data.data.list[i].cameraName}</div>
|
||||||
@ -126,11 +126,8 @@ function attributeElm(that) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
let newArray = that.attributeCamera.filter((item) => {
|
let newArray = that.attributeCamera.filter((item) => {
|
||||||
if ('ID' in data.data.list[i]) {
|
if ('deviceId' in data.data.list[i]) {
|
||||||
return item.ID !== data.data.list[i].ID
|
return item.deviceId !== data.data.list[i].deviceId
|
||||||
}
|
|
||||||
else {
|
|
||||||
return item.id !== data.data.list[i].id
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
that.attributeCamera = newArray
|
that.attributeCamera = newArray
|
||||||
@ -139,7 +136,7 @@ function attributeElm(that) {
|
|||||||
tableContent.appendChild(trElm)
|
tableContent.appendChild(trElm)
|
||||||
|
|
||||||
for (let m = 0; m < that.attributeCamera.length; m++) {
|
for (let m = 0; m < that.attributeCamera.length; m++) {
|
||||||
if (('ID' in data.data.list[i]) ? (that.attributeCamera[m].ID === data.data.list[i].ID) : (that.attributeCamera[m].id === data.data.list[i].id)) {
|
if (('deviceId' in data.data.list[i]) ? (that.attributeCamera[m].deviceId === data.data.list[i].deviceId):false) {
|
||||||
checkbox.checked = true
|
checkbox.checked = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -200,17 +197,9 @@ function attributeElm(that) {
|
|||||||
for (let i = that.attributeCamera.length - 1; i >= 0; i--) {
|
for (let i = that.attributeCamera.length - 1; i >= 0; i--) {
|
||||||
let flag = false
|
let flag = false
|
||||||
for (let m = 0; m < data.data.list.length; m++) {
|
for (let m = 0; m < data.data.list.length; m++) {
|
||||||
if ('ID' in data.data.list[m]) {
|
if (that.attributeCamera[i].deviceId === data.data.list[m].deviceId) {
|
||||||
if (that.attributeCamera[i].ID === data.data.list[m].ID) {
|
flag = true
|
||||||
flag = true
|
break
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ('id' in data.data.list[m]) {
|
|
||||||
if (that.attributeCamera[i].id === data.data.list[m].id) {
|
|
||||||
flag = true
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!flag) {
|
if (!flag) {
|
||||||
|
@ -10,6 +10,7 @@ import AModelLoader from '../Obj/Base/LoadObjModel/AModelLoader'
|
|||||||
import { setSvg } from '../Obj/Element/svg'
|
import { setSvg } from '../Obj/Element/svg'
|
||||||
import Tools from '../Tools'
|
import Tools from '../Tools'
|
||||||
import { Proj } from '../Tools/proj'
|
import { Proj } from '../Tools/proj'
|
||||||
|
import { syncData, getSdk } from '../Global/MultiViewportMode'
|
||||||
import {
|
import {
|
||||||
unRegLeftClickCallback,
|
unRegLeftClickCallback,
|
||||||
unRegRightClickCallback,
|
unRegRightClickCallback,
|
||||||
@ -419,7 +420,8 @@ class YJEarth {
|
|||||||
|
|
||||||
let ClickHandler = new Cesium.ScreenSpaceEventHandler(_this.viewer.canvas)
|
let ClickHandler = new Cesium.ScreenSpaceEventHandler(_this.viewer.canvas)
|
||||||
ClickHandler.setInputAction((movement) => {
|
ClickHandler.setInputAction((movement) => {
|
||||||
let textList = document.getElementsByClassName('popup-textarea')
|
// let textList = document.getElementsByClassName('popup-textarea')
|
||||||
|
let textList = _this.viewer._element.getElementsByClassName('popup-textarea')
|
||||||
_this.isLeftClick = false
|
_this.isLeftClick = false
|
||||||
for (let i = textList.length - 1; i > -1; i--) {
|
for (let i = textList.length - 1; i > -1; i--) {
|
||||||
let left = returnNumber(textList[i].style.left)
|
let left = returnNumber(textList[i].style.left)
|
||||||
@ -431,12 +433,20 @@ class YJEarth {
|
|||||||
if (x > left && x < left + width && y > top && y < top + height) {
|
if (x > left && x < left + width && y > top && y < top + height) {
|
||||||
if (_this.clickTextDom) {
|
if (_this.clickTextDom) {
|
||||||
_this.clickTextDom.style['pointer-events'] = 'none'
|
_this.clickTextDom.style['pointer-events'] = 'none'
|
||||||
|
_this.clickTextDom.querySelector('textarea').removeEventListener('blur', _this.blurFun)
|
||||||
}
|
}
|
||||||
|
|
||||||
_this.clickTextDom = textList[i]
|
_this.clickTextDom = textList[i]
|
||||||
textList[i].style['pointer-events'] = 'all'
|
textList[i].style['pointer-events'] = 'all'
|
||||||
textList[i].querySelector('textarea').focus()
|
textList[i].querySelector('textarea').focus()
|
||||||
_this.isLeftClick = true
|
_this.isLeftClick = true
|
||||||
_this.entityMap.get(_this.clickTextDom.id).isClick(movement.position, _this.clickTextDom.id)
|
_this.entityMap.get(_this.clickTextDom.id).isClick(movement.position, _this.clickTextDom.id)
|
||||||
|
|
||||||
|
_this.blurFun = () => {
|
||||||
|
_this.entityMap.get(_this.clickTextDom.id).isClick((movement && movement.position) || null, _this.clickTextDom.id)
|
||||||
|
_this.entityMap.get(_this.clickTextDom.id).getwords(_this.clickTextDom.getElementsByTagName('textarea')[0].value)
|
||||||
|
}
|
||||||
|
_this.clickTextDom.querySelector('textarea').addEventListener('blur', _this.blurFun)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -467,6 +477,11 @@ class YJEarth {
|
|||||||
x: e.clientX - layerX + width / 2,
|
x: e.clientX - layerX + width / 2,
|
||||||
y: e.clientY - layerY + height,
|
y: e.clientY - layerY + height,
|
||||||
}
|
}
|
||||||
|
let { sdkP } = getSdk()
|
||||||
|
if (_this != sdkP && sdkP) {//二维
|
||||||
|
let num = sdkP.viewer._element.clientWidth
|
||||||
|
param.x = param.x - num
|
||||||
|
}
|
||||||
_this.entityMap.get(_this.clickTextDom.id).setHandeler(param)
|
_this.entityMap.get(_this.clickTextDom.id).setHandeler(param)
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -478,14 +493,14 @@ class YJEarth {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_this.clickTextDom.addEventListener('mousedown', mousedown);
|
_this.clickTextDom.addEventListener('mousedown', mousedown);
|
||||||
document.addEventListener('mousemove', mousemove);
|
_this.viewer._element.addEventListener('mousemove', mousemove);
|
||||||
document.addEventListener('mouseup', mouseup);
|
_this.viewer._element.addEventListener('mouseup', mouseup);
|
||||||
}
|
}
|
||||||
// 点击其他地方取消
|
// 点击其他地方取消
|
||||||
if (!_this.isLeftClick && _this.clickTextDom) {
|
if (!_this.isLeftClick && _this.clickTextDom) {
|
||||||
_this.clickTextDom.removeEventListener('mousedown', mousedown);
|
_this.clickTextDom.removeEventListener('mousedown', mousedown);
|
||||||
document.removeEventListener('mousemove', mousemove);
|
_this.viewer._element.removeEventListener('mousemove', mousemove);
|
||||||
document.removeEventListener('mouseup', mouseup);
|
_this.viewer._element.removeEventListener('mouseup', mouseup);
|
||||||
_this.entityMap.get(_this.clickTextDom.id).getwords(_this.clickTextDom.getElementsByTagName('textarea')[0].value)
|
_this.entityMap.get(_this.clickTextDom.id).getwords(_this.clickTextDom.getElementsByTagName('textarea')[0].value)
|
||||||
|
|
||||||
_this.clickTextDom.style['pointer-events'] = 'none'
|
_this.clickTextDom.style['pointer-events'] = 'none'
|
||||||
|
@ -3493,6 +3493,7 @@
|
|||||||
cursor: e-resize;
|
cursor: e-resize;
|
||||||
background-color: #d3d3d3;
|
background-color: #d3d3d3;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cesium-performanceDisplay-defaultContainer {
|
.cesium-performanceDisplay-defaultContainer {
|
||||||
|
Reference in New Issue
Block a user