[Commits] r1488 - sandbox/cmoullet/ux/StreetViewPanel/examples sandbox/cmoullet/ux/StreetViewPanel/ux sandbox/cmoullet/ux/StreetViewPanel/ux/control sandbox/cmoullet/ux/StreetViewPanel/ux/widgets ux/GeoNamesSearchCombo/tests/ux/widgets/form
commits at geoext.org
commits at geoext.org
Wed Nov 25 08:42:18 CET 2009
Author: cmoullet
Date: 2009-11-25 08:42:18 +0100 (Wed, 25 Nov 2009)
New Revision: 1488
Added:
sandbox/cmoullet/ux/StreetViewPanel/ux/control/
sandbox/cmoullet/ux/StreetViewPanel/ux/control/Click.js
Modified:
sandbox/cmoullet/ux/StreetViewPanel/examples/StreetViewPanelExample.html
sandbox/cmoullet/ux/StreetViewPanel/ux/widgets/StreetViewPanel.js
ux/GeoNamesSearchCombo/tests/ux/widgets/form/GeoNamesSearchCombo.html
Log:
Add click event handler
Modified: sandbox/cmoullet/ux/StreetViewPanel/examples/StreetViewPanelExample.html
===================================================================
--- sandbox/cmoullet/ux/StreetViewPanel/examples/StreetViewPanelExample.html 2009-11-25 06:41:30 UTC (rev 1487)
+++ sandbox/cmoullet/ux/StreetViewPanel/examples/StreetViewPanelExample.html 2009-11-25 07:42:18 UTC (rev 1488)
@@ -16,6 +16,7 @@
<script type="text/javascript" src="../../../trunk/geoext/lib/GeoExt.js"></script>
<script type="text/javascript" src="../ux/widgets/StreetViewPanel.js"></script>
+ <script type="text/javascript" src="../ux/control/Click.js"></script>
<script type="text/javascript" src="StreetViewPanelExample.js"></script>
</head>
Added: sandbox/cmoullet/ux/StreetViewPanel/ux/control/Click.js
===================================================================
--- sandbox/cmoullet/ux/StreetViewPanel/ux/control/Click.js (rev 0)
+++ sandbox/cmoullet/ux/StreetViewPanel/ux/control/Click.js 2009-11-25 07:42:18 UTC (rev 1488)
@@ -0,0 +1,43 @@
+/**
+ * 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.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
+ );
+ 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) {
+ alert('click');
+ },
+
+ onDblclick: function(evt) {
+ alert('doubleClick');
+ }
+
+});
Modified: sandbox/cmoullet/ux/StreetViewPanel/ux/widgets/StreetViewPanel.js
===================================================================
--- sandbox/cmoullet/ux/StreetViewPanel/ux/widgets/StreetViewPanel.js 2009-11-25 06:41:30 UTC (rev 1487)
+++ sandbox/cmoullet/ux/StreetViewPanel/ux/widgets/StreetViewPanel.js 2009-11-25 07:42:18 UTC (rev 1488)
@@ -26,6 +26,16 @@
this.panorama = new GStreetviewPanorama(this.body.dom);
+ var clickControl = new GeoExt.ux.Click({
+ handlerOptions: {
+ "single": true
+ }
+ });
+
+ this.map.addControl(clickControl);
+ clickControl.activate();
+
+
this.panorama.setLocationAndPOV(new GLatLng(42.345573, -71.098326));
},
beforeDestroy: function() {
@@ -47,6 +57,12 @@
},
getMap: function() {
return this.panorama;
+ },
+ // http://stackoverflow.com/questions/183214/javascript-callback-scope
+ bind: function(scope, fn) {
+ return function () {
+ fn.apply(scope, arguments);
+ };
}
});
Modified: ux/GeoNamesSearchCombo/tests/ux/widgets/form/GeoNamesSearchCombo.html
===================================================================
--- ux/GeoNamesSearchCombo/tests/ux/widgets/form/GeoNamesSearchCombo.html 2009-11-25 06:41:30 UTC (rev 1487)
+++ ux/GeoNamesSearchCombo/tests/ux/widgets/form/GeoNamesSearchCombo.html 2009-11-25 07:42:18 UTC (rev 1488)
@@ -3,7 +3,7 @@
<head>
<script type="text/javascript" src="http://extjs.cachefly.net/builds/ext-cdn-771.js"></script>
- <script type="text/javascript" src="../../../../../../geoext/lib/GeoExt.js"></script>
+ <script type="text/javascript" src="../../../../../../trunk/geoext/lib/GeoExt.js"></script>
<script type="text/javascript" src="../../../../ux/widgets/form/GeoNamesSearchCombo.js"></script>
<script type="text/javascript">
More information about the Commits
mailing list