Compare commits

...

3 Commits

4 changed files with 45 additions and 12 deletions

View File

@ -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,33 +165,52 @@ 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.moveUp(moveRate2);
}
else {
camera.rotate(camera.right, -rotationRate); camera.rotate(camera.right, -rotationRate);
} }
}
if (flags.moveBackward) { if (flags.moveBackward) {
// camera.moveBackward(moveRate); if(_viewer.scene.mode == 2) {
camera.moveDown(moveRate2);
}
else {
camera.rotate(camera.right, rotationRate); camera.rotate(camera.right, rotationRate);
} }
}
if (flags.moveLeft) { if (flags.moveLeft) {
// camera.moveLeft(moveRate); if(_viewer.scene.mode == 2) {
camera.moveLeft(moveRate2);
}
else {
camera.rotate(camera.up, -rotationRate); camera.rotate(camera.up, -rotationRate);
} }
}
if (flags.moveRight) { if (flags.moveRight) {
// camera.moveRight(moveRate); if(_viewer.scene.mode == 2) {
camera.moveRight(moveRate2);
}
else {
camera.rotate(camera.up, rotationRate); camera.rotate(camera.up, rotationRate);
} }
}
if (flags.moveUp) { if (flags.moveUp) {
camera.moveUp(moveRate); camera.moveUp(moveRate);
} }

View File

@ -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
@ -911,7 +920,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

View File

@ -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,
@ -2943,6 +2944,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 = ''

View File

@ -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