zengh
2022-05-16 63ad2c3598400370dd7da5534659fd7e768a0a4a
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
50
51
52
53
54
55
56
57
58
/**
 * 街景部件按钮
 * @author wenyb 2015-11-2
 **/
define([
    "base/AppEvent",
    "dojo",
    "dojo/_base/declare",
    "dojo/_base/lang",
    "controls/toolbar/tools/BaseTool",
    "dojo/dom-style"
], function(
    AppEvent,
    dojo,
    declare,
    lang,
    BaseTool,
    domStyle
) {
    var RL = declare([BaseTool], {
        constructor: function(args) {
            this.widgetId="StreetViewWidget";
            this.tooltip="街景";
            this._normalIconClass="tool-streetview-normal";
            this._overIconClass="tool-streetview-over";
            this._selectedIconClass="tool-streetview-select";
            this._disableClass="";
            AppEvent.addAppEventListener(AppEvent.RUN_WIDGET,lang.hitch(this,function(data){
                if(data == this.widgetId){
                    this.activate("self");
                }
            }));
        },
        activate: function(args) {
            if(this._activated){
                return;
            }
            this.inherited(arguments);
            if(args!=null && args=="self"){
                return;
            }
            AppEvent.dispatchAppEvent(AppEvent.RUN_WIDGET,this.widgetId);
        },
        postCreate: function() {
            this.inherited(arguments);
            domStyle.set(this.domNode,"position","absolute");
            domStyle.set(this.domNode,"top","90px");
            domStyle.set(this.domNode,"left","20px");
            domStyle.set(this.domNode,"z-index","30");
            domStyle.set(this.domNode,"border-radius","3px");
        },
        deactivate: function() {
            this.inherited(arguments);
            AppEvent.dispatchAppEvent(AppEvent.CLOSE_WIDGET,this.widgetId);
        }
    });
    return RL;
});