From a0ac379b28daeac8deddfae34f0015935a811bac Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期五, 07 二月 2025 17:39:47 +0800 Subject: [PATCH] 修改细分网格的展示逻辑 --- src/utils/map/grid.js | 42 ++++++++++++++++++++++++++++-------------- 1 files changed, 28 insertions(+), 14 deletions(-) diff --git a/src/utils/map/grid.js b/src/utils/map/grid.js index f421dae..a3d8d08 100644 --- a/src/utils/map/grid.js +++ b/src/utils/map/grid.js @@ -84,22 +84,36 @@ * 鏂囨湰鏍囪 * 鍙慨鏀筽osition */ -function textMaker(position, text, anchor) { +function textMaker(position, text, anchor, type) { + let style = {}; + if (type == 'data') { + style = { + 'font-size': '12px', + 'text-align': 'center', + color: 'white', + background: '#122b54a9', + 'text-shadow': 'black 2px 2px 2px', + border: '0px', + 'margin-top': '4px' + }; + } else if (type == 'rank') { + style = { + 'font-size': '14px', + 'text-align': 'center', + color: 'white', + background: 'transparent', + 'text-shadow': 'black 2px 2px 2px', + 'border-radius': '2px', + border: '1px solid #122b54a9', + 'margin-bottom': '4px' + }; + } // eslint-disable-next-line no-undef return new AMap.Text({ text: text, anchor, position: position, - style: { - 'font-size': '13px', - 'text-align': 'center', - color: 'white', - 'background-color': 'transparent', - 'text-shadow': 'black 2px 2px 2px', - 'border-radius': '2px', - border: '1px', - padding: '4px' - } + style: style }); } @@ -204,17 +218,17 @@ return gridViews; }, - drawGridText(points, textViews, anchor) { + drawGridText(points, textViews, anchor, type) { if (textViews) { points.forEach((p, i) => { textViews[i].setPosition(p.lnglat_GD); textViews[i].setText(p.data); }); - return textViews; + return { textViews }; } else { const _textViews = []; points.forEach((p) => { - const m = textMaker(p.lnglat_GD, p.data, anchor); + const m = textMaker(p.lnglat_GD, p.data, anchor, type); _textViews.push(m); }); map.add(_textViews); -- Gitblit v1.9.3