zhongrj
2023-06-27 d74b495736f0c04522ec54274b70fed0ded2878d
public/map/controls/toolbar/tools/StreetViewTool.js
New file
@@ -0,0 +1,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;
});