You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							56 lines
						
					
					
						
							1.7 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							56 lines
						
					
					
						
							1.7 KiB
						
					
					
				| var SelectPoint = function (parent) { | |
|     this.Parent = parent; | |
| 
 | |
|     this.Startup = function () { | |
|         $('#copy-longitude').on('click', this.OnClickLngClick.bind(this)); | |
|         $('#copy-latitude').on('click', this.onCopyLatClick.bind(this)); | |
|         $('#close-select-point-dialog').on('click', this.HideDialog.bind(this)); | |
|         $('#dialog-select-point-cancel').on('click', this.HideDialog.bind(this)); | |
|     }; | |
| 
 | |
|     this.ShowDialog = function (point) { | |
|         $('#dialog-select-point').show(); | |
|         $("#lng").val(this.getLatLng(point.lng)); | |
|         $("#lat").val(this.getLatLng(point.lat)); | |
|     }; | |
| 
 | |
|     this.HideDialog = function () { | |
|         $('#dialog-select-point').hide(); | |
|         $('#map').css('cursor', '-webkit-grab'); | |
| 
 | |
|         this.Parent.isSelected = false; | |
|     }; | |
| 
 | |
|     this.getLatLng = function (value) { | |
|         value = value.toString() | |
|         let index = value.indexOf('.') | |
|         if (index !== -1) { | |
|             value = value.substring(0, 6 + index + 1) | |
|         } else { | |
|             value = value.substring(0) | |
|         } | |
|         return parseFloat(value).toFixed(6) | |
|     } | |
| 
 | |
|     this.OnClickLngClick = function () { | |
|         if ($("#lng").val().trim() === '') { | |
|             alert('请输入经度'); | |
|             return; | |
|         } else { | |
|             var selected = document.querySelector('#lng'); | |
|             selected.select(); | |
|             document.execCommand('Copy'); | |
|         } | |
|     }; | |
| 
 | |
|     this.onCopyLatClick = function () { | |
|         if ($("#lat").val().trim() === '') { | |
|             alert('请输入纬度'); | |
|             return; | |
|         } else { | |
|             var selected = document.querySelector('#lat'); | |
|             selected.select(); | |
|             document.execCommand('Copy'); | |
|         } | |
|     } | |
| } |