mirror of https://gitee.com/antv-l7/antv-l7
style: lint style
This commit is contained in:
parent
3a320c7aed
commit
aa85b1b4f9
|
@ -9,17 +9,15 @@ L7 的自定义图层允许用户通过 canvas 绘制的方法自定义图层的
|
||||||
|
|
||||||
```jsx
|
```jsx
|
||||||
import { CanvasLayer } from '@antv/l7';
|
import { CanvasLayer } from '@antv/l7';
|
||||||
const layer = new CanvasLayer({})
|
const layer = new CanvasLayer({}).style({
|
||||||
.style({
|
drawingOnCanvas: (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.clearRect(0, 0, width, height);
|
||||||
// canvas 绘制
|
// canvas 绘制
|
||||||
|
},
|
||||||
}
|
});
|
||||||
});
|
|
||||||
```
|
```
|
||||||
|
|
||||||
<img width="60%" style="display: block;margin: 0 auto;" alt="案例" src='https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*hUmNQJ1sAb8AAAAAAAAAAAAAARQnAQ'/>
|
<img width="60%" style="display: block;margin: 0 auto;" alt="案例" src='https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*hUmNQJ1sAb8AAAAAAAAAAAAAARQnAQ'/>
|
||||||
|
@ -27,9 +25,11 @@ const layer = new CanvasLayer({})
|
||||||
[在线案例](../../examples/point/chart#custom)
|
[在线案例](../../examples/point/chart#custom)
|
||||||
|
|
||||||
### source
|
### source
|
||||||
|
|
||||||
🌟 CanvasLayer 不需要设置 source。
|
🌟 CanvasLayer 不需要设置 source。
|
||||||
|
|
||||||
### Event
|
### Event
|
||||||
|
|
||||||
🌟 CanvasLayer 暂不支持交互动作。
|
🌟 CanvasLayer 暂不支持交互动作。
|
||||||
|
|
||||||
### animate
|
### animate
|
||||||
|
@ -39,6 +39,7 @@ const layer = new CanvasLayer({})
|
||||||
```javascript
|
```javascript
|
||||||
layer.animate(true);
|
layer.animate(true);
|
||||||
```
|
```
|
||||||
|
|
||||||
[在线案例](../../examples/point/chart#custom)
|
[在线案例](../../examples/point/chart#custom)
|
||||||
|
|
||||||
### style
|
### style
|
||||||
|
@ -50,6 +51,7 @@ layer.animate(true);
|
||||||
#### update
|
#### update
|
||||||
|
|
||||||
指定 CanavsLayer 的更新方式,update 有两个值 'always'、'dragend',默认为 'always'
|
指定 CanavsLayer 的更新方式,update 有两个值 'always'、'dragend',默认为 'always'
|
||||||
|
|
||||||
- always 总是更新
|
- always 总是更新
|
||||||
- dragend 地图拖动完后/缩放完后更新
|
- dragend 地图拖动完后/缩放完后更新
|
||||||
|
|
||||||
|
@ -59,15 +61,17 @@ layer.animate(true);
|
||||||
options: {
|
options: {
|
||||||
canvas: HTMLCanvasELement;
|
canvas: HTMLCanvasELement;
|
||||||
ctx: CanvasRenderingContext2D;
|
ctx: CanvasRenderingContext2D;
|
||||||
mapService: IMapService
|
mapService: IMapService;
|
||||||
size: [number, number];
|
size: [number, number];
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
drawingOnCanvas,这是一个函数,接受相关参数,用户在该函数中写 canvas 的绘制逻辑
|
|
||||||
- canvas CanvasLayer 生成的 canvas DOM 节点
|
drawingOnCanvas,这是一个函数,接受相关参数,用户在该函数中写 canvas 的绘制逻辑
|
||||||
- ctx 生成的 canvas DOM 的上下文
|
|
||||||
- mapService 当前地图的 mapService,主要提供 lngLatToContainer 方法
|
- canvas CanvasLayer 生成的 canvas DOM 节点
|
||||||
- size 当前视图的实际绘图范围的大小
|
- ctx 生成的 canvas DOM 的上下文
|
||||||
|
- mapService 当前地图的 mapService,主要提供 lngLatToContainer 方法
|
||||||
|
- size 当前视图的实际绘图范围的大小
|
||||||
|
|
||||||
#### lngLatToContainer([lng,lat]): {x: x, y: y}
|
#### lngLatToContainer([lng,lat]): {x: x, y: y}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue