shuishen
2022-04-29 4f55f7d94198eca8eba9ae6b85af19a07cac2f79
src/mobileDivForms/mobileDivForms.js
@@ -10,8 +10,6 @@
import DC from '@dvgis/dc-sdk/dist/dc.base.min' // 基础包
import DcCore from '@dvgis/dc-sdk/dist/dc.core.min' // 核心包
var $ = window.$
DC.use(DcCore) // 安装DC核心库
class mobileDivForms {
@@ -20,13 +18,13 @@
     *
     */
    constructor(viewer, popup) {
        this._viewer = viewer;
        this._popup = popup;
        this._position = popup.position;
        this._title = popup.title;
        this._content = popup.content;
        this.appendPopup();
        this.isOpen = true;
        this._viewer = viewer
        this._popup = popup
        this._position = popup.position
        this._title = popup.title
        this._content = popup.content
        this.appendPopup()
        this.isOpen = true
    }
    get viewer() {
@@ -59,8 +57,8 @@
    // 创建元素并追加
    createVideoWindowAll(id, className, position) {
        let dom = document.getElementById('mobile-map_popup_content');
        dom.style.display = 'block';
        const dom = document.getElementById('mobile-map_popup_content')
        dom.style.display = 'block'
        var childs = document.getElementById('mobile-map_popup_content').getElementsByTagName('div')
@@ -72,20 +70,22 @@
        var self = this
        var el = $("<div class=''></div>")
        // var el = $("<div class=''></div>")
        var el = document.createElement('div')
        // var titleDiv = $("<div class='mobiletitle'></div>").text(this._title)
        // var labelContent = $("<div class='mobilelabel-content'></div>").append(this._content)
        // el.append(titleDiv)
        // el.append(labelContent)
        el.append(this._content)
        el.appendChild(this._content)
        el.attr('id', id)
        el.setAttribute('id', id)
        el.addClass(className || '')
        el.setAttribute('class', className || '')
        $('#mobile-map_popup_content').append(el)
        document.getElementById('mobile-map_popup_content').appendChild(el)
        // let time;
        // function cons(e) {
        //     time = setTimeout(() => {
@@ -101,7 +101,7 @@
        this._viewer.scene.postRender.addEventListener(function (e) {
            if (!self.isOpen) {
                return;
                return
            }
            const windowCoord = DC.Namespace.Cesium.SceneTransforms.wgs84ToWindowCoordinates(
                self._viewer.scene,
@@ -114,12 +114,12 @@
    positionPopUp(windowCoord, id) {
        if (!windowCoord) {
            return;
            return
        }
        // console.log(windowCoord)
        const wx = document.getElementById('app').clientWidth;
        const x = windowCoord.x - (wx / 100 * 35);
        const y = windowCoord.y - document.getElementById(id).offsetHeight - 15;
        const wx = document.getElementById('app').clientWidth
        const x = windowCoord.x - (wx / 100 * 35)
        const y = windowCoord.y - document.getElementById(id).offsetHeight - 15
        // x = windowCoord.x - document.getElementById(id).offsetWidth
        // document.getElementById(id).style.cssText = `
@@ -129,10 +129,11 @@
        transform:translate3d(${Math.round(x)}px,${Math.round(y)}px, 0);
        `
    }
    closeOur() {
        this.isOpen = false;
        let dom = document.getElementById('mobile-map_popup_content');
        dom.style.display = 'none';
        this.isOpen = false
        const dom = document.getElementById('mobile-map_popup_content')
        dom.style.display = 'none'
        // var childs = document.getElementById('mobile-map_popup_content').getElementsByTagName('div')
        // if (childs.length > 0) {