赣州市洪水风险预警系统三维版本
guoshilong
2023-02-27 4d8c6dd77427e8e581fda17b6b65ba86bfb7a815
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
var TooltipDiv = (function () {
    var isInit = false;
 
 
    function _() { };
 
    _.initTool = function (frameDiv) {
        if (isInit) { return; }
 
        var div = document.createElement('DIV');
        div.className = "tooltipdiv right";//
 
        var arrow = document.createElement('DIV');
        arrow.className = "tooltipdiv-arrow";
        div.appendChild(arrow);
 
        var title = document.createElement('DIV');
        title.className = "tooltipdiv-inner";
        div.appendChild(title);
 
        this._div = div;
        this._title = title;
 
        frameDiv.appendChild(div);
 
        isInit = true;
    }
 
    _.setVisible = function (visible) {
        if (!isInit) { return; }
        this._div.style.display = visible ? 'block' : 'none';
    };
 
    /*
    position屏幕坐标
    显示在屏幕上
    */
    _.showAt = function (position, message) {
        if (!isInit) { return; }
        if (position && message) {
            this.setVisible(true);
            this._title.innerHTML = message;
            this._div.style.left = position.x + 10 + "px";
            this._div.style.top = (position.y - this._div.clientHeight / 2) + "px";
        }
    };
 
    return _;
})();