Compare commits
3 Commits
623a220cbf
...
58b8c6a897
Author | SHA1 | Date | |
---|---|---|---|
58b8c6a897 | |||
349c91f8df | |||
92ef4a68fd |
@ -101,6 +101,7 @@ function getFlagFromKeyboard(key) {
|
||||
*/
|
||||
function keyDown(event) {
|
||||
let _viewer = this
|
||||
|
||||
// 判断是否有输入框聚焦
|
||||
function isInputFocused() {
|
||||
const activeElement = document.activeElement;
|
||||
@ -164,33 +165,52 @@ function keyUp(event) {
|
||||
* @return {*}
|
||||
*/
|
||||
function keyboardMapRoamingRender(_viewer) {
|
||||
if(!_viewer.scene.screenSpaceCameraController.enableTilt) {
|
||||
if(!_viewer || !_viewer.scene || !_viewer.scene.screenSpaceCameraController.enableTilt) {
|
||||
return
|
||||
}
|
||||
let camera = _viewer.camera;
|
||||
let ellipsoid = _viewer.scene.globe.ellipsoid;
|
||||
let cameraHeight = ellipsoid.cartesianToCartographic(camera.position).height;
|
||||
let cameraHeight2 = camera.positionCartographic.height;
|
||||
|
||||
|
||||
// 根据相机高度设置移动距离,比默认距离移动效果更好
|
||||
let moveRate = cameraHeight / 20.0;
|
||||
let rotationRate = moveRate / 500000 / Cesium.Math.toDegrees(camera.pitch);
|
||||
let moveRate2 = cameraHeight2 / 100.0;
|
||||
|
||||
if (flags.moveForward) {
|
||||
// camera.moveForward(moveRate);
|
||||
if(_viewer.scene.mode == 2) {
|
||||
camera.moveUp(moveRate2);
|
||||
}
|
||||
else {
|
||||
camera.rotate(camera.right, -rotationRate);
|
||||
}
|
||||
}
|
||||
if (flags.moveBackward) {
|
||||
// camera.moveBackward(moveRate);
|
||||
if(_viewer.scene.mode == 2) {
|
||||
camera.moveDown(moveRate2);
|
||||
}
|
||||
else {
|
||||
camera.rotate(camera.right, rotationRate);
|
||||
}
|
||||
}
|
||||
if (flags.moveLeft) {
|
||||
// camera.moveLeft(moveRate);
|
||||
if(_viewer.scene.mode == 2) {
|
||||
camera.moveLeft(moveRate2);
|
||||
}
|
||||
else {
|
||||
camera.rotate(camera.up, -rotationRate);
|
||||
}
|
||||
}
|
||||
if (flags.moveRight) {
|
||||
// camera.moveRight(moveRate);
|
||||
if(_viewer.scene.mode == 2) {
|
||||
camera.moveRight(moveRate2);
|
||||
}
|
||||
else {
|
||||
camera.rotate(camera.up, rotationRate);
|
||||
}
|
||||
}
|
||||
if (flags.moveUp) {
|
||||
camera.moveUp(moveRate);
|
||||
}
|
||||
|
@ -102,11 +102,20 @@ function off() {
|
||||
let leftCanvas = leftBox.getElementsByTagName('canvas')[0]
|
||||
leftBox.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
|
||||
}
|
||||
|
||||
|
||||
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) => {
|
||||
if (item.type && item.type == 'TrajectoryMotion' && item.viewFollow) {
|
||||
item.viewFollow = false
|
||||
@ -911,7 +920,7 @@ async function setSplitDirection(v, id, isoff = false, entityId) {
|
||||
}
|
||||
if (thatP.type === 'GroundSvg' && thatP.text) {
|
||||
thatP.text.show = thatP.textShow
|
||||
target.textShow = false
|
||||
target && (target.textShow = false)
|
||||
}
|
||||
if (thatP.label && thatP.labelShow) {
|
||||
thatP.label.entity.show = true
|
||||
|
@ -29,7 +29,8 @@ import MouseTip from '../../../MouseTip'
|
||||
import {
|
||||
setSplitDirection,
|
||||
syncSplitData,
|
||||
setActiveId
|
||||
setActiveId,
|
||||
getState
|
||||
} from '../../../Global/SplitScreen'
|
||||
import {
|
||||
setActiveViewer,
|
||||
@ -2943,6 +2944,9 @@ class BillboardObject extends Base {
|
||||
attributeElm.style.left = '0px'
|
||||
attributeElm.style.width = 0
|
||||
attributeElm.style.height = 0
|
||||
if(getState()) {
|
||||
attributeElm.style.display = 'none'
|
||||
}
|
||||
// attributeElm.innerHTML = this.options.richTextContent
|
||||
this.sdk.viewer._element.appendChild(attributeElm)
|
||||
let linkHtml = ''
|
||||
|
@ -137,7 +137,7 @@ class Base extends Tools {
|
||||
this.originalOptions.show = v
|
||||
}
|
||||
}
|
||||
this.entity._showView = this.showView
|
||||
this.entity && (this.entity._showView = this.showView)
|
||||
if (this.type == 'layer') {
|
||||
if (this.entity) {
|
||||
this.entity._objectState = this.options.show
|
||||
|
Reference in New Issue
Block a user