- Description: Component Ref. See [LarkMapRefAttributes](#larkmaprefattributes) for details.
- Default: --
Event Handlers:
- onSceneLoaded: (scene: Scene) => void
- Description: Callback when the scene is loaded successfully.
- Default: --
- onLoaded: (e?: any) => void
- Description: Event triggered when loading is complete.
- Default: --
- onDestroy: (e?: any) => void
- Description: Event triggered when the component is destroyed.
- Default: --
- onResize: (e?: any) => void
- Description: Event triggered when the map container size changes.
- Default: --
- onMapMove: (e?: any) => void
- Description: Event triggered when the map is panned.
- Default: --
- onMoveStart: (e?: any) => void
- Description: Event triggered when map panning starts.
- Default: --
- onMoveEnd: (e?: any) => void
- Description: Event triggered after map movement ends, including panning and zooming of the center point. If the map has a pan easing effect, it triggers after the easing ends.
- Default: --
- onZoomStart: (e?: any) => void
- Description: Event triggered when zooming starts.
- Default: --
- onZoomEnd: (e?: any) => void
- Description: Event triggered when zooming stops.
- Default: --
- onZoomChange: (e?: any) => void
- Description: Event triggered after the map zoom level changes.
- Default: --
- onClick: (e?: any) => void
- Description: Click event.
- Default: --
- onDblclick: (e?: any) => void
- Description: Double-click event.
- Default: --
- onContextMenu: (e?: any) => void
- Description: Right-click event.
- Default: --
- onMouseMove: (e?: any) => void
- Description: Event triggered when the mouse moves over the map.
- Default: --
- onMouseWheel: (e?: any) => void
- Description: Event triggered when the mouse wheel starts zooming the map.
- Default: --
- onMouseDown: (e?: any) => void
- Description: Event triggered when the mouse button is pressed down on the map.
- Default: --
- onMouseUp: (e?: any) => void
- Description: Event triggered when the mouse button is released on the map.
- Default: --
- onMouseOver: (e?: any) => void
- Description: Event triggered when the mouse cursor moves into the map container.
- Default: --
- onMouseOut: (e?: any) => void
- Description: Event triggered when the mouse cursor moves out of the map container.
- Default: --
- onDragStart: (e?: any) => void
- Description: Event triggered when map dragging starts.
- Default: --
- onDragging: (e?: any) => void
- Description: Event triggered during map dragging.
- Default: --
- onDragEnd: (e?: any) => void
- Description: Event triggered when map dragging stops. If the map has a pan easing effect, it triggers before the easing starts.
- Default: --
```
--------------------------------
### MouseLocationControl API Documentation
Source: https://github.com/antvis/larkmap/blob/main/src/components/Control/MouseLocationControl/index.md
API 文档描述了 MouseLocationControl 组件的可用参数、类型定义以及事件回调。允许开发者自定义经纬度转换、控件位置、样式以及响应位置变化。
```APIDOC
MouseLocationControl:
描述: 光标经纬度组件,用于实时展示当前光标在地图上所对应的经纬度。
参数:
transform: 转换光标所在经纬度的回调函数
类型: (position: [number, number]) => [number, number]
默认值: -
position: 控件被添加到地图中的位置以及排列方式,详情可见 [控件插槽](https://l7.antv.antgroup.com/api/component/control/control#插槽)
类型: [Position](#position)
默认值: 'bottomleft'
className: 自定义样式名
类型: string
默认值: -
style: 自定义样式
类型: CSSProperties
默认值: -
onLocationChange: 光标所在经纬度发生变化时触发的回调
类型: (position: [number, number]) => void
默认值: -
onAdd: 组件被添加时的回调
类型: (this) => void
默认值: -
onRemove: 组件被移除时的回调
类型: (this) => void
默认值: -
onShow: 组件显示时的回调
类型: (this) => void
默认值: -
onHide: 组件隐藏时的回调
类型: (this) => void
默认值: -
类型定义:
Position:
类型: 'topleft' | 'lefttop' | 'topright' | 'righttop' | 'bottomleft' | 'leftbottom' | 'bottomright' | 'rightbottom' | 'topcenter' | 'bottomcenter' | 'leftcenter' | 'rightcenter'
说明:
'topleft': ↖ 左上角,纵向排列
'lefttop': ↖ 左上角,横向排列
'topright': ↗ 右上角,纵向排列
'righttop': ↗ 右上角,横向排列
'bottomleft': ↙ 左下角,纵向排列
'leftbottom': ↙ 左下角,横向排列
'bottomright': ↘ 右下角,纵向排列
'rightbottom': ↘ 右下角,横向排列
'topcenter': ↑ 上方中央,横向排列
'bottomcenter': ↓ 下方中间,横向排列
'leftcenter': ← 左边中间,纵向排列
'rightcenter': → 右边中间,纵向排列
```
--------------------------------
### Default LegendCategories Demo
Source: https://github.com/antvis/larkmap/blob/main/src/components/Legend/LegendCategories/index.md
Demonstrates the default usage of the LegendCategories component. This snippet shows the basic setup and rendering of a categorical legend without specific map integration.
```tsx
// Code for ./demos/default.tsx not provided in the input.
```
--------------------------------
### Basic LarkMap Usage in React
Source: https://github.com/antvis/larkmap/blob/main/README.md
Demonstrates how to integrate the LarkMap component into a React application. It shows basic configuration for map type, style, initial center coordinates, pitch, and zoom level.
```jsx
import React from 'react';
import { LarkMap } from '@antv/larkmap';
const config = {
mapType: 'Gaode',
mapOptions: {
style: 'light',
center: [120.210792, 30.246026],
pitch: 0,
zoom: 8,
rotation: 0,
},
};
export default () => {
return ;
};
```
--------------------------------
### useDrawGroup Hook Example
Source: https://github.com/antvis/larkmap/blob/main/src/components/Draw/use-draw-group/index.md
Demonstrates the default usage of the useDrawGroup hook for managing L7Draw instances. This snippet would typically show how to integrate the hook into a React component.
```typescript
// This is a placeholder for the code found in ./demos/default.tsx
// The actual code content is not provided in the input text.
// Example structure:
/*
import React from 'react';
import { useDrawGroup } from '@antv/larkmap';
const MyMapComponent = () => {
const { drawMap, drawGroupData, setDrawGroupData, activeDraw, setActiveDraw } = useDrawGroup({
config: {
point: true,
line: { /* line config */ },
},
commonOptions: { /* common draw options */ },
});
// ... rest of the component logic
return (
{/* Map rendering and controls */}
);
};
export default MyMapComponent;
*/
```