Compare commits
	
		
			No commits in common. "b2958f15d7534e50c8ac457c2e67e29aba868264" and "9c703b50aa4f382a882a5d142bb11d313188833f" have entirely different histories.
		
	
	
		
			b2958f15d7
			...
			9c703b50aa
		
	
		
| @ -232,16 +232,7 @@ function toggle_search() { | |||||||
| function htmlEntities(str) { | function htmlEntities(str) { | ||||||
|     return String(str).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"'); |     return String(str).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"'); | ||||||
| } | } | ||||||
| 
 | var regex; | ||||||
| function polyline_get_middle_coords(coords) { |  | ||||||
| 	var ret = [2]; |  | ||||||
| 	ret[0] = coords[0][0] + (coords[coords.length - 1][0] - coords[0][0]) / 2; |  | ||||||
| 	ret[1] = coords[0][1] + (coords[coords.length - 1][1] - coords[0][1]) / 2; |  | ||||||
| 	return ret; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| var highlighted_line; |  | ||||||
| var default_street_color = "#3388ff"; |  | ||||||
| function search(e) { | function search(e) { | ||||||
| 	var query = htmlEntities(document.getElementById("search_query").value); | 	var query = htmlEntities(document.getElementById("search_query").value); | ||||||
| 	document.getElementById('search_results').innerHTML = ""; | 	document.getElementById('search_results').innerHTML = ""; | ||||||
| @ -262,23 +253,6 @@ function search(e) { | |||||||
| 						results.appendChild(el); | 						results.appendChild(el); | ||||||
| 					} | 					} | ||||||
| 					break; | 					break; | ||||||
| 				case "LineString": |  | ||||||
| 					if (item.options.color != default_street_color) { // De-hilight last search
 |  | ||||||
| 						item.options.color = default_street_color; |  | ||||||
| 						item.redraw(); |  | ||||||
| 					} |  | ||||||
| 					regex = new RegExp(query, 'i'); |  | ||||||
| 
 |  | ||||||
| 					if (item.feature.properties.name.match(regex)) { |  | ||||||
| 						console.log(item.options.color); |  | ||||||
| 						item.options.color = "#FF0000"; |  | ||||||
| 						item.redraw(); |  | ||||||
| 						el = document.createElement("li"); |  | ||||||
| 						zpos = polyline_get_middle_coords(item.feature.geometry.coordinates); |  | ||||||
| 						el.innerHTML = "[" + layers._layers[i].name + "] " + '<a href="#" onclick="latLng2 = L.latLng(' + zpos[1] + ',' + zpos[0] + '); jump_to(latLng2); return false;">' + item.feature.properties.name + "</a>"; |  | ||||||
| 						results.appendChild(el); |  | ||||||
| 					} |  | ||||||
| 					break; |  | ||||||
| 				default: | 				default: | ||||||
| 					break; | 					break; | ||||||
| 				} | 				} | ||||||
|  | |||||||
| @ -77,7 +77,10 @@ if (editor_mode) { | |||||||
| 			// polyline.on('dragend', onDragEnd); // TODO: Doesn't work, see "workaround" below
 | 			// polyline.on('dragend', onDragEnd); // TODO: Doesn't work, see "workaround" below
 | ||||||
| 			polyline.enableEdit(); | 			polyline.enableEdit(); | ||||||
| 			if (interactive) { | 			if (interactive) { | ||||||
| 				latlng = L.latLng(polyline_get_middle_coords(coords)); | 				console.log(coords); | ||||||
|  | 				latlng = L.latLng(coords[0][0] + (coords[coords.length - 1][0] - coords[0][0]) / 2, | ||||||
|  | 					 coords[0][1] + (coords[coords.length - 1][1] - coords[0][1]) / 2); | ||||||
|  | 				console.log("NEW=" + latlng); | ||||||
| 				jump_to(latlng, 8); | 				jump_to(latlng, 8); | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user