Merge pull request #1351 from phl0/dynamicInitialMapPosition

Use station location as base for map
这个提交包含在:
Peter Goodhall 2022-01-05 16:13:09 +00:00 提交者 GitHub
当前提交 e58d91ad94
找不到此签名对应的密钥
GPG 密钥 ID: 4AEE18F83AFDEB23
共有 2 个文件被更改,包括 19 次插入2 次删除

查看文件

@ -678,7 +678,24 @@ $(document).on('keypress',function(e) {
<script>
var markers = L.layerGroup();
var mymap = L.map('qsomap').setView([51.505, -0.09], 13);
var pos = [51.505, -0.09];
var mymap = L.map('qsomap').setView(pos, 12);
<?php
$this->load->model('stations');
$active_station_id = $this->stations->find_active();
$station_profile = $this->stations->profile($active_station_id);
$active_station_info = $station_profile->row();
if ($active_station_info->station_gridsquare != "") { ?>
$.getJSON('logbook/qralatlngjson/<?php echo $active_station_info->station_gridsquare; ?>', function(result) {
mymap.panTo([result[0], result[1]]);
pos = result;
})
<?php } else if (null !== $this->config->item('locator')) { ?>
$.getJSON('logbook/qralatlngjson/<?php echo $this->config->item('locator'); ?>', function(result) {
mymap.panTo([result[0], result[1]]);
pos = result;
})
<?php } ?>
L.tileLayer('<?php echo $this->optionslib->get_option('map_tile_server');?>', {
maxZoom: 18,

查看文件

@ -275,7 +275,7 @@ function reset_fields() {
$('#qso-last-table').show();
$('#partial_view').hide();
mymap.setView([51.505, -0.09], 13);
mymap.setView(pos, 12);
mymap.removeLayer(markers);
$('.callsign-suggest').hide();
}