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
2024-09-10 17:58:59 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
68a9188f323f199c80077311e1ef99ccc8479380
68a9188f
1 parent
049fa33e
地图标题文字新增垂直和水平排序现实
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
1 deletions
src/views/index.vue
src/views/index.vue
View file @
68a9188
<!--
* @Date: 2023-05-19 14:54:27
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-09-
02 15:32:36
* @LastEditTime: 2024-09-
10 17:37:37
* @FilePath: /map-demo/src/views/index.vue
* @Description: 公众地图主体页面
-->
...
...
@@ -423,6 +423,34 @@ export default {
// })
// // marker合集
// this.markerSum.push(marker);
// 创建一个 文字 实例 - 适配竖型文字
// let writing_mode = 'vertical'; // 文字方向
if (entity_info[i]?.writing_mode === 'vertical') { // 标题文字垂直
var textMarker = new AMap.Text({
text: entity_info[i].name, //标记显示的文本内容
anchor: "center", //设置文本标记锚点位置
// draggable: true, //是否可拖拽
// cursor: "pointer", //指定鼠标悬停时的鼠标样式。
// angle: 10, //点标记的旋转角度
style: {
//设置文本样式,Object 同 css 样式表
// "padding": ".75rem 1.25rem",
// "margin-bottom": "1rem",
// "border-radius": ".25rem",
"background-color": "#965f13",
"width": "1rem",
"border-width": 0,
// "box-shadow": "0 2px 6px 0 rgba(114, 124, 245, .5)",
"text-align": "center",
"font-size": "0.8rem",
"color": "white",
"writing-mode": "vertical-rl",
"text-orientation": "mixed",
},
position: entity_info[i].position, //点标记在地图上显示的位置
});
textMarker.setMap(this.map); //将文本标记设置到地图上
} else { // 默认方向
// 创建一个 LabelMarker 实例
var labelMarker = new AMap.LabelMarker({
position: entity_info[i].position,
...
...
@@ -474,6 +502,7 @@ export default {
// 将 LabelsLayer 添加到地图上
// this.map.add(labelsLayer);
this.markerSum.push(labelsLayer);
}
})
this.map.add(this.markerSum);
},
...
...
Please
register
or
login
to post a comment