13 |
--------------------------------------------------------------------------------
/docs/examples/taxiTrips.md:
--------------------------------------------------------------------------------
1 | ---
2 | toc: false
3 | order: 10
4 | nav:
5 | title: 示例
6 | path: /examples
7 | order: 4
8 | ---
9 |
10 | ## 纽约公交路径
11 |
12 |
13 |
--------------------------------------------------------------------------------
/docs/examples/highSpeedRail.md:
--------------------------------------------------------------------------------
1 | ---
2 | toc: false
3 | order: 1
4 | nav:
5 | title: 示例
6 | path: /examples
7 | order: 4
8 | ---
9 |
10 | ## 高铁站点
11 |
12 |
13 |
--------------------------------------------------------------------------------
/docs/examples/iconImage.md:
--------------------------------------------------------------------------------
1 | ---
2 | toc: false
3 | order: 25
4 | nav:
5 | title: 示例
6 | path: /examples
7 | order: 4
8 | ---
9 |
10 | ## 北京房价视觉分布
11 |
12 |
13 |
--------------------------------------------------------------------------------
/docs/examples/nycCensus.md:
--------------------------------------------------------------------------------
1 | ---
2 | toc: false
3 | order: 9
4 | nav:
5 | title: 示例
6 | path: /examples
7 | order: 4
8 | ---
9 |
10 | ## 纽约市人口普查区
11 |
12 |
13 |
--------------------------------------------------------------------------------
/docs/examples/photoSpots.md:
--------------------------------------------------------------------------------
1 | ---
2 | toc: false
3 | order: 4
4 | nav:
5 | title: 示例
6 | path: /examples
7 | order: 4
8 | ---
9 |
10 | ## 全球拍照最多的景点
11 |
12 |
13 |
--------------------------------------------------------------------------------
/docs/examples/sfContour.md:
--------------------------------------------------------------------------------
1 | ---
2 | toc: false
3 | order: 15
4 | nav:
5 | title: 示例
6 | path: /examples
7 | order: 4
8 | ---
9 |
10 | ## 旧金山海拔等高线
11 |
12 |
13 |
--------------------------------------------------------------------------------
/docs/examples/sharedBike.md:
--------------------------------------------------------------------------------
1 | ---
2 | toc: false
3 | order: 19
4 | nav:
5 | title: 示例
6 | path: /examples
7 | order: 4
8 | ---
9 |
10 | ## 共享单单车区域和点位
11 |
12 |
13 |
--------------------------------------------------------------------------------
/docs/examples/topicLayer.md:
--------------------------------------------------------------------------------
1 | ---
2 | toc: false
3 | order: 6
4 | nav:
5 | title: 示例
6 | path: /examples
7 | order: 4
8 | ---
9 |
10 | ## 全国幼儿园分布数据
11 |
12 |
13 |
--------------------------------------------------------------------------------
/docs/examples/iconFontLayer.md:
--------------------------------------------------------------------------------
1 | ---
2 | toc: false
3 | order: 24
4 | nav:
5 | title: 示例
6 | path: /examples
7 | order: 4
8 | ---
9 |
10 | ## 各地天气标注
11 |
12 |
13 |
--------------------------------------------------------------------------------
/docs/examples/photoHotmap.md:
--------------------------------------------------------------------------------
1 | ---
2 | toc: false
3 | order: 20
4 | nav:
5 | title: 示例
6 | path: /examples
7 | order: 4
8 | ---
9 |
10 | ## 拍照景点-蜂窝聚合图
11 |
12 |
13 |
--------------------------------------------------------------------------------
/docs/examples/ukcommute.md:
--------------------------------------------------------------------------------
1 | ---
2 | toc: false
3 | order: 11
4 | nav:
5 | title: 示例
6 | path: /examples
7 | order: 4
8 | ---
9 |
10 | ## 英格兰和威尔士的通勤地图
11 |
12 |
13 |
--------------------------------------------------------------------------------
/docs/examples/highspeedTime.md:
--------------------------------------------------------------------------------
1 | ---
2 | toc: false
3 | order: 2
4 | nav:
5 | title: 示例
6 | path: /examples
7 | order: 4
8 | ---
9 |
10 | ## 郑州高铁直达各省份时间
11 |
12 |
13 |
--------------------------------------------------------------------------------
/docs/examples/losAngelesHomes.md:
--------------------------------------------------------------------------------
1 | ---
2 | toc: false
3 | order: 17
4 | nav:
5 | title: 示例
6 | path: /examples
7 | order: 4
8 | ---
9 |
10 | ## 洛杉矶房屋价值
11 |
12 |
13 |
--------------------------------------------------------------------------------
/docs/common/layer/attribute/scale.md:
--------------------------------------------------------------------------------
1 | ---
2 | hide: true
3 | ---
4 |
5 | `ScaleConfig` optional default: `{}`
6 |
7 | 关联字段的映射 scale 类型,有以下 scale 类型:
8 |
9 | - linear:线性
10 | - power:指数
11 | - log:对数
12 | - quantile:等分位
13 | - quantize:等间距
14 | - cat:枚举
15 |
--------------------------------------------------------------------------------
/docs/examples/beijingHousePrice.md:
--------------------------------------------------------------------------------
1 | ---
2 | toc: false
3 | order: 22
4 | nav:
5 | title: 示例
6 | path: /examples
7 | order: 4
8 | ---
9 |
10 | ## 北京房价数据
11 |
12 |
13 |
--------------------------------------------------------------------------------
/docs/examples/meteoriteLanding.md:
--------------------------------------------------------------------------------
1 | ---
2 | toc: false
3 | order: 18
4 | nav:
5 | title: 示例
6 | path: /examples
7 | order: 4
8 | ---
9 |
10 | ## 全球陨石着地区域
11 |
12 |
13 |
--------------------------------------------------------------------------------
/scripts/sync-version.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const fs = require('fs-extra');
3 |
4 | const { version } = require('../package.json');
5 |
6 | fs.writeFileSync(path.join(__dirname, '..', 'src', 'version.ts'), `export default '${version}'`, 'utf8');
7 |
--------------------------------------------------------------------------------
/docs/examples/californiaEarthquakes.md:
--------------------------------------------------------------------------------
1 | ---
2 | toc: false
3 | order: 12
4 | nav:
5 | title: 示例
6 | path: /examples
7 | order: 4
8 | ---
9 |
10 | ## 加利福尼亚地震
11 |
12 |
13 |
--------------------------------------------------------------------------------
/docs/examples/marineConservation.md:
--------------------------------------------------------------------------------
1 | ---
2 | toc: false
3 | order: 3
4 | nav:
5 | title: 示例
6 | path: /examples
7 | order: 4
8 | ---
9 |
10 | ## 中国海洋保护区在线地图
11 |
12 |
13 |
--------------------------------------------------------------------------------
/docs/examples/countyUnemployment.md:
--------------------------------------------------------------------------------
1 | ---
2 | toc: false
3 | order: 07
4 | nav:
5 | title: 示例
6 | path: /examples
7 | order: 4
8 | ---
9 |
10 | ## 2017 年美国各城市失业率
11 |
12 |
13 |
--------------------------------------------------------------------------------
/docs/examples/sanFranciscoStreetTreeMap.md:
--------------------------------------------------------------------------------
1 | ---
2 | toc: false
3 | order: 12
4 | nav:
5 | title: 示例
6 | path: /examples
7 | order: 4
8 | ---
9 |
10 | ## 旧金山街道地图
11 |
12 |
13 |
--------------------------------------------------------------------------------
/jest.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | preset: 'ts-jest',
3 | collectCoverage: false,
4 | testRegex: '(/__tests__/.*\\.(test|spec))\\.ts$',
5 | collectCoverageFrom: ['src/**/*.ts'],
6 | transform: {
7 | '\\.(less|css)$': 'jest-less-loader',
8 | },
9 | };
10 |
--------------------------------------------------------------------------------
/docs/examples/worldHeritageListDataResources.md:
--------------------------------------------------------------------------------
1 | ---
2 | toc: false
3 | order: 5
4 | nav:
5 | title: 示例
6 | path: /examples
7 | order: 4
8 | ---
9 |
10 | ## 世界遗产名录数据资源
11 |
12 |
13 |
--------------------------------------------------------------------------------
/src/components/SyncScene/types.ts:
--------------------------------------------------------------------------------
1 | import type { Scene } from '@antv/l7';
2 |
3 | export interface ISyncSceneOptions {
4 | zoomGap?: number;
5 | mainIndex?: number;
6 | }
7 | export interface SyncSceneProps {
8 | scenes: Scene[];
9 | options?: ISyncSceneOptions;
10 | }
11 |
--------------------------------------------------------------------------------
/docs/examples/californiaEarthquakesHeatmap.md:
--------------------------------------------------------------------------------
1 | ---
2 | toc: false
3 | order: 23
4 | nav:
5 | title: 示例
6 | path: /examples
7 | order: 4
8 | ---
9 |
10 | ## 加利福尼亚地震 3D 热力图
11 |
12 |
13 |
--------------------------------------------------------------------------------
/__tests__/version.spec.ts:
--------------------------------------------------------------------------------
1 | import { version } from '../src';
2 | import pkg from '../package.json';
3 |
4 | describe('version', () => {
5 | it('should match the `version` field of package.json', () => {
6 | const expected = pkg.version;
7 | expect(version).toBe(expected);
8 | });
9 | });
10 |
--------------------------------------------------------------------------------
/.commitlintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | extends: ['@commitlint/config-conventional'],
3 | rules: {
4 | 'type-enum': [
5 | 2,
6 | 'always',
7 | ['build', 'chore', 'ci', 'docs', 'feat', 'fix', 'perf', 'refactor', 'revert', 'style', 'test', 'deps', 'wip'],
8 | ],
9 | },
10 | };
11 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | ### PR includes
2 |
3 |
4 |
5 | - [ ] fixed #0
6 | - [ ] add / modify test cases
7 | - [ ] documents, demos
8 |
9 | ### Screenshot
10 |
11 | | Before | After |
12 | | ------ | ----- |
13 | | ❌ | ✅ |
14 |
--------------------------------------------------------------------------------
/src/components/Control/ZoomControl/demos/default.tsx:
--------------------------------------------------------------------------------
1 | import { LarkMap, ZoomControl } from '@antv/larkmap';
2 | import React from 'react';
3 |
4 | export default () => {
5 | return (
6 |
24 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/---feature-request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: "\U0001F970 Feature request"
3 | about: Suggest an idea for this project
4 | title: "\U0001F970 [FEATURE]"
5 | labels: Feature
6 | assignees: ''
7 | ---
8 |
9 | ### 💻 Features description [Please make everyone to understand it]
10 |
11 | ### 🏞 What problem does this feature solve
12 |
13 | ### 🧐 What does the proposed API look like
14 |
15 | ### 🚑 Any additional [like screenshots]
16 |
--------------------------------------------------------------------------------
/docs/blocks/layer-attribute/bubble-layer-style-attribute/index.md:
--------------------------------------------------------------------------------
1 | ---
2 | toc: false
3 | order: 1
4 | group:
5 | title: 属性面板
6 | order: 9
7 | nav:
8 | title: 区块
9 | path: /blocks
10 | order: 3
11 | ---
12 |
13 | ## 气泡图层样式属性面板
14 |
15 | ### 介绍
16 |
17 | [气泡图层 - BubbleLayer](/components/layers/composite-layers/bubble-layer) 的样式属性配置组件,用于图层配置可视化场景。
18 |
19 | ### 代码演示
20 |
21 | #### 默认示例
22 |
23 |
24 |
--------------------------------------------------------------------------------
/docs/blocks/layer-attribute/heatmap-layer-style-attribute/index.md:
--------------------------------------------------------------------------------
1 | ---
2 | toc: false
3 | order: 3
4 | group:
5 | title: 属性面板
6 | order: 9
7 | nav:
8 | title: 区块
9 | path: /blocks
10 | order: 3
11 | ---
12 |
13 | ## 热力图层样式属性面板
14 |
15 | ### 介绍
16 |
17 | [热力图层 - HeatmapLayer](/components/layers/base-layers/heatmap-layer) 的样式属性配置组件,用于图层配置可视化场景。
18 |
19 | ### 代码演示
20 |
21 | #### 默认示例
22 |
23 |
24 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | lerna-debug.log*
8 |
9 | # Sys
10 | .DS_STORE
11 | .idea
12 |
13 | # Node
14 | node_modules/
15 |
16 | # Build
17 | lib
18 | es
19 | dist
20 | docs-dist
21 |
22 | # Test
23 | coverage
24 |
25 | # Packages lock
26 | package-lock.json
27 | yarn.lock
28 | pnpm-lock.yaml
29 |
30 | # umi
31 | .umi
32 | .umi-production
33 | .umi-test
34 | .env.local
35 | .vscode
36 |
--------------------------------------------------------------------------------
/docs/common/layer/line-layer/source.md:
--------------------------------------------------------------------------------
1 | `SourceOptions` required
2 |
3 | 数据配置,详见 source [文档](https://l7plot.antv.antgroup.com/zh/docs/api/source)
4 |
5 | ```js
6 | {
7 | source: {
8 | data: [{
9 | path: [[58.00, 32.84],[85.7, 25.161],[101.95, 41.77],[114.96, 39.63],[117.421, 28.61]],
10 | c: 'red',
11 | t: 20,
12 | n: 'chengdu'
13 | }],
14 | parser: { type: 'json', coordinates: 'path', }
15 | }
16 | }
17 | ```
18 |
--------------------------------------------------------------------------------
/docs/blocks/layer-attribute/choropleth-layer-style-attribute/index.md:
--------------------------------------------------------------------------------
1 | ---
2 | toc: false
3 | order: 2
4 | group:
5 | title: 属性面板
6 | order: 9
7 | nav:
8 | title: 区块
9 | path: /blocks
10 | order: 3
11 | ---
12 |
13 | ## 区域图层样式属性面板
14 |
15 | ### 介绍
16 |
17 | [区域图层 - ChoroplethLayer](/components/layers/composite-layers/choropleth-layer) 的样式属性配置组件,用于图层配置可视化场景。
18 |
19 | ### 代码演示
20 |
21 | #### 默认示例
22 |
23 |
24 |
--------------------------------------------------------------------------------
/src/components/Legend/LegendProportion/demos/default.tsx:
--------------------------------------------------------------------------------
1 | import { LegendProportion } from '@antv/larkmap';
2 | import React from 'react';
3 | import './index.less';
4 |
5 | export default () => {
6 | return (
7 |
24 |
25 |
23 |
24 | #### 自定义标注
25 |
26 |
27 |
28 |
23 |
24 | #### 在地图中展示
25 |
26 |
27 |
28 |
23 |
24 | #### 在地图中展示
25 |
26 |
27 |
28 |
23 |
24 | #### 在地图中展示
25 |
26 |
27 |
28 |
19 |
20 | ### API
21 |
22 | ```ts
23 | const layerList: Layer[] = useLayerList();
24 | ```
25 |
26 | #### Result
27 |
28 | | 参数 | 说明 | 类型 |
29 | | --- | --- | --- |
30 | | layerList | 图层实例数组,详情可见 [L7Plot](https://l7plot.antv.antgroup.com/zh/docs/api/base-layers/point-layer) | `Array
23 |
24 | #### 自定义 icons
25 |
26 |
27 |
28 | #### 在地图中展示
29 |
30 |
31 |
32 |
18 |
19 | ### API
20 |
21 | ```ts
22 | const scene: Scene = useScene();
23 | ```
24 |
25 | #### Result
26 |
27 | | 参数 | 说明 | 类型 |
28 | | ----- | --------------------------------------------------------------------------- | ------- |
29 | | scene | scene 实例,实例方法详见 [L7 scene](https://l7.antv.antgroup.com/api/scene) | `Scene` |
30 |
--------------------------------------------------------------------------------
/src/components/Control/hooks/useL7ComponentPortal.tsx:
--------------------------------------------------------------------------------
1 | import type React from 'react';
2 | import type { ReactPortal } from 'react';
3 | import { useRef } from 'react';
4 | import { createPortal } from 'react-dom';
5 |
6 | /**
7 | * 将控件参数中的 ReactNode 转成 Element 格式,并返回对应的 DOM 和 Portal,其中 Portal 需要在对应的 React 组件中返回渲染
8 | * @param reactNode
9 | */
10 | // @ts-ignore
11 | export const useL7ComponentPortal: (reactNode?: React.ReactNode | null) => {
12 | portal: ReactPortal | null;
13 | dom: HTMLElement | undefined;
14 | } = (reactNode) => {
15 | const domRef = useRef(document.createElement('span'));
16 |
17 | return {
18 | portal: reactNode ? createPortal(reactNode, domRef.current) : null,
19 | dom: reactNode ? domRef.current : undefined,
20 | };
21 | };
22 |
--------------------------------------------------------------------------------
/src/components/Popup/demos/default.tsx:
--------------------------------------------------------------------------------
1 | import { LarkMap, Popup } from '@antv/larkmap';
2 | import React, { useState } from 'react';
3 |
4 | export default () => {
5 | const [lngLat, setLngLat] = useState({ lng: 120.210792, lat: 30.246026 });
6 | const onSceneLoaded = (scene) => {
7 | scene.on('mousemove', (e) => {
8 | const { lng, lat } = e.lnglat;
9 | setLngLat({ lng, lat });
10 | });
11 | };
12 |
13 | return (
14 |
21 |
22 | ### API
23 |
24 | | 参数 | 说明 | 类型 | 默认值 |
25 | | --- | --- | --- | --- |
26 | | autoFit | 是否控制地图自动平移到选项对应行政区域 | `boolean` | `true` |
27 | | enableBoundary | 是否在地图上展示行政区域边界 | `boolean` | `true` |
28 | | boundaryLayer | 边界线图层属性,可参考 [LineLayerProps](https://larkmap.antv.antgroup.com/components/layers/base-layers/line-layer#api) | `Omit
18 |
19 | ### API
20 |
21 | ```ts
22 | const layer: Layer = useLayer
24 |
25 | #### 自定义菜单示例
26 |
27 |
28 |
29 | ### API
30 |
31 | | 属性名 | 描述 | 类型 | 默认值 |
32 | | --------- | -------- | --------------- | ------ |
33 | | childern | 子组件 | `ReactNode` | -- |
34 | | className | 类名 | `string` | -- |
35 | | style | 行内样式 | `CSSProperties` | -- |
36 |
37 | #### ContextMenu.Item
38 |
39 | | 属性名 | 描述 | 类型 | 默认值 |
40 | | --------- | ------------ | --------------- | -------- |
41 | | text | 菜单文本 | `string` | `(必选)` |
42 | | onClick | 点击菜单事件 | `() => void` | `(必选)` |
43 | | className | 类名 | `string` | -- |
44 | | style | 行内样式 | `CSSProperties` | -- |
45 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2021 AntV
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/src/components/Legend/LegendCategories/demos/default.tsx:
--------------------------------------------------------------------------------
1 | import { LegendCategories } from '@antv/larkmap';
2 | import React from 'react';
3 |
4 | export default () => {
5 | return (
6 |
21 |
22 | ### API
23 |
24 | | 属性值 | 描述 | 类型 | 默认值 |
25 | | --- | --- | --- | --- |
26 | | searchParams | 调用高德查询接口时传递的参数,必传 | [GaodeRegionLocationParams](#gaodeRegionLocationparams) | - |
27 | | transformBounds | 对地图搜索区域对应左上和右下点进行自定义,默认不传则展示整个地图展示区域 | `(bounds: Bounds) => Bounds` | - |
28 | | className | 控件容器自定义样式 | `string` | - |
29 | | style | 控件容器自定义 style | `CSSProperties` | - |
30 | | onChange | 当展示的行政区域发生变更时的回调函数 | `(result: string, bounds: Bounds) => void` | - |
31 |
32 | #### GaodeRegionLocationParams
33 |
34 | | 属性值 | 描述 | 类型 | 默认值 |
35 | | ------ | --------------------------------- | -------- | ------ |
36 | | key | 高德 Web API 服务的 key 值 (必传) | `string` | - |
37 |
38 | 该其他配置可以查看高德的 [逆地理编码](https://lbs.amap.com/api/webservice/guide/api/georegeo#/regeo)
39 |
--------------------------------------------------------------------------------
/src/components/Control/CustomControl/index.md:
--------------------------------------------------------------------------------
1 | ---
2 | toc: content
3 | order: 1
4 | group:
5 | title: 控件组件
6 | order: 2
7 | nav:
8 | title: 组件
9 | path: /components
10 | ---
11 |
12 | ## 自定义控件 - CustomControl
13 |
14 | ### 介绍
15 |
16 | 地图自定义容器控件,用户可以通过 `CustomControl` 组件将自定义内容悬停在地图上。
17 |
18 | ### 代码演示
19 |
20 |
21 |
22 | | 参数 | 说明 | 类型 | 默认值 |
23 | | --- | --- | --- | --- |
24 | | position | 控件被添加到地图中的位置以及排列方式,详情可见 [控件插槽](https://l7.antv.antgroup.com/api/component/control/control#插槽) | [Position](#position) | `'topleft'` |
25 | | className | 自定义样式名 | `string` | - |
26 | | style | 自定义样式 | `CSSProperties` | - |
27 | | children | 控件内容 | `ReactNode` | - |
28 |
29 | #### Position
30 |
31 | ```ts
32 | export type Position =
33 | | 'topleft' // ↖ 左上角,纵向排列
34 | | 'lefttop' // ↖ 左上角,横向排列
35 | | 'topright' // ↗ 右上角,纵向排列
36 | | 'righttop' // ↗ 右上角,横向排列
37 | | 'bottomleft' // ↙ 左下角,纵向排列
38 | | 'leftbottom' // ↙ 左下角,横向排列
39 | | 'bottomright' // ↘ 右下角,纵向排列
40 | | 'rightbottom' // ↘ 右下角,横向排列
41 | | 'topcenter' // ↑ 上方中央,横向排列
42 | | 'bottomcenter' // ↓ 下方中间,横向排列
43 | | 'leftcenter' // ← 左边中间,纵向排列
44 | | 'rightcenter'; // → 右边中间,纵向排列
45 | ```
46 |
--------------------------------------------------------------------------------
/src/components/LarkMap/hooks/use-control/index.ts:
--------------------------------------------------------------------------------
1 | import type { IControlOption, Scene } from '@antv/l7';
2 | import { Control } from '@antv/l7';
3 | import { useUpdateEffect } from 'ahooks';
4 | import { useEffect, useRef } from 'react';
5 | import { useScene } from '../use-scene';
6 |
7 | export const useControl = (
8 | onCreate: (context: Scene) => HTMLElement,
9 | onRemove?: (context: Scene) => void,
10 | opts?: IControlOption,
11 | ) => {
12 | const scene = useScene();
13 | const controlRef = useRef
30 |
31 | ### 示例二: 设置 zoomGap
32 |
33 |
34 |
35 | ### 示例三:多地图场景同步
36 |
37 |
38 |
39 | ### 示例四:函数使用
40 |
41 |
42 |
43 | ## API
44 |
45 | ### React 组件
46 |
47 | `interface SyncSceneProps {scenes: Scene[], options: { zoomGap: number, mainIndex: number }}`
48 |
49 | ### 函数方式
50 |
51 | `syncScene(scenes: Scene[], options: { zoomGap: number, mainIndex: number })`
52 |
53 | #### scenes
54 |
55 | LarkMap 加载完成的 Scene 实例数组
56 |
57 | #### options
58 |
59 | | 参数 | 说明 | 类型 | 默认值 |
60 | | ----------- | -------------------------------------------------------------------------- | -------- | ------ |
61 | | `zoomGap` | 用于设置同步场景的地图层级差 | `number` | 0 |
62 | | `mainIndex` | 搭配 `zoomGap` 使用,用于设置主场景,其余场景为主场景的 `zoom` + `zoomGap` | `number` | 0 |
63 |
--------------------------------------------------------------------------------
/src/components/Control/FullscreenControl/demos/antd.tsx:
--------------------------------------------------------------------------------
1 | import type { Scene } from '@antv/l7';
2 | import { CustomControl, FullscreenControl, LarkMap } from '@antv/larkmap';
3 | import { Button, ConfigProvider, message, Tooltip } from 'antd';
4 | import React, { useCallback, useEffect, useState } from 'react';
5 |
6 | export default () => {
7 | const [scene, setScene] = useState
21 |
22 | ### API
23 |
24 | | 参数 | 说明 | 类型 | 默认值 |
25 | | --- | --- | --- | --- |
26 | | img | Logo 展示的图片 url | `string` | --- |
27 | | href | 点击 Logo 跳转的超链接,不传则纯展示图片,点击不跳转 | `string` | --- |
28 | | position | 控件被添加到地图中的位置以及排列方式详情可见 [控件插槽](https://l7.antv.antgroup.com/api/component/control/control#插槽) | [Position](#position) | --- |
29 | | className | 自定义样式名 | `string` | --- |
30 | | style | 自定义样式 | `CSSProperties` | - |
31 | | onAdd | 组件被添加时的回调 | `(this) => void` | - |
32 | | onRemove | 组件被移除时的回调 | `(this) => void` | - |
33 | | onShow | 组件显示时的回调 | `(this) => void` | - |
34 | | onHide | 组件隐藏时的回调 | `(this) => void` | - |
35 |
36 | #### Position
37 |
38 | ```ts
39 | export type Position =
40 | | 'topleft' // ↖ 左上角,纵向排列
41 | | 'lefttop' // ↖ 左上角,横向排列
42 | | 'topright' // ↗ 右上角,纵向排列
43 | | 'righttop' // ↗ 右上角,横向排列
44 | | 'bottomleft' // ↙ 左下角,纵向排列
45 | | 'leftbottom' // ↙ 左下角,横向排列
46 | | 'bottomright' // ↘ 右下角,纵向排列
47 | | 'rightbottom' // ↘ 右下角,横向排列
48 | | 'topcenter' // ↑ 上方中央,横向排列
49 | | 'bottomcenter' // ↓ 下方中间,横向排列
50 | | 'leftcenter' // ← 左边中间,纵向排列
51 | | 'rightcenter'; // → 右边中间,纵向排列
52 | ```
53 |
--------------------------------------------------------------------------------
/src/components/Draw/use-draw/index.md:
--------------------------------------------------------------------------------
1 | ---
2 | order: 4
3 | toc: content
4 | group:
5 | title: 绘制组件
6 | order: 10
7 | ---
8 |
9 | ## useDraw
10 |
11 | ### 介绍
12 |
13 | 用 Hook 的方式操作和管理 [L7Draw](https://antv.vision/L7Draw/docs/draw/point) 中的绘制实例,以及实例上的数据和方法,**该 Hook 需放到容器组件内部才能使用**。
14 |
15 | ### 代码演示
16 |
17 | #### 默认示例
18 |
19 |
20 |
21 | #### 绘制开关
22 |
23 |
24 |
25 | ### API
26 |
27 | ```tsx | pure
28 | const { draw } = useDraw({
29 | type: 'point' | 'line' | 'polygon' | 'rect' | 'circle',
30 | options: DrawOptions, // 详见 https://l7draw.antv.vision/docs/draw/point#%E9%85%8D%E7%BD%AE
31 | });
32 | ```
33 |
34 | ### Params
35 |
36 | | 参数 | 说明 | 类型 |
37 | | --- | --- | --- |
38 | | type | 绘制类型 | `'point' | 'line' | 'polygon' | 'rect' | 'circle'` |
39 | | options | 绘制的 `options` 参数,详见 [L7Draw Options](https://antv.vision/L7Draw/docs/draw/point#%E9%85%8D%E7%BD%AE) | `DrawOptions` |
40 |
41 | ### Result
42 |
43 | | 返回值 | 说明 | 类型 |
44 | | --- | --- | --- |
45 | | draw | 绘制类 `Draw` 实例 | `DrawPoint | DrawLine | DrawPolygon | DrawRect | DrawCircle` |
46 | | drawData | 绘制的 `GeoJson` 数据 | `Feature[]` |
47 | | setDrawData | 设置绘制数据的方法 | `(newData: Feature[]) => void` |
48 | | getDrawData | 获取绘制数据的方法 | `() => Feature[]` |
49 | | isEnable | 当前 `Draw` 是否激活 | `boolean` |
50 | | enable | 启用绘制 | `() => void` |
51 | | disable | 禁用绘制 | `() => void` |
52 |
--------------------------------------------------------------------------------
/src/components/SyncScene/demos/multiScenes.tsx:
--------------------------------------------------------------------------------
1 | /**
2 | * compact: true
3 | */
4 | import type { Scene } from '@antv/l7';
5 | import type { LarkMapProps } from '@antv/larkmap';
6 | import { LarkMap, SyncScene } from '@antv/larkmap';
7 | import React from 'react';
8 | const config: LarkMapProps = {
9 | mapType: 'Gaode',
10 | mapOptions: {
11 | style: 'light',
12 | center: [120.210792, 30.246026],
13 | zoom: 9,
14 | },
15 | };
16 | export default () => {
17 | const [sceneArray, setSceneArray] = React.useState([]);
18 | const onSceneLoaded = (scene: Scene) => {
19 | setSceneArray((oldValue) => [...oldValue, scene]);
20 | };
21 |
22 | return (
23 |
21 |
22 | ### API
23 |
24 | | 参数 | 说明 | 类型 | 默认值 |
25 | | --- | --- | --- | --- |
26 | | transform | 转换光标所在经纬度的回调函数 | `(position: [number, number]) => [number, number]` | - |
27 | | position | 控件被添加到地图中的位置以及排列方式,详情可见 [控件插槽](https://l7.antv.antgroup.com/api/component/control/control#插槽) | [Position](#position) | `'bottomleft'` |
28 | | className | 自定义样式名 | `string` | - |
29 | | style | 自定义样式 | `CSSProperties` | - |
30 | | onLocationChange | 光标所在经纬度发生变化时触发的回调 | `(position: [number, number]) => void` | - |
31 | | onAdd | 组件被添加时的回调 | `(this) => void` | - |
32 | | onRemove | 组件被移除时的回调 | `(this) => void` | - |
33 | | onShow | 组件显示时的回调 | `(this) => void` | - |
34 | | onHide | 组件隐藏时的回调 | `(this) => void` | - |
35 |
36 | #### Position
37 |
38 | ```ts
39 | export type Position =
40 | | 'topleft' // ↖ 左上角,纵向排列
41 | | 'lefttop' // ↖ 左上角,横向排列
42 | | 'topright' // ↗ 右上角,纵向排列
43 | | 'righttop' // ↗ 右上角,横向排列
44 | | 'bottomleft' // ↙ 左下角,纵向排列
45 | | 'leftbottom' // ↙ 左下角,横向排列
46 | | 'bottomright' // ↘ 右下角,纵向排列
47 | | 'rightbottom' // ↘ 右下角,横向排列
48 | | 'topcenter' // ↑ 上方中央,横向排列
49 | | 'bottomcenter' // ↓ 下方中间,横向排列
50 | | 'leftcenter' // ← 左边中间,纵向排列
51 | | 'rightcenter'; // → 右边中间,纵向排列
52 | ```
53 |
--------------------------------------------------------------------------------
/src/components/SyncScene/demos/zoomGap.tsx:
--------------------------------------------------------------------------------
1 | /**
2 | * compact: true
3 | */
4 | import type { Scene } from '@antv/l7';
5 | import { LarkMap, SyncScene } from '@antv/larkmap';
6 | import React from 'react';
7 |
8 | export default () => {
9 | const [sceneArray, setSceneArray] = React.useState([]);
10 | const [zoomGap, setZoomGap] = React.useState当前已有图层:
17 |
21 |
22 | ### API
23 |
24 | | 参数 | 说明 | 类型 | 默认值 |
25 | | --- | --- | --- | --- |
26 | | lockWidth | 是否固定容器宽度 | `boolean` | `true` |
27 | | maxWidth | 组件的容器最大宽度 | `number` | `100` |
28 | | metric | 展示 `千米` 格式的比例尺 | `boolean` | `true` |
29 | | imperial | 展示 `英里` 格式的比例尺 | `boolean` | `false` |
30 | | updateWhenIdle | 是否只在拖拽和缩放结束后才更新比例尺 | `boolean` | `false` |
31 | | position | 控件被添加到地图中的位置以及排列方式,详情可见 [控件插槽](https://l7.antv.antgroup.com/api/component/control/control#插槽) | [Position](#position) | `'bottomleft'` |
32 | | className | 自定义样式名 | `string` | - |
33 | | style | 自定义样式 | `CSSProperties` | - |
34 | | onAdd | 组件被添加时的回调 | `(this) => void` | - |
35 | | onRemove | 组件被移除时的回调 | `(this) => void` | - |
36 | | onShow | 组件显示时的回调 | `(this) => void` | - |
37 | | onHide | 组件隐藏时的回调 | `(this) => void` | - |
38 |
39 | #### Position
40 |
41 | ```ts
42 | export type Position =
43 | | 'topleft' // ↖ 左上角,纵向排列
44 | | 'lefttop' // ↖ 左上角,横向排列
45 | | 'topright' // ↗ 右上角,纵向排列
46 | | 'righttop' // ↗ 右上角,横向排列
47 | | 'bottomleft' // ↙ 左下角,纵向排列
48 | | 'leftbottom' // ↙ 左下角,横向排列
49 | | 'bottomright' // ↘ 右下角,纵向排列
50 | | 'rightbottom' // ↘ 右下角,横向排列
51 | | 'topcenter' // ↑ 上方中央,横向排列
52 | | 'bottomcenter' // ↓ 下方中间,横向排列
53 | | 'leftcenter' // ← 左边中间,纵向排列
54 | | 'rightcenter'; // → 右边中间,纵向排列
55 | ```
56 |
--------------------------------------------------------------------------------
/docs/common/layer/heatmap-layer/style.md:
--------------------------------------------------------------------------------
1 | `HeatmapLayerStyleOptions|GridHeatmapLayerStyleOptions` optional
2 |
3 | 普通热力样式,HeatmapLayerStyleOptions 配置如下:
4 |
5 | | 属性 | 描述 | 类型 | 默认值 | 是否必填 |
6 | | ---------- | ------------------ | ------------ | ------ | -------- |
7 | | intensity | 全局热力权重 | `number` | `3` | optional |
8 | | radius | 热力半径,单位像素 | `number` | `20` | optional |
9 | | opacity | 透明度 | `number` | `1` | optional |
10 | | rampColors | 热力色带 | `RampColors` | | optional |
11 |
12 | 热力色带,RampColors 配置如下:
13 |
14 | | 属性 | 描述 | 类型 | 默认值 | 是否必填 |
15 | | --------- | ---------- | ---------- | ------ | -------- |
16 | | colors | 颜色 | `string[]` | | required |
17 | | positions | 热力映射值 | `number[]` | | required |
18 |
19 | ```js
20 | {
21 | style: {
22 | intensity: 3,
23 | radius: 20,
24 | opacity: 1,
25 | rampColors: {
26 | colors: ['#FF4818', '#F7B74A', '#FFF598', '#F27DEB', '#8C1EB2', '#421EB2'],
27 | positions: [0, 0.2, 0.4, 0.6, 0.8, 1.0],
28 | },
29 | }
30 | }
31 | ```
32 |
33 | 网格/蜂窝热力样式,GridHeatmapLayerStyleOptions 配置如下:
34 |
35 | | 属性 | 描述 | 类型 | 默认值 | 是否必填 |
36 | | -------- | ----------------------- | -------- | ------ | -------- |
37 | | opacity | 透明度 | `number` | `1` | optional |
38 | | coverage | 覆盖度,范围 0 到 1 | `string` | `0.9` | optional |
39 | | angle | 旋转角度,范围 0 到 360 | `number` | `0` | optional |
40 |
41 | ```js
42 | {
43 | style: {
44 | coverage: 0.9,
45 | angle: 0,
46 | opacity: 1.0,
47 | }
48 | }
49 | ```
50 |
--------------------------------------------------------------------------------
/docs/blocks/draw-modal/default.tsx:
--------------------------------------------------------------------------------
1 | import { Button, Input } from 'antd';
2 | import type { Feature } from 'geojson';
3 | import React, { useMemo, useState } from 'react';
4 | import { DrawModal } from './DrawModal';
5 |
6 | const Default: React.FC = () => {
7 | const [featureList, setFeatureList] = useState
21 |
22 | ### API
23 |
24 | | 参数 | 说明 | 类型 | 默认值 |
25 | | --- | --- | --- | --- |
26 | | zoomInText | 放大按钮的展示内容 | `ReactNode` | - |
27 | | zoomInTitle | 放大按钮的 `title` 属性 | `string` | `'Zoom in'` |
28 | | zoomOutText | 缩小按钮的展示内容 | `ReactNode` | - |
29 | | zoomOutTitle | 缩小按钮的 `title` 属性 | `string` | `'Zoom out'` |
30 | | position | 控件被添加到地图中的位置以及排列方式,详情可见 [控件插槽](https://l7.antv.antgroup.com/api/component/control/control#插槽) | [Position](#position) | `'bottomright'` |
31 | | showZoom | 是否展示地图当前实时 zoom 数值,默认向下取整 | `boolean` | `false` |
32 | | className | 自定义样式名 | `string` | - |
33 | | style | 自定义样式 | `CSSProperties` | - |
34 | | onAdd | 组件被添加时的回调 | `(this) => void` | - |
35 | | onRemove | 组件被移除时的回调 | `(this) => void` | - |
36 | | onShow | 组件显示时的回调 | `(this) => void` | - |
37 | | onHide | 组件隐藏时的回调 | `(this) => void` | - |
38 |
39 | #### Position
40 |
41 | ```ts
42 | export type Position =
43 | | 'topleft' // ↖ 左上角,纵向排列
44 | | 'lefttop' // ↖ 左上角,横向排列
45 | | 'topright' // ↗ 右上角,纵向排列
46 | | 'righttop' // ↗ 右上角,横向排列
47 | | 'bottomleft' // ↙ 左下角,纵向排列
48 | | 'leftbottom' // ↙ 左下角,横向排列
49 | | 'bottomright' // ↘ 右下角,纵向排列
50 | | 'rightbottom' // ↘ 右下角,横向排列
51 | | 'topcenter' // ↑ 上方中央,横向排列
52 | | 'bottomcenter' // ↓ 下方中间,横向排列
53 | | 'leftcenter' // ← 左边中间,纵向排列
54 | | 'rightcenter'; // → 右边中间,纵向排列
55 | ```
56 |
--------------------------------------------------------------------------------
/src/components/Layers/index.ts:
--------------------------------------------------------------------------------
1 | export { HeatmapLayer } from './BaseLayers/HeatmapLayer';
2 | export type { HeatmapLayerProps } from './BaseLayers/HeatmapLayer/types';
3 | export { ImageLayer } from './BaseLayers/ImageLayer';
4 | export type { ImageLayerProps } from './BaseLayers/ImageLayer/types';
5 | export { LineLayer } from './BaseLayers/LineLayer';
6 | export type { LineLayerProps } from './BaseLayers/LineLayer/types';
7 | export { PointLayer } from './BaseLayers/PointLayer';
8 | export type { PointLayerProps } from './BaseLayers/PointLayer/types';
9 | export { PolygonLayer } from './BaseLayers/PolygonLayer';
10 | export type { PolygonLayerProps } from './BaseLayers/PolygonLayer/types';
11 | export { RasterLayer } from './BaseLayers/RasterLayer';
12 | export type { RasterLayerProps } from './BaseLayers/RasterLayer/types';
13 | export { TextLayer } from './BaseLayers/TextLayer';
14 | export type { TextLayerProps } from './BaseLayers/TextLayer/types';
15 | export { BubbleLayer } from './CompositeLayers/BubbleLayer';
16 | export type { BubbleLayerProps } from './CompositeLayers/BubbleLayer/types';
17 | export { ChoroplethLayer } from './CompositeLayers/ChoroplethLayer';
18 | export type { ChoroplethLayerProps } from './CompositeLayers/ChoroplethLayer/types';
19 | export { FlowLayer } from './CompositeLayers/FlowLayer';
20 | export type { FlowLayerProps } from './CompositeLayers/FlowLayer/types';
21 | export { IconFontLayer } from './CompositeLayers/IconFontLayer';
22 | export type { IconFontLayerProps } from './CompositeLayers/IconFontLayer/types';
23 | export { IconImageLayer } from './CompositeLayers/IconImageLayer';
24 | export type { IconImageLayerProps } from './CompositeLayers/IconImageLayer/types';
25 |
--------------------------------------------------------------------------------
/docs/examples/marineConservation/index.tsx:
--------------------------------------------------------------------------------
1 | import type { PointLayerProps } from '@antv/larkmap';
2 | import { LarkMap, LayerPopup, PointLayer } from '@antv/larkmap';
3 | import React, { useEffect, useState } from 'react';
4 | import { config, layerConfig } from './constants';
5 | import Legend from './Legend';
6 |
7 | export default () => {
8 | const [source, setSource] = useState
23 |
24 | ### API
25 |
26 | | 参数 | 说明 | 类型 | 默认值 |
27 | | --- | --- | --- | --- |
28 | | ref | 组件 Ref | `Ref
21 |
22 | ### API
23 |
24 | | 参数 | 说明 | 类型 | 默认值 |
25 | | --- | --- | --- | --- |
26 | | imageType | 截图图片的格式 | `'png'|'jpeg'` | `'png'` |
27 | | onExport | 截图成功后,用于接收图片 Base64 字符串的回调函数 | `(base64: string) => void` | - |
28 | | btnIcon | 按钮图标 | `ReactNode` | - |
29 | | btnText | 按钮内容文本 | `string` | - |
30 | | title | 按钮的 title 属性 | `string` | `'导出图片'` |
31 | | vertical | 在 btnIcon 有值的情况下,按钮内的图标和文案是否纵向排列 | `boolean` | `false` |
32 | | position | 控件被添加到地图中的位置以及排列方式,详情可见 [控件插槽](https://l7.antv.antgroup.com/api/component/control/control#插槽) | [Position](#position) | `'topright'` |
33 | | className | 自定义样式名 | `string` | - |
34 | | style | 自定义样式 | `CSSProperties` | - |
35 | | onAdd | 组件被添加时的回调 | `(this) => void` | - |
36 | | onRemove | 组件被移除时的回调 | `(this) => void` | - |
37 | | onShow | 组件显示时的回调 | `(this) => void` | - |
38 | | onHide | 组件隐藏时的回调 | `(this) => void` | - |
39 |
40 | #### Position
41 |
42 | ```ts
43 | export type Position =
44 | | 'topleft' // ↖ 左上角,纵向排列
45 | | 'lefttop' // ↖ 左上角,横向排列
46 | | 'topright' // ↗ 右上角,纵向排列
47 | | 'righttop' // ↗ 右上角,横向排列
48 | | 'bottomleft' // ↙ 左下角,纵向排列
49 | | 'leftbottom' // ↙ 左下角,横向排列
50 | | 'bottomright' // ↘ 右下角,纵向排列
51 | | 'rightbottom' // ↘ 右下角,横向排列
52 | | 'topcenter' // ↑ 上方中央,横向排列
53 | | 'bottomcenter' // ↓ 下方中间,横向排列
54 | | 'leftcenter' // ← 左边中间,纵向排列
55 | | 'rightcenter'; // → 右边中间,纵向排列
56 | ```
57 |
--------------------------------------------------------------------------------
/docs/blocks/draw-modal/constants.ts:
--------------------------------------------------------------------------------
1 | import type { DrawType } from '@antv/l7-draw/es/control/types';
2 | import type { DrawGroupData } from '@antv/larkmap';
3 | import type { Feature, Polygon } from 'geojson';
4 |
5 | export const CLS_PREFIX = 'larkmap-draw-modal';
6 |
7 | export const DRAW_ICON_TYPE_MAP: Record
26 |
27 | ### API
28 |
29 | | 参数 | 说明 | 类型 | 默认值 |
30 | | --- | --- | --- | --- |
31 | | transform | 格式化通过 getlocation 获取到的经纬度的函数,可以用于地理坐标系的转换 | `(position: [number, number]) => [number, number]` | - |
32 | | btnIcon | 按钮图标 | `ReactNode` | - |
33 | | btnText | 按钮内容文本 | `string` | - |
34 | | title | 按钮的 title 属性 | `string` | `'定位''` |
35 | | vertical | 在 btnIcon 有值的情况下,按钮内的图标和文案是否纵向排列 | `boolean` | `false` |
36 | | position | 控件被添加到地图中的位置以及排列方式,详情可见[控件插槽](https://l7.antv.antgroup.com/api/component/control/control#插槽) | [Position](#position) | `'topright''` |
37 | | className | 自定义样式名 | `string` | - |
38 | | style | 自定义样式 | `CSSProperties` | - |
39 | | onAdd | 组件被添加时的回调 | `(this) => void` | - |
40 | | onRemove | 组件被移除时的回调 | `(this) => void` | - |
41 | | onShow | 组件显示时的回调 | `(this) => void` | - |
42 | | onHide | 组件隐藏时的回调 | `(this) => void` | - |
43 |
44 | #### Position
45 |
46 | ```ts
47 | export type Position =
48 | | 'topleft' // ↖ 左上角,纵向排列
49 | | 'lefttop' // ↖ 左上角,横向排列
50 | | 'topright' // ↗ 右上角,纵向排列
51 | | 'righttop' // ↗ 右上角,横向排列
52 | | 'bottomleft' // ↙ 左下角,纵向排列
53 | | 'leftbottom' // ↙ 左下角,横向排列
54 | | 'bottomright' // ↘ 右下角,纵向排列
55 | | 'rightbottom' // ↘ 右下角,横向排列
56 | | 'topcenter' // ↑ 上方中央,横向排列
57 | | 'bottomcenter' // ↓ 下方中间,横向排列
58 | | 'leftcenter' // ← 左边中间,纵向排列
59 | | 'rightcenter'; // → 右边中间,纵向排列
60 | ```
61 |
--------------------------------------------------------------------------------
/src/components/Control/LayerSwitchControl/demos/layerSwitchItem.tsx:
--------------------------------------------------------------------------------
1 | import { LarkMap, LayerSwitchControl, RasterLayer, useLayer } from '@antv/larkmap';
2 | import React from 'react';
3 |
4 | const GOOGLE_TILE_MAP_URL = 'https://gac-geo.googlecnapps.cn/maps/vt?lyrs=s&gl=CN&x={x}&y={y}&z={z}';
5 |
6 | const GOOGLE_TILE_MAP_ROUTER_URL = 'https://gac-geo.googlecnapps.cn/maps/vt?lyrs=h&gl=CN&x={x}&y={y}&z={z}';
7 |
8 | const CustomComponent = () => {
9 | const googleTileMap = useLayer('googleTileMap');
10 | const googleTileMapRouter = useLayer('googleTileMapRouter');
11 |
12 | return (
13 |
21 |
22 | ### API
23 |
24 | | 参数 | 说明 | 类型 | 默认值 |
25 | | --- | --- | --- | --- |
26 | | lngLat | Popup 所在的经纬度 | `{ lng: number; lat: number }` | - |
27 | | title | Popup 标题 | `ReactNode` | - |
28 | | children | Popup 内容 | `ReactNode` | - |
29 | | className | Popup 自定义 `className` | `string` | - |
30 | | style | Popup 样式 | `CSSProperties` | - |
31 | | closeOnClick | 点击地图区域时,是否关闭当前 Popup | `boolean` | `true` |
32 | | closeOnEsc | 点击 Esc 键时,是否关闭当前 Popup | `boolean` | `false` |
33 | | maxWidth | Popup 的最大宽度 | `string` | `'240px'` |
34 | | anchor | Popup 箭头位置,可以控制 Popup 相对于经纬度点的展示位置 | [AnchorType](#anchortype) | `'bottom'` |
35 | | offsets | Popup 相对于锚点的偏移 | `[number, number]` | `[0, 0]` |
36 | | autoPan | 当 Popup 展示或者位置发生变化时,地图是否要自动平移至 Popup 所在位置 | `boolean` | `false` |
37 | | autoClose | 当有其他 Popup 展示时,是否自动关闭当前气泡 | `boolean` | `true` |
38 | | followCursor | Popup 是否跟随光标移动,若设为 true,则 lngLat 配置无效 | `boolean` | `false` |
39 | | closeButton | 是否展示关闭 Popup 图标 | `boolean` | `true` |
40 | | closeButtonOffsets | 关闭 Popup 图标的相对偏移 | `[number, number]` | - |
41 | | stopPropagation | Popup 上的鼠标事件是否要阻止其冒泡 | `boolean` | `true` |
42 | | onOpen | Popup 被添加时回调 | `() => void` | - |
43 | | onClose | Popup 被移除时回调 | `() => void` | - |
44 | | onShow | Popup 显示时回调 | `() => void` | - |
45 | | onHide | Popup 隐藏时回调 | `() => void` | - |
46 |
47 | #### AnchorType
48 |
49 | ```ts
50 | export type AnchorType =
51 | | 'center'
52 | | 'top'
53 | | 'top-left'
54 | | 'top-right'
55 | | 'bottom'
56 | | 'bottom-left'
57 | | 'bottom-right'
58 | | 'left'
59 | | 'right';
60 | ```
61 |
--------------------------------------------------------------------------------
/src/components/Control/LayerSwitchControl/demos/singleSelection.tsx:
--------------------------------------------------------------------------------
1 | import { LarkMap, LayerSwitchControl, RasterLayer, useLayer } from '@antv/larkmap';
2 | import React from 'react';
3 |
4 | const GOOGLE_TILE_MAP_URL = 'https://gac-geo.googlecnapps.cn/maps/vt?lyrs=s&gl=CN&x={x}&y={y}&z={z}';
5 |
6 | const GOOGLE_TILE_MAP_ROUTER_URL = 'https://gac-geo.googlecnapps.cn/maps/vt?lyrs=h&gl=CN&x={x}&y={y}&z={z}';
7 |
8 | const CustomComponent = () => {
9 | const googleTileMap = useLayer('googleTileMap');
10 | const googleTileMapRouter = useLayer('googleTileMapRouter');
11 |
12 | return (
13 |