Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
map-demo
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2025-02-20 16:10:42 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e955ce719b7afb4a0a6e6ddf9f8cf385125439a7
e955ce71
1 parent
63ac3b49
fix 上传图片比例问题,加了系数调整。
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
src/views/mapCutter.vue
src/views/mapCutter.vue
View file @
e955ce7
<!--
* @Date: 2025-01-22 11:40:12
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-02-
08 17:48:34
* @LastEditTime: 2025-02-
20 16:10:07
* @FilePath: /map-demo/src/views/mapCutter.vue
* @Description: 文件描述
-->
...
...
@@ -146,7 +146,7 @@ const zoom_options = [
const map_left_bottom_range = ref(null); // 120.583625,31.311858
const map_right_top_range = ref(null); // 120.591047,31.318265
const map_center = ref([1
20.587648, 31.314616
]);
const map_center = ref([1
17.13291,26.873757
]);
const log_lnglat = ref('') // 获取当前地址经纬度
...
...
@@ -282,7 +282,7 @@ async function addImageToMap(url) {
const imgWidth = img.width;
const imgHeight = img.height;
const aspectRatio =
imgWidth / imgHeight
; // 图片宽高比
const aspectRatio =
Number((imgWidth / imgHeight).toFixed(3))
; // 图片宽高比
// 获取左下角经纬度
const [lng1, lat1] = map_left_bottom_range.value;
...
...
@@ -301,7 +301,7 @@ async function addImageToMap(url) {
if (mapLngWidth / mapLatHeight > aspectRatio) {
// 地图太宽了,需要基于高度调整宽度
const latHeight = mapLatHeight * img_ratio.value; // 设定图片占地图的比例(可以调整)
const lngWidth = latHeight *
aspectRatio
;
const lngWidth = latHeight *
(aspectRatio + 0.2)
;
lat2 = lat1 + latHeight;
lng2 = lng1 + lngWidth;
...
...
Please
register
or
login
to post a comment