[Commits] r1487 - in sandbox/cmoullet/ux/StreetViewPanel: examples ux/widgets

commits at geoext.org commits at geoext.org
Wed Nov 25 07:41:31 CET 2009


Author: cmoullet
Date: 2009-11-25 07:41:30 +0100 (Wed, 25 Nov 2009)
New Revision: 1487

Modified:
   sandbox/cmoullet/ux/StreetViewPanel/examples/StreetViewPanelExample.html
   sandbox/cmoullet/ux/StreetViewPanel/examples/StreetViewPanelExample.js
   sandbox/cmoullet/ux/StreetViewPanel/ux/widgets/StreetViewPanel.js
Log:
Fix resize and remove unneeded code

Modified: sandbox/cmoullet/ux/StreetViewPanel/examples/StreetViewPanelExample.html
===================================================================
--- sandbox/cmoullet/ux/StreetViewPanel/examples/StreetViewPanelExample.html	2009-11-24 16:43:14 UTC (rev 1486)
+++ sandbox/cmoullet/ux/StreetViewPanel/examples/StreetViewPanelExample.html	2009-11-25 06:41:30 UTC (rev 1487)
@@ -6,11 +6,12 @@
     <link rel="stylesheet" type="text/css" href="http://extjs.cachefly.net/ext-2.2.1/examples/shared/examples.css" />
     <!-- Google Maps API for "localhost" -->
     <!--
-    <script src='http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhR_wWLPFku8Ix9i2SXYRVK3e45q1BQUd_beF8dtzKET_EteAjPdGDwqpQ'></script>
+    <script src='http://maps.google.com/maps?file=api&amp;v=2.104;key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhR_wWLPFku8Ix9i2SXYRVK3e45q1BQUd_beF8dtzKET_EteAjPdGDwqpQ'></script>
     -->
 
     <!-- Google Maps API for "dev.geoext.org" -->
-    <script src='http://maps.google.com/maps?file=api&amp;v=2.104&amp;key=ABQIAAAA_5ak-hsiH4j5bQQn7-k66xTWxvN8zH6Ta_pgIhhU0TB7bG8iAhS99ituPif4lG-2CHXoZ3qenLnK1g'></script>
+    <script src='http://maps.google.com/maps?file=api&amp;v=2.104;key=ABQIAAAA_5ak-hsiH4j5bQQn7-k66xTWxvN8zH6Ta_pgIhhU0TB7bG8iAhS99ituPif4lG-2CHXoZ3qenLnK1g'></script>
+
     <script src="http://openlayers.org/api/2.8/OpenLayers.js"></script>
     <script type="text/javascript" src="../../../trunk/geoext/lib/GeoExt.js"></script>
 

Modified: sandbox/cmoullet/ux/StreetViewPanel/examples/StreetViewPanelExample.js
===================================================================
--- sandbox/cmoullet/ux/StreetViewPanel/examples/StreetViewPanelExample.js	2009-11-24 16:43:14 UTC (rev 1486)
+++ sandbox/cmoullet/ux/StreetViewPanel/examples/StreetViewPanelExample.js	2009-11-25 06:41:30 UTC (rev 1487)
@@ -18,7 +18,7 @@
 var layer;
 
 Ext.onReady(function() {
-
+    
     var options;
     var extent = new OpenLayers.Bounds(7, 45.5, 9, 47.5);
 
@@ -68,11 +68,7 @@
     var streetViewPanelItem = {
         xtype: 'gxux_streetviewpanel',
         id: 'streetViewPanelItem',
-        map: map,
-        setCenter: {
-            lat: 42.345573,
-            long: -71.098326
-        }
+        map: map        
     };
 
     viewport = new Ext.Viewport({

Modified: sandbox/cmoullet/ux/StreetViewPanel/ux/widgets/StreetViewPanel.js
===================================================================
--- sandbox/cmoullet/ux/StreetViewPanel/ux/widgets/StreetViewPanel.js	2009-11-24 16:43:14 UTC (rev 1486)
+++ sandbox/cmoullet/ux/StreetViewPanel/ux/widgets/StreetViewPanel.js	2009-11-25 06:41:30 UTC (rev 1487)
@@ -1,39 +1,5 @@
 Ext.namespace('GeoExt.ux');
 
-OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, {
-    defaultHandlerOptions: {
-        'single': true,
-        'double': false,
-        'pixelTolerance': 0,
-        'stopSingle': false,
-        'stopDouble': false
-    },
-
-    initialize: function(options) {
-        this.handlerOptions = OpenLayers.Util.extend({}, this.defaultHandlerOptions);
-        this.gmap = options.gmap;
-        OpenLayers.Control.prototype.initialize.apply(this, arguments);
-        this.handler = new OpenLayers.Handler.Click(
-                this, {
-            'click': this.onClick,
-            'dblclick': this.onDblclick
-        },
-                this.handlerOptions
-                );
-    },
-
-    onClick: function(evt) {
-        var lonlat = this.map.getLonLatFromViewPortPx(evt.xy);
-        lonlat.transform(this.map.getProjectionObject(), new OpenLayers.Projection("EPSG:4326"));
-        var clickPosition = new GLatLng(lonlat.lat, lonlat.lon);
-        this.gmap.setLocationAndPOV(clickPosition);
-    },
-
-    onDblclick: function(evt) {
-    }
-
-});
-
 GeoExt.ux.StreetViewPanel = Ext.extend(Ext.Panel, {
     initComponent : function() {
 
@@ -49,55 +15,38 @@
         Ext.applyIf(this, defConfig);
 
         GeoExt.ux.StreetViewPanel.superclass.initComponent.call(this);
-
     },
     afterRender : function() {
 
         var wh = this.ownerCt.getSize();
+
         Ext.applyIf(this, wh);
 
         GeoExt.ux.StreetViewPanel.superclass.afterRender.call(this);
 
-        this.gmap = new GStreetviewPanorama(this.body.dom);
+        this.panorama = new GStreetviewPanorama(this.body.dom);
 
-        this.controlSingleClick = new OpenLayers.Control.Click({
-            handlerOptions: {
-                "single": true
-            },
-            gmap: this.gmap
-        });
-        this.map.addControl(this.controlSingleClick);
-        this.controlSingleClick.activate();
-
-        alert("Click on the map to view a panorama. Some area have no data.");
+        this.panorama.setLocationAndPOV(new GLatLng(42.345573, -71.098326));
     },
     beforeDestroy: function() {
-        this.controlSingleClick.deactivate();
-        this.map.removeControl(this.controlSingleClick);
-        this.gmap.remove();
-        delete this.gmap;
+        this.panorama.remove();
+        delete this.panorama;
         GeoExt.ux.StreetViewPanel.superclass.beforeDestroy.apply(this, arguments);
     },
     onResize : function(w, h) {
-
-        if (typeof this.gmap == 'object') {
-            this.gmap.checkResize();
-        }
-
         GeoExt.ux.StreetViewPanel.superclass.onResize.call(this, w, h);
-
+        if (typeof this.panorama == 'object') {
+            this.panorama.checkResize();
+        }
     },
     setSize : function(width, height, animate) {
-
-        if (typeof this.gmap == 'object') {
-            this.gmap.checkResize();
-        }
-
         GeoExt.ux.StreetViewPanel.superclass.setSize.call(this, width, height, animate);
-
+        if (typeof this.panorama == 'object') {
+            this.panorama.checkResize();
+        }
     },
     getMap: function() {
-        return this.gmap;
+        return this.panorama;
     }
 });
 



More information about the Commits mailing list