feat: 调整官网水位图 demo

This commit is contained in:
2912401452 2022-03-20 17:25:14 +08:00
parent 67fc3c1e82
commit 5c1fbee30e
2 changed files with 4 additions and 2 deletions

View File

@ -6,7 +6,7 @@ function draw(option) {
const [ width, height ] = size;
const radius = 30,
rectWidth = radius * 2 * window.devicePixelRatio;
rectWidth = radius * 2;
const rectHeight = rectWidth;
ctx.clearRect(0, 0, width, height);

View File

@ -18,7 +18,7 @@ export default class Demo extends React.Component {
const [width, height] = size;
let radius = 30,
rectWidth = radius * 2 * window.devicePixelRatio;
rectWidth = radius * 2;
const rectHeight = rectWidth;
ctx.clearRect(0, 0, width, height);
@ -80,6 +80,8 @@ export default class Demo extends React.Component {
points.map((point) => {
let pixelCenter = mapService.lngLatToContainer([point.lng, point.lat]);
pixelCenter.x *= window.devicePixelRatio;
pixelCenter.y *= window.devicePixelRatio;
let rectStartX = pixelCenter.x - radius;
const rectStartY = pixelCenter.y - radius;