Skip to content

Commit

Permalink
fix: 修复资源注册问题 (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
lvisei authored Jun 20, 2022
1 parent 933a552 commit 7f75987
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/components/CustomControl/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
toc: content
order: 3
group:
title: 控件组件
order: 2
Expand Down
2 changes: 1 addition & 1 deletion src/components/LarkMap/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ export const LarkMap = forwardRef<LarkMapRefAttributes, LarkMapProps>((props, re
contextValue.layerManager = layerManager;

scene.once('loaded', () => {
setSceneInstance(scene);
if (onSceneLoaded) {
onSceneLoaded(scene);
}
setSceneInstance(scene);
});
})
.catch((error) => {
Expand Down
1 change: 1 addition & 0 deletions src/components/Marker/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
toc: content
order: 1
group:
title: 分析组件
order: 3
Expand Down
1 change: 1 addition & 0 deletions src/components/Marker/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const Marker = memo<MarkerProps>((props): React.ReactPortal => {
...props,
element: hasChildren ? document.createElement('div') : null,
};
// @ts-ignore
const l7marker = new L7Marker(options);

l7marker.on('click', (e: MouseEvent) => {
Expand Down
23 changes: 21 additions & 2 deletions src/components/Marker/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,23 @@
import type { anchorType, ILngLat } from '@antv/l7';
import type { ILngLat } from '@antv/l7';

/**
* 锚点相对位置
*/
export type AnchorType =
| 'right'
| 'top-right'
| 'left'
| 'bottom-right'
| 'left'
| 'top-left'
| 'bottom-left'
| 'bottom'
| 'bottom-right'
| 'bottom-left'
| 'top'
| 'top-right'
| 'top-left'
| 'center';

/**
* 组件类型定义
Expand All @@ -9,7 +28,7 @@ export interface MarkerProps {
/** 锚点相对位置,支持 'center', 'top', 'bottom', 'left', 'right', 'top-left', 'top-right', 'bottom-left', 'bottom-right'
* @default "center"
*/
anchor?: anchorType;
anchor?: AnchorType;
/** 设置默认 marker 的颜色
* @default "#5B8FF9"
*/
Expand Down
2 changes: 1 addition & 1 deletion src/components/Popup/demos/default.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default () => {

return (
<LarkMap mapType="GaodeV1" style={{ height: '300px' }} onSceneLoaded={onSceneLoaded}>
<Popup lngLat={lngLat} closeButton={false} closeOnClick={false}>
<Popup lngLat={lngLat} closeButton={false} closeOnClick={false} anchor="bottom-left">
<p>lat: {lngLat.lat}</p>
<p>lng: {lngLat.lng}</p>
</Popup>
Expand Down
1 change: 1 addition & 0 deletions src/components/Popup/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
toc: content
order: 2
group:
title: 分析组件
order: 3
Expand Down
5 changes: 3 additions & 2 deletions src/components/Popup/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { anchorType, ILngLat } from '@antv/l7';
import type { ILngLat } from '@antv/l7';
import type { AnchorType } from '../Marker/types';

/**
* 组件类型定义
Expand All @@ -9,7 +10,7 @@ export interface PopupProps {
/** 锚点相对位置,支持 'center', 'top', 'bottom', 'left', 'right', 'top-left', 'top-right', 'bottom-left', 'bottom-right'
* @default "bottom"
*/
anchor?: anchorType;
anchor?: AnchorType;
/** 偏移量 [0, 0] 分别表示 X, Y 的偏移量,单位为像素。
* @default [0, 0]
*/
Expand Down
1 change: 1 addition & 0 deletions src/components/Scale/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
toc: content
order: 1
group:
title: 控件组件
order: 2
Expand Down
1 change: 1 addition & 0 deletions src/components/Template/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
toc: content
order: 3
group:
title: 分析组件
order: 3
Expand Down
1 change: 1 addition & 0 deletions src/components/Zoom/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
toc: content
order: 2
group:
title: 控件组件
order: 2
Expand Down

0 comments on commit 7f75987

Please sign in to comment.