[Commits] r1493 - in sandbox/cmoullet/ux/StreetViewPanel: examples ux/widgets
commits at geoext.org
commits at geoext.org
Wed Nov 25 20:41:21 CET 2009
Author: cmoullet
Date: 2009-11-25 20:41:21 +0100 (Wed, 25 Nov 2009)
New Revision: 1493
Modified:
sandbox/cmoullet/ux/StreetViewPanel/examples/StreetViewPanelExample.js
sandbox/cmoullet/ux/StreetViewPanel/ux/widgets/StreetViewPanel.js
Log:
Support destroy of panel
Modified: sandbox/cmoullet/ux/StreetViewPanel/examples/StreetViewPanelExample.js
===================================================================
--- sandbox/cmoullet/ux/StreetViewPanel/examples/StreetViewPanelExample.js 2009-11-25 19:36:08 UTC (rev 1492)
+++ sandbox/cmoullet/ux/StreetViewPanel/examples/StreetViewPanelExample.js 2009-11-25 19:41:21 UTC (rev 1493)
@@ -1,16 +1,5 @@
-/** api: example[streetviewpanel-viewport]
- * Map Panel (in a Viewport)
- * -------------------------
- * Render a map panel in a viewport.
- */
-
var mapPanel;
-/** api: example[streetviewpanel-viewport]
- * Street View Panel (in a Viewport)
- * -------------------------
- * Render a Street View panel in a viewport.
- */
var streetViewPanel;
var viewport;
Modified: sandbox/cmoullet/ux/StreetViewPanel/ux/widgets/StreetViewPanel.js
===================================================================
--- sandbox/cmoullet/ux/StreetViewPanel/ux/widgets/StreetViewPanel.js 2009-11-25 19:36:08 UTC (rev 1492)
+++ sandbox/cmoullet/ux/StreetViewPanel/ux/widgets/StreetViewPanel.js 2009-11-25 19:41:21 UTC (rev 1493)
@@ -1,6 +1,15 @@
+/**
+ * Copyright (c) 2008-2009 The Open Source Geospatial Foundation
+ *
+ * Published under the BSD license.
+ * See http://svn.geoext.org/core/trunk/geoext/license.txt for the full text
+ * of the license.
+ */
+
Ext.namespace('GeoExt.ux');
GeoExt.ux.StreetViewPanel = Ext.extend(Ext.Panel, {
+
initComponent : function() {
var defConfig = {
@@ -9,15 +18,16 @@
yaw: 180,
pitch: 0,
zoom: 0,
- border: false
- }
+ border: false,
+ mode: 'clickMode'
+ };
Ext.applyIf(this, defConfig);
GeoExt.ux.StreetViewPanel.superclass.initComponent.call(this);
},
+
afterRender : function() {
-
var wh = this.ownerCt.getSize();
Ext.applyIf(this, wh);
@@ -27,42 +37,42 @@
this.panorama = new GStreetviewPanorama(this.body.dom);
this.streetviewclient = new GStreetviewClient();
- var clickControl = new GeoExt.ux.Click({
- handlerOptions: {
- "single": true
- },
- panorama: this.panorama,
- streetviewclient: this.streetviewclient
- });
+ if (this.mode == 'clickMode') {
+ this.clickControl = new GeoExt.ux.Click({
+ handlerOptions: {
+ "single": true
+ },
+ panorama: this.panorama,
+ streetviewclient: this.streetviewclient
+ });
- this.map.addControl(clickControl);
- clickControl.activate();
+ this.map.addControl(this.clickControl);
+ this.clickControl.activate();
+ }
},
+
beforeDestroy: function() {
+ if (this.mode == 'clickMode') {
+ this.clickControl.deactivate();
+ this.map.removeControl(this.clickControl);
+ }
this.panorama.remove();
delete this.panorama;
GeoExt.ux.StreetViewPanel.superclass.beforeDestroy.apply(this, arguments);
},
+
onResize : function(w, h) {
GeoExt.ux.StreetViewPanel.superclass.onResize.call(this, w, h);
if (typeof this.panorama == 'object') {
this.panorama.checkResize();
}
},
+
setSize : function(width, height, animate) {
GeoExt.ux.StreetViewPanel.superclass.setSize.call(this, width, height, animate);
if (typeof this.panorama == 'object') {
this.panorama.checkResize();
}
- },
- getMap: function() {
- return this.panorama;
- },
- // http://stackoverflow.com/questions/183214/javascript-callback-scope
- bind: function(scope, fn) {
- return function () {
- fn.apply(scope, arguments);
- };
}
});
More information about the Commits
mailing list