6 changed files with 109 additions and 3 deletions
Binary file not shown.
Binary file not shown.
@ -0,0 +1,56 @@ |
|||
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', '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'); |
|||
} |
|||
} |
|||
} |
Loading…
Reference in new issue