style: lint style

This commit is contained in:
2912401452 2022-03-18 17:44:20 +08:00
parent b97684cc59
commit 6f85fc5776
1 changed files with 45 additions and 47 deletions

View File

@ -1,5 +1,4 @@
// import { Scene, CanvasLayer } from '@antv/l7'; import { Scene, CanvasLayer } from '@antv/l7';
import { Scene } from '@antv/l7';
import { GaodeMap } from '@antv/l7-maps'; import { GaodeMap } from '@antv/l7-maps';
const scene = new Scene({ const scene = new Scene({
@ -11,53 +10,52 @@ const scene = new Scene({
}) })
}); });
scene.on('loaded', () => { scene.on('loaded', () => {
// fetch( fetch(
// 'https://gw.alipayobjects.com/os/basement_prod/337ddbb7-aa3f-4679-ab60-d64359241955.json' 'https://gw.alipayobjects.com/os/basement_prod/337ddbb7-aa3f-4679-ab60-d64359241955.json'
// ) )
// .then(res => res.json()) .then(res => res.json())
// .then(data => { .then(data => {
// const layer = new CanvasLayer({}) const layer = new CanvasLayer({})
// .style({ .style({
// zIndex: 10, zIndex: 10,
// update: 'dragend', update: 'dragend',
// drawingOnCanvas: function draw(option) { drawingOnCanvas: option => {
// const { size, ctx, mapService } = option; const { size, ctx, mapService } = option;
// const [ width, height ] = size; const [ width, height ] = size;
ctx.clearRect(0, 0, width, height);
ctx.fillStyle = 'rgba(0, 200, 0, 0.2)';
data.features.map(feature => {
const pixelCenter = mapService.lngLatToContainer(
feature.geometry.coordinates
);
pixelCenter.x *= window.devicePixelRatio;
pixelCenter.y *= window.devicePixelRatio;
if (
pixelCenter.x < 0 ||
pixelCenter.y < 0 ||
pixelCenter.x > width ||
pixelCenter.y > height
) { return ''; }
ctx.beginPath();
ctx.arc(
pixelCenter.x,
pixelCenter.y,
feature.properties.capacity / 200,
0,
Math.PI * 2
);
ctx.fill();
ctx.closePath();
return '';
});
return '';
}
});
// ctx.clearRect(0, 0, width, height); scene.addLayer(layer);
// ctx.fillStyle = 'rgba(0, 200, 0, 0.2)'; return '';
// data.features.map(feature => { });
// const pixelCenter = mapService.lngLatToContainer(
// feature.geometry.coordinates
// );
// pixelCenter.x *= window.devicePixelRatio;
// pixelCenter.y *= window.devicePixelRatio;
// if (
// pixelCenter.x < 0 ||
// pixelCenter.y < 0 ||
// pixelCenter.x > width ||
// pixelCenter.y > height
// ) { return; }
// ctx.beginPath();
// ctx.arc(
// pixelCenter.x,
// pixelCenter.y,
// feature.properties.capacity / 200,
// 0,
// Math.PI * 2
// );
// ctx.fill();
// ctx.closePath();
// return '';
// });
// return '';
// }
// });
// scene.addLayer(layer);
// return '';
// });
return ''; return '';
}); });