From dfd1a6dd1aa4bdcc5816750df81b889672f4f995 Mon Sep 17 00:00:00 2001 From: fangjiakai <450850793@qq.com> Date: Wed, 28 Feb 2024 10:50:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=BA=E5=91=98=E8=81=9A=E9=9B=86=E5=91=8A?= =?UTF-8?q?=E8=AD=A6=E5=9C=B0=E5=9B=BE=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/map_tools/map.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/map_tools/map.js b/src/components/map_tools/map.js index b539991..af41e9b 100644 --- a/src/components/map_tools/map.js +++ b/src/components/map_tools/map.js @@ -336,14 +336,18 @@ const addEntity = (id, name, lon, lat, height) => { export const handleViewAlarm = (alarm, userList) => { const canvas = document.createElement("canvas"); - canvas.width = 100; - canvas.height = 30; + const width = 100; + const height = 30; + canvas.width = width; + canvas.height = height; const ctx = canvas.getContext("2d"); ctx.fillStyle = "#000000"; ctx.fillRect(0, 0, 100, 50); ctx.fillStyle = "#ff0000"; ctx.font = "normal bold 20px Arial"; - ctx.fillText("聚集告警", 5, 15); + ctx.textAlign = "center"; + ctx.textBaseline = "middle"; + ctx.fillText("聚集告警", width / 2, height / 2); // 聚集圆锥特效 const Cone = new window.CustomCesium.Cone(window.$icy);