Changeset 3088
- Timestamp:
- 04/19/07 21:10:43 (1 year ago)
- Files:
-
- branches/openlayers/2.4/examples/image-layer.html (modified) (1 diff)
- branches/openlayers/2.4/examples/openmnnd.html (modified) (1 diff)
- branches/openlayers/2.4/examples/vector-features.html (modified) (1 diff)
- branches/openlayers/2.4/examples/wfs-scribble.html (modified) (2 diffs)
- branches/openlayers/2.4/examples/wfs-t.html (modified) (3 diffs)
- branches/openlayers/2.4/examples/wkt.html (modified) (1 diff)
- branches/openlayers/2.4/lib/OpenLayers/Control/DrawFeature.js (modified) (1 diff)
- branches/openlayers/2.4/lib/OpenLayers/Control/KeyboardDefaults.js (modified) (2 diffs)
- branches/openlayers/2.4/lib/OpenLayers/Control/LayerSwitcher.js (modified) (1 diff)
- branches/openlayers/2.4/lib/OpenLayers/Control/MouseDefaults.js (modified) (1 diff)
- branches/openlayers/2.4/lib/OpenLayers/Control/MouseToolbar.js (modified) (1 diff)
- branches/openlayers/2.4/lib/OpenLayers/Control/OverviewMap.js (modified) (3 diffs)
- branches/openlayers/2.4/lib/OpenLayers/Control/PanZoom.js (modified) (1 diff)
- branches/openlayers/2.4/lib/OpenLayers/Control/PanZoomBar.js (modified) (1 diff)
- branches/openlayers/2.4/lib/OpenLayers/Control/SelectFeature.js (modified) (8 diffs)
- branches/openlayers/2.4/lib/OpenLayers/Feature/Vector.js (modified) (4 diffs)
- branches/openlayers/2.4/lib/OpenLayers/Format/GML.js (modified) (1 diff)
- branches/openlayers/2.4/lib/OpenLayers/Format/KML.js (modified) (1 diff)
- branches/openlayers/2.4/lib/OpenLayers/Geometry.js (modified) (2 diffs)
- branches/openlayers/2.4/lib/OpenLayers/Geometry/Collection.js (modified) (1 diff)
- branches/openlayers/2.4/lib/OpenLayers/Handler/Box.js (modified) (1 diff)
- branches/openlayers/2.4/lib/OpenLayers/Handler/Drag.js (modified) (4 diffs)
- branches/openlayers/2.4/lib/OpenLayers/Handler/Feature.js (modified) (4 diffs)
- branches/openlayers/2.4/lib/OpenLayers/Handler/Path.js (modified) (11 diffs)
- branches/openlayers/2.4/lib/OpenLayers/Handler/Point.js (modified) (10 diffs)
- branches/openlayers/2.4/lib/OpenLayers/Handler/Polygon.js (modified) (7 diffs)
- branches/openlayers/2.4/lib/OpenLayers/Layer.js (modified) (8 diffs)
- branches/openlayers/2.4/lib/OpenLayers/Layer/Boxes.js (modified) (1 diff)
- branches/openlayers/2.4/lib/OpenLayers/Layer/HTTPRequest.js (modified) (1 diff)
- branches/openlayers/2.4/lib/OpenLayers/Layer/Image.js (modified) (6 diffs)
- branches/openlayers/2.4/lib/OpenLayers/Layer/KaMap.js (modified) (1 diff)
- branches/openlayers/2.4/lib/OpenLayers/Layer/Vector.js (modified) (12 diffs)
- branches/openlayers/2.4/lib/OpenLayers/Layer/WFS.js (modified) (1 diff)
- branches/openlayers/2.4/lib/OpenLayers/Marker/Box.js (modified) (1 diff)
- branches/openlayers/2.4/lib/OpenLayers/Popup.js (modified) (1 diff)
- branches/openlayers/2.4/lib/OpenLayers/Renderer.js (modified) (4 diffs)
- branches/openlayers/2.4/lib/OpenLayers/Renderer/Elements.js (modified) (10 diffs)
- branches/openlayers/2.4/lib/OpenLayers/Renderer/SVG.js (modified) (16 diffs)
- branches/openlayers/2.4/lib/OpenLayers/Renderer/VML.js (modified) (16 diffs)
- branches/openlayers/2.4/lib/OpenLayers/Tile.js (modified) (3 diffs)
- branches/openlayers/2.4/lib/OpenLayers/Tile/Image.js (modified) (3 diffs)
- branches/openlayers/2.4/lib/OpenLayers/Tile/WFS.js (modified) (2 diffs)
- branches/openlayers/2.4/lib/OpenLayers/Util.js (modified) (1 diff)
- branches/openlayers/2.4/tests/Control/test_KeyboardDefaults.html (copied) (copied from trunk/openlayers/tests/Control/test_KeyboardDefaults.html)
- branches/openlayers/2.4/tests/Control/test_PanZoom.html (modified) (2 diffs)
- branches/openlayers/2.4/tests/Feature/test_Vector.html (modified) (1 diff)
- branches/openlayers/2.4/tests/Geometry/test_Collection.html (modified) (2 diffs)
- branches/openlayers/2.4/tests/Layer/test_Image.html (modified) (3 diffs)
- branches/openlayers/2.4/tests/Layer/test_KaMap.html (modified) (2 diffs)
- branches/openlayers/2.4/tests/Layer/test_Vector.html (modified) (5 diffs)
- branches/openlayers/2.4/tests/Layer/test_WFS.html (copied) (copied from trunk/openlayers/tests/Layer/test_WFS.html)
- branches/openlayers/2.4/tests/Marker/test_Box.html (copied) (copied from trunk/openlayers/tests/Marker/test_Box.html)
- branches/openlayers/2.4/tests/list-tests.html (modified) (2 diffs)
- branches/openlayers/2.4/tests/test_Geometry.html (modified) (2 diffs)
- branches/openlayers/2.4/tests/test_Layer.html (modified) (2 diffs)
- branches/openlayers/2.4/theme/default/style.css (modified) (2 diffs)
- branches/openlayers/2.4/tools/mergejs.py (modified) (1 diff)
- branches/openlayers/2.4/tools/release.sh (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/openlayers/2.4/examples/image-layer.html
r2978 r3088 14 14 <script type="text/javascript"> 15 15 <!-- 16 var map; 16 17 function init(){ 17 varmap = new OpenLayers.Map('map');18 map = new OpenLayers.Map('map'); 18 19 19 var options = { maxResolution: 'auto',numZoomLevels: 3};20 var options = {numZoomLevels: 3}; 20 21 21 22 var graphic = new OpenLayers.Layer.Image( branches/openlayers/2.4/examples/openmnnd.html
r2978 r3088 100 100 } 101 101 } 102 var displayedGeom = null; 103 function feature_info_hover(geometry) { 104 if(geometry.parent) { 105 geometry = geometry.parent; 106 } 107 if (displayedGeom != geometry && 108 (!geometry.feature.layer.selectedFeatures.length || 109 (geometry.feature.layer.selectedFeatures[0].geometry == geometry))) { 110 feature_info(geometry); 111 displaydGeom = geometry; 102 var displayedFeature = null; 103 function feature_info_hover(feature) { 104 if (displayedFeature != feature && 105 (!feature.layer.selectedFeatures.length || 106 (feature.layer.selectedFeatures[0] == feature))) { 107 feature_info(feature); 108 displayedFeature = feature; 112 109 } 113 110 } 114 function feature_info(geometry) { 115 if(geometry.parent) { 116 geometry = geometry.parent; 117 } 111 function feature_info(feature) { 118 112 var html = "<ul>"; 119 for(var i in geometry.feature.attributes)120 html += "<li><b>" + i + "</b>: "+ geometry.feature.attributes[i] + "</li>";113 for(var i in feature.attributes) 114 html += "<li><b>" + i + "</b>: "+ feature.attributes[i] + "</li>"; 121 115 html += "</ul>"; 122 116 $('feature_info').innerHTML = html; branches/openlayers/2.4/examples/vector-features.html
r2978 r3088 9 9 </style> 10 10 <script src="../lib/OpenLayers.js"></script> 11 <script src="../lib/Firebug/debug.js"></script>12 11 <script type="text/javascript"> 13 12 <!-- branches/openlayers/2.4/examples/wfs-scribble.html
r2978 r3088 36 36 feature.state = OpenLayers.State.INSERT; 37 37 feature.style['strokeColor'] = "#ff0000"; 38 feature.layer. renderer.drawGeometry(feature.geometry, feature.style);38 feature.layer.drawFeature(feature); 39 39 } 40 40 p.addControls([ new OpenLayers.Control.Navigation(), df ]); … … 48 48 var f = map.layers[1].features[i]; 49 49 f.style['strokeColor'] = '#ee9900'; 50 map.layers[1]. renderer.drawGeometry(f.geometry, f.style);50 map.layers[1].drawFeature(f); 51 51 } 52 52 map.layers[1].commit(); branches/openlayers/2.4/examples/wfs-t.html
r2978 r3088 28 28 extractAttributes: false 29 29 } ); 30 rlayer.onFeatureInsert=function(feature) { feature.style.strokeColor = "#ff0000"; feature.layer. renderer.drawGeometry(feature.geometry, feature.style); }30 rlayer.onFeatureInsert=function(feature) { feature.style.strokeColor = "#ff0000"; feature.layer.drawFeature(feature); } 31 31 map.addLayer(rlayer); 32 32 layer = new OpenLayers.Layer.WFS( "Cities", … … 45 45 feature.state = OpenLayers.State.INSERT; 46 46 feature.style['strokeColor'] = "#0000ff"; 47 feature.layer. renderer.drawGeometry(feature.geometry, feature.style);47 feature.layer.drawFeature(feature); 48 48 } 49 49 dp = new OpenLayers.Control.DrawFeature(layer, OpenLayers.Handler.Point, {handlerOptions: {'freehand': false}, 'displayClass': 'olControlDrawFeaturePoint'}); … … 54 54 feature.state = OpenLayers.State.INSERT; 55 55 feature.style['strokeColor'] = "#0000ff"; 56 feature.layer. renderer.drawGeometry(feature.geometry, feature.style);56 feature.layer.drawFeature(feature); 57 57 } 58 58 p.addControls([ new OpenLayers.Control.Navigation(), df, dp ]); branches/openlayers/2.4/examples/wkt.html
r2992 r3088 78 78 } 79 79 80 function displayWKT( geometry) {81 var str = wkt.write( geometry);80 function displayWKT(feature) { 81 var str = wkt.write(feature.geometry); 82 82 // not a good idea in general, just for this demo 83 83 str = str.replace(/,/g, ', '); branches/openlayers/2.4/lib/OpenLayers/Control/DrawFeature.js
r2978 r3088 23 23 * @type {Object} The functions that are sent to the handler for callback 24 24 */ 25 callbacks: {},25 callbacks: null, 26 26 27 27 /** branches/openlayers/2.4/lib/OpenLayers/Control/KeyboardDefaults.js
r2936 r3088 15 15 16 16 /** @type int */ 17 slideFactor: 50,17 slideFactor: 75, 18 18 19 19 /** … … 51 51 switch(code) { 52 52 case OpenLayers.Event.KEY_LEFT: 53 this.map.pan(- 50, 0);53 this.map.pan(-this.slideFactor, 0); 54 54 break; 55 55 case OpenLayers.Event.KEY_RIGHT: 56 this.map.pan( 50, 0);56 this.map.pan(this.slideFactor, 0); 57 57 break; 58 58 case OpenLayers.Event.KEY_UP: 59 this.map.pan(0, - 50);59 this.map.pan(0, -this.slideFactor); 60 60 break; 61 61 case OpenLayers.Event.KEY_DOWN: 62 this.map.pan(0, 50);62 this.map.pan(0, this.slideFactor); 63 63 break; 64 case 33: // Page Up 65 case 43: // + 64 65 case 33: // Page Up 66 var size = this.map.getSize(); 67 this.map.pan(0, -0.75*size.h); 68 break; 69 case 34: // Page Down 70 var size = this.map.getSize(); 71 this.map.pan(0, 0.75*size.h); 72 break; 73 case 35: // End 74 var size = this.map.getSize(); 75 this.map.pan(0.75*size.w, 0); 76 break; 77 case 36: // Pos1 78 var size = this.map.getSize(); 79 this.map.pan(-0.75*size.w, 0); 80 break; 81 82 case 43: // + 83 this.map.zoomIn(); 84 break; 85 case 45: // - 86 this.map.zoomOut(); 87 break; 88 case 107: // + (IE only) 66 89 this.map.zoomIn(); 67 90 break; 68 case 45: // - 69 case 34: // Page Down 91 case 109: // - (IE only) 70 92 this.map.zoomOut(); 71 93 break; 72 } 94 } 73 95 }, 74 96 branches/openlayers/2.4/lib/OpenLayers/Control/LayerSwitcher.js
r2934 r3088 337 337 //configure main div 338 338 this.div.style.position = "absolute"; 339 this.div.style.top = " 10px";339 this.div.style.top = "25px"; 340 340 this.div.style.right = "0px"; 341 341 this.div.style.left = ""; branches/openlayers/2.4/lib/OpenLayers/Control/MouseDefaults.js
r2938 r3088 182 182 document.onselectstart=null; 183 183 this.mouseDragStart = null; 184 this.map.div.style.cursor = " default";184 this.map.div.style.cursor = ""; 185 185 }, 186 186 branches/openlayers/2.4/lib/OpenLayers/Control/MouseToolbar.js
r2939 r3088 240 240 break; 241 241 default: 242 this.map.div.style.cursor = " default";242 this.map.div.style.cursor = ""; 243 243 break; 244 244 } branches/openlayers/2.4/lib/OpenLayers/Control/OverviewMap.js
r2964 r3088 47 47 * @type Array(OpenLayers.Layer) 48 48 */ 49 layers: [],49 layers: null, 50 50 51 51 /** … … 69 69 * @type: Object 70 70 */ 71 mapOptions: {},71 mapOptions: null, 72 72 73 73 /** … … 76 76 */ 77 77 initialize: function(options) { 78 this.layers = new Array(); 78 79 OpenLayers.Control.prototype.initialize.apply(this, [options]); 79 80 }, branches/openlayers/2.4/lib/OpenLayers/Control/PanZoom.js
r2965 r3088 105 105 OpenLayers.Event.observe(btn, "dblclick", 106 106 this.doubleClick.bindAsEventListener(btn)); 107 OpenLayers.Event.observe(btn, "click", 108 this.doubleClick.bindAsEventListener(btn)); 107 109 btn.action = id; 108 110 btn.map = this.map; branches/openlayers/2.4/lib/OpenLayers/Control/PanZoomBar.js
r2965 r3088 229 229 if (!OpenLayers.Event.isLeftClick(evt)) return; 230 230 if (this.zoomStart) { 231 this.div.style.cursor=" default";231 this.div.style.cursor=""; 232 232 this.map.events.unregister("mouseup", this, this.passEventToSlider); 233 233 this.map.events.unregister("mousemove", this, this.passEventToSlider); branches/openlayers/2.4/lib/OpenLayers/Control/SelectFeature.js
r2978 r3088 28 28 /** 29 29 * @type {Function} Optional function to be called when a feature is selected. 30 * The function should expect to be called with a geometry.30 * The function should expect to be called with a feature. 31 31 */ 32 32 onSelect: function() {}, … … 34 34 /** 35 35 * @type {Function} Optional function to be called when a feature is unselected. 36 * The function should expect to be called with a geometry.36 * The function should expect to be called with a feature. 37 37 */ 38 38 onUnselect: function() {}, … … 46 46 * @type {Object} The functions that are sent to the handler for callback 47 47 */ 48 callbacks: {},48 callbacks: null, 49 49 50 50 /** … … 77 77 /** 78 78 * Called when the feature handler detects a mouse-down on a feature 79 * @param {OpenLayers. Geometry}79 * @param {OpenLayers.Vector.Feature} 80 80 */ 81 downFeature: function( geometry) {81 downFeature: function(feature) { 82 82 if(this.hover) { 83 83 return; 84 84 } 85 if(geometry.parent) {86 geometry = geometry.parent;87 }88 85 if (this.multiple) { 89 if(OpenLayers.Util.indexOf(this.layer.selectedFeatures, geometry.feature) > -1) {90 this.unselect( geometry);86 if(OpenLayers.Util.indexOf(this.layer.selectedFeatures, feature) > -1) { 87 this.unselect(feature); 91 88 } else { 92 this.select( geometry);89 this.select(feature); 93 90 } 94 91 } else { 95 if(OpenLayers.Util.indexOf(this.layer.selectedFeatures, geometry.feature) > -1) {96 this.unselect( geometry);92 if(OpenLayers.Util.indexOf(this.layer.selectedFeatures, feature) > -1) { 93 this.unselect(feature); 97 94 } else { 98 95 if (this.layer.selectedFeatures) { 99 96 for (var i = 0; i < this.layer.selectedFeatures.length; i++) { 100 this.unselect(this.layer.selectedFeatures[i] .geometry);97 this.unselect(this.layer.selectedFeatures[i]); 101 98 } 102 99 } 103 this.select( geometry);100 this.select(feature); 104 101 } 105 102 } … … 109 106 * Called when the feature handler detects a mouse-over on a feature. 110 107 * Only responds if this.hover is true. 111 * @param {OpenLayers. Geometry}108 * @param {OpenLayers.Feature.Vector} 112 109 */ 113 overFeature: function( geometry) {110 overFeature: function(feature) { 114 111 if(!this.hover) { 115 112 return; 116 113 } 117 if(geometry.parent) { 118 geometry = geometry.parent; 119 } 120 if(!(OpenLayers.Util.indexOf(this.layer.selectedFeatures, geometry.feature) > -1)) { 121 this.select(geometry); 114 if(!(OpenLayers.Util.indexOf(this.layer.selectedFeatures, feature) > -1)) { 115 this.select(feature); 122 116 } 123 117 }, … … 126 120 * Called when the feature handler detects a mouse-out on a feature. 127 121 * Only responds if this.hover is true. 128 * @param {OpenLayers. Geometry}122 * @param {OpenLayers.Feature.Vector} 129 123 */ 130 outFeature: function( geometry) {124 outFeature: function(feature) { 131 125 if(!this.hover) { 132 126 return; 133 127 } 134 if(geometry.parent) { 135 geometry = geometry.parent; 136 } 137 this.unselect(geometry); 128 this.unselect(feature); 138 129 }, 139 130 … … 141 132 * Add feature to the layer's selectedFeature array, render the feature as 142 133 * selected, and call the onSelect function. 143 * @param {OpenLayers. Geometry} geometry134 * @param {OpenLayers.Feature.Vector} feature 144 135 */ 145 select: function( geometry) {136 select: function(feature) { 146 137 // Store feature style for restoration later 147 if( geometry.feature.originalStyle == null) {148 geometry.feature.originalStyle = geometry.feature.style;138 if(feature.originalStyle == null) { 139 feature.originalStyle = feature.style; 149 140 } 150 this.layer.selectedFeatures.push( geometry.feature);151 this.layer. renderer.drawGeometry(geometry, this.selectStyle);152 this.onSelect( geometry);141 this.layer.selectedFeatures.push(feature); 142 this.layer.drawFeature(feature, this.selectStyle); 143 this.onSelect(feature); 153 144 }, 154 145 … … 156 147 * Remove feature from the layer's selectedFeature array, render the feature as 157 148 * normal, and call the onUnselect function. 158 * @param {OpenLayers. Geometry} geometry149 * @param {OpenLayers.Feature.Vector} feature 159 150 */ 160 unselect: function( geometry) {151 unselect: function(feature) { 161 152 // Store feature style for restoration later 162 if( geometry.feature.originalStyle == null) {163 geometry.feature.originalStyle = geometry.feature.style;153 if(feature.originalStyle == null) { 154 feature.originalStyle = feature.style; 164 155 } 165 this.layer. renderer.drawGeometry(geometry, geometry.feature.originalStyle);166 OpenLayers.Util.removeItem(this.layer.selectedFeatures, geometry.feature);167 this.onUnselect( geometry);156 this.layer.drawFeature(feature, feature.originalStyle); 157 OpenLayers.Util.removeItem(this.layer.selectedFeatures, feature); 158 this.onUnselect(feature); 168 159 }, 169 160 branches/openlayers/2.4/lib/OpenLayers/Feature/Vector.js
r2971 r3088 28 28 geometry:null, 29 29 30 /** @type array*/31 attributes: {},32 33 /** @type strinng */30 /** @type Object */ 31 attributes: null, 32 33 /** @type String */ 34 34 state: null, 35 35 … … 47 47 OpenLayers.Feature.prototype.initialize.apply(this, [null, null, data]); 48 48 this.lonlat = null; 49 this. setGeometry(geometry);49 this.geometry = geometry; 50 50 this.state = null; 51 this.attributes = new Object(); 51 52 if (data) { 52 OpenLayers.Util.extend(this.attributes, data);53 } 53 this.attributes = OpenLayers.Util.extend(this.attributes, data); 54 } 54 55 this.style = style ? style : null; 55 56 }, … … 124 125 createPopup: function() { 125 126 return null; 126 },127 128 /**129 * Set a feature id to the feature130 *131 * @param {String} feature id to set132 */133 setFid: function(fid) {134 this.fid = fid;135 },136 137 /**138 * Set a geometry to the feature139 *140 * @param {OpenLayers.Geometry} geometry to set141 * @param {Boolean} recurse Recursively set feature (for components)142 */143 setGeometry: function(geometry, recurse) {144 if(geometry) {145 this.geometry = geometry;146 this.geometry.feature = this;147 if (recurse != false) {148 this._setGeometryFeatureReference(this.geometry, this);149 }150 }151 },152 153 /**154 * Sets recursively the reference to the feature in the geometry155 *156 * @param {OpenLayers.Geometry}157 * @param {OpenLayers.Feature}158 */159 _setGeometryFeatureReference: function(geometry, feature) {160 geometry.feature = feature;161 if (geometry.components) {162 for (var i = 0; i < geometry.components.length; i++) {163 this._setGeometryFeatureReference(geometry.components[i], feature);164 }165 }166 },167 168 /**169 * Adds attributes an attributes object to the feature.170 * (should not be in geometry but in feature class)171 *172 * @param {Attributes} attributes173 */174 setAttributes: function(attributes) {175 this.attributes=attributes;176 127 }, 177 128 … … 278 229 hoverPointRadius: 1, 279 230 hoverPointUnit: "%", 280 pointerEvents: "visiblePainted" 231 pointerEvents: "visiblePainted", 232 cursor: "pointer" 281 233 }, 282 234 'temporary': { branches/openlayers/2.4/lib/OpenLayers/Format/GML.js
r2978 r3088 166 166 } 167 167 168 feature. setGeometry(geom, false);168 feature.geometry = geom; 169 169 if (this.extractAttributes) { 170 170 feature.attributes = this.parseAttributes(xmlNode); branches/openlayers/2.4/lib/OpenLayers/Format/KML.js
r2978 r3088 81 81 } 82 82 83 feature. setGeometry(geom);83 feature.geometry = geom; 84 84 feature.attributes = this.parseAttributes(xmlNode); 85 85 branches/openlayers/2.4/lib/OpenLayers/Geometry.js
r2997 r3088 20 20 /** @type OpenLayers.Bounds */ 21 21 bounds: null, 22 23 /**24 * Cross reference back to the feature that owns this geometry so25 * that that the feature can be identified after the geometry has been26 * selected by a mouse click.27 *28 * @type OpenLayers.Feature */29 feature: null,30 22 31 23 /** … … 43 35 44 36 this.bounds = null; 45 this.feature = null;46 37 47 38 }, branches/openlayers/2.4/lib/OpenLayers/Geometry/Collection.js
r2969 r3088 73 73 /** 74 74 * @returns the components of the geometry 75 * @type Array(OpenLayers.Geometry)76 */77 getComponents: function(){78 return this.components;79 },80 81 /**82 * @returns the components of the geometry83 75 * @type String 84 76 */ branches/openlayers/2.4/lib/OpenLayers/Handler/Box.js
r2955 r3088 100 100 101 101 // TBD: use CSS classes instead 102 this.map.div.style.cursor = " default";102 this.map.div.style.cursor = ""; 103 103 104 104 this.callback("done", [result]); branches/openlayers/2.4/lib/OpenLayers/Handler/Drag.js
r2908 r3088 77 77 this.dragging = true; 78 78 this.callback("move", [evt.xy]); 79 if(document.onselectstart) { 80 if(!this.oldOnselectstart) { 81 this.oldOnselectstart = document.onselectstart; 82 document.onselectstart = function() {return false;} 83 } 79 if(!this.oldOnselectstart) { 80 this.oldOnselectstart = document.onselectstart; 81 document.onselectstart = function() {return false;} 84 82 } 85 83 } … … 96 94 if (this.started) { 97 95 this.started = false; 98 this.dragging = false;99 96 // TBD replace with CSS classes 100 this.map.div.style.cursor = " default";97 this.map.div.style.cursor = ""; 101 98 this.callback("up", [evt.xy]); 102 if(document.onselectstart) { 103 document.onselectstart = this.oldOnselectstart; 104 } 99 document.onselectstart = this.oldOnselectstart; 105 100 } 106 101 return true; … … 118 113 this.dragging = false; 119 114 // TBD replace with CSS classes 120 this.map.div.style.cursor = " default";115 this.map.div.style.cursor = ""; 121 116 this.callback("out", []); 122 117 if(document.onselectstart) { … … 137 132 click: function (evt) { 138 133 // throw away the first left click event that happens after a mouse up 139 if ( OpenLayers.Event.isLeftClick(evt) &&this.dragging) {140 this.dragging = true;134 if (this.dragging) { 135 this.dragging = false; 141 136 return false; 142 137 } branches/openlayers/2.4/lib/OpenLayers/Handler/Feature.js
r2978 r3088 22 22 23 23 /** 24 * @type {OpenLayers. Geometry}24 * @type {OpenLayers.Feature.Vector} 25 25 */ 26 geometry: null,26 feature: null, 27 27 28 28 /** … … 34 34 * a function to be called when the mouse is over 35 35 * a feature. The callback should expect to recieve 36 * a single argument, the geometry.36 * a single argument, the feature. 37 37 * @param {Object} options 38 38 */ … … 76 76 /** 77 77 * Capture double-clicks. Let the event continue propagating if the 78 * double-click doesn't hit a geometry. Otherwise call the dblclick78 * double-click doesn't hit a feature. Otherwise call the dblclick 79 79 * callback. 80 80 * … … 93 93 */ 94 94 select: function(type, evt) { 95 var geometry = this.layer.renderer.getGeometryFromEvent(evt);96 if( geometry) {95 var feature = this.layer.getFeatureFromEvent(evt); 96 if(feature) { 97 97 // three cases: 98 98 // over a new, out of the last and over a new, or still on the last 99 if(!this. geometry) {100 // over a new geometry101 this.callback('over', [ geometry]);102 } else if(this. geometry != geometry) {99 if(!this.feature) { 100 // over a new feature 101 this.callback('over', [feature]); 102 } else if(this.feature != feature) { 103 103 // out of the last and over a new 104 this.callback('out', [this. geometry]);105 this.callback('over', [ geometry]);104 this.callback('out', [this.feature]); 105 this.callback('over', [feature]); 106 106 } 107 this. geometry = geometry;108 this.callback(type, [ geometry]);107 this.feature = feature; 108 this.callback(type, [feature]); 109 109 return true; 110 110 } else { 111 if(this. geometry) {111 if(this.feature) { 112 112 // out of the last 113 this.callback('out', [this. geometry]);114 this. geometry= null;113 this.callback('out', [this.feature]); 114 this.feature = null; 115 115 } 116 116 return false; branches/openlayers/2.4/lib/OpenLayers/Handler/Path.js
r2943 r3088 18 18 19 19 /** 20 * @type OpenLayers. Geometry.LineString20 * @type OpenLayers.Feature.Vector 21 21 * @private 22 22 */ … … 66 66 * Add temporary geometries 67 67 */ 68 createGeometry: function() { 69 this.line = new OpenLayers.Geometry.LineString(); 70 this.point = new OpenLayers.Geometry.Point(); 68 createFeature: function() { 69 this.line = new OpenLayers.Feature.Vector( 70 new OpenLayers.Geometry.LineString()); 71 this.point = new OpenLayers.Feature.Vector( 72 new OpenLayers.Geometry.Point()); 71 73 }, 72 74 … … 74 76 * Destroy temporary geometries 75 77 */ 76 destroy Geometry: function() {78 destroyFeature: function() { 77 79 this.line.destroy(); 78 80 this.point.destroy(); … … 84 86 */
