Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复 TileLayer 对AMap JS API v1.4.xx的兼容 #275

Merged
merged 21 commits into from
Dec 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
77f55fc
feat:修复 LabelMarker,以便兼容高德地图JS API v1.4.xxx。
peidongGuo Dec 5, 2022
9163710
Merge pull request #1 from peidongGuo/feature/fixLabelMarker
peidongGuo Dec 5, 2022
336e9c0
fix:修复细节
peidongGuo Dec 5, 2022
657ca76
Merge pull request #2 from peidongGuo/feature/fixLabelMarker
peidongGuo Dec 5, 2022
8a5a399
feat:添加Polyline-Editor Poly-Editor组件项目,修改PolyLine、Polygon、PolygonEdit…
peidongGuo Dec 6, 2022
b1646f7
Merge branch 'uiwjs:master' into master
peidongGuo Dec 6, 2022
4642651
Merge pull request #3 from peidongGuo/feature/addPolyEditor
peidongGuo Dec 6, 2022
9f61a1e
feat:添加MouseTool组件项目,以便支持 MouseTool 插件功能。
peidongGuo Dec 7, 2022
2f662d3
Merge pull request #4 from peidongGuo/feature/addMouseTool
peidongGuo Dec 7, 2022
70f1779
解决PR时的冲突
peidongGuo Dec 7, 2022
d20aef0
Merge branch 'master' into feature/addMouseTool
peidongGuo Dec 7, 2022
5d30c96
Merge pull request #5 from peidongGuo/feature/addMouseTool
peidongGuo Dec 7, 2022
14c20c6
Merge branch 'uiwjs:master' into master
peidongGuo Dec 7, 2022
c114927
Merge branch 'uiwjs:master' into master
peidongGuo Dec 8, 2022
9d7d2a3
Merge branch 'uiwjs:master' into master
peidongGuo Dec 8, 2022
dd11f30
Merge branch 'uiwjs:master' into master
peidongGuo Dec 8, 2022
2c32aa7
feat:完成 TileLayer 调试及使用文档编写。
peidongGuo Dec 9, 2022
97ea791
fix:修复 Polyline、Polygon 组件的拖拽功能
peidongGuo Dec 9, 2022
169150b
Merge branch 'uiwjs:master' into master
peidongGuo Dec 9, 2022
063393e
fix confliction
peidongGuo Dec 9, 2022
8944911
修复 TileLayer 对AMap JS API v1.4.xx的兼容
peidongGuo Dec 9, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion packages/polygon/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ const Example = () => {
fillOpacity={0.4}
fillColor="#1791fc"
zIndex={50}
draggable={true}
onChange={e=>console.log(e)}
onDragStart={(e)=>{console.log(e)}}
onDragging={(e)=>{console.log(e)}}
onDragEnd={(e)=>{console.log(e)}}
/>
<Polygon
visiable={show}
Expand Down Expand Up @@ -84,6 +89,9 @@ export default Mount;

### 事件

Polygon v1.4.15 和 v2.0.xx 版本都是支持 drag 相关事件的,虽然官网文档有的写的不全,但经实验都是可以的。
<!--rehype:style=background: #fff3b7;-->

[事件类型文档](https://github.com/uiwjs/react-amap/blob/8a8c31afdff68e04097c2b140e9a58200b269aee/src/types/overlay.d.ts#L867-L893)

| 参数 | 说明 | 类型 |
Expand All @@ -97,7 +105,10 @@ export default Mount;
| onMouseUp | 鼠标抬起 | `(event: MapsEvent): void;` |
| onMouseOver | 鼠标经过 | `(event: MapsEvent): void;` |
| onMouseOut | 鼠标移出 | `(event: MapsEvent): void;` |
| onChange | 属性发生变化时 | `(): void;` |
| onDragStart | 拖拽开始 | `(event: MapsEvent): void;` |
| onDragging | 拖拽中 | `(event: MapsEvent): void;` |
| onDragEnd | 拖拽结束 | `(event: MapsEvent): void;` |
| onChange | 属性发生变化时 (只支持 v1.4.xx 版本) | `(event: { type: string, target: any }): void;` |
| onTouchStart | 触摸开始时触发事件,仅适用移动设备 | `(event: MapsEvent): void;` |
| onTouchMove | 触摸移动进行中时触发事件,仅适用移动设备 | `(event: MapsEvent): void;` |
| onTouchEnd | 触摸结束时触发事件,仅适用移动设备 | `(event: MapsEvent): void;` |
3 changes: 3 additions & 0 deletions packages/polygon/src/usePolygon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ export const usePolygon = (props = {} as UsePolygon) => {
'onMouseOver',
'onMouseOut',
'onChange',
'onDragStart',
'onDragging',
'onDragEnd',
'onTouchStart',
'onTouchMove',
'onTouchEnd',
Expand Down
16 changes: 14 additions & 2 deletions packages/polyline/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ const Example = () => {
}}
strokeColor="black"
strokeOpacity={1}
draggable={true}
onChange={e=>console.log(e)}
onDragStart={(e)=>{console.log(e)}}
onDragging={(e)=>{console.log(e)}}
onDragEnd={(e)=>{console.log(e)}}
path={[
[116.405289, 39.904987],
[113.964458, 40.54664],
Expand Down Expand Up @@ -157,12 +162,15 @@ export default Mount;

### 事件

Polyline v1.4.15 和 v2.0.xx 版本都是支持 drag 相关事件的,虽然官网文档有的写的不全,但经实验都是可以的。
<!--rehype:style=background: #fff3b7;-->

[事件类型文档](https://github.com/uiwjs/react-amap/blob/268303d/src/types/overlay.d.ts#L249-L274)

| 参数 | 说明 | 类型 |
| ---- | ---- | ---- |
| onHide | 隐藏 | (): void; |
| onShow | 显示 | (): void; |
| onHide | 隐藏 | (event: { type: string, target: any }): void; |
| onShow | 显示 | (event: { type: string, target: any }): void; |
| onMouseOut | 鼠标移出 | (event: MapsEvent): void; |
| onRightClick | 鼠标右键单击事件 | (event: MapsEvent): void; |
| onDblClick | 鼠标左键双击事件 | (event: MapsEvent): void; |
Expand All @@ -172,3 +180,7 @@ export default Mount;
| onTouchStart | 触摸开始时触发事件,仅适用移动设备 | (event: MapsEvent): void; |
| onMouseUp | 鼠标抬起 | (event: MapsEvent): void; |
| onMouseDown | 鼠标按下 | (event: MapsEvent): void; |
| onDragStart | 拖拽开始 | `(event: MapsEvent): void;` |
| onDragging | 拖拽中 | `(event: MapsEvent): void;` |
| onDragEnd | 拖拽结束 | `(event: MapsEvent): void;` |
| onChange | 属性发生变化时 | `(event: { type: string, target: any }): void;` |
3 changes: 3 additions & 0 deletions packages/polyline/src/usePolyline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ export function usePolyline(props = {} as UsePolyline) {
'onShow',
'onMouseOut',
'onChange',
'onDragStart',
'onDragging',
'onDragEnd',
'onRightClick',
'onDblClick',
'onMouseDown',
Expand Down
5 changes: 3 additions & 2 deletions packages/tile-layer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,8 @@ const Demo = () => {
}
const TiandituSatelliteOptions2={
getTileUrl: `http://t{0,1,2,3,4,5,6,7}.tianditu.gov.cn/DataServer?T=cva_w&tk=${TiandituKEY}&x=[x]&y=[y]&l=[z]`,
zIndex: 105
opacity:0.7,
zIndex: 101
}
const handleChangeTileLayer=(chgType,chgOptions)=>{
if(chgType===type){
Expand Down Expand Up @@ -297,7 +298,7 @@ const Demo = () => {
}

const Mount = () => (
<APILoader akay="a7a90e05a37d3f6bf76d4a9032fc9129">
<APILoader akay="a7a90e05a37d3f6bf76d4a9032fc9129">
<Demo />
</APILoader>
);
Expand Down
9 changes: 7 additions & 2 deletions packages/tile-layer/src/useTileLayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,18 @@ export function useTileLayer(props = {} as UseTileLayer) {
instance = new AMap.TileLayer(options);
}
if (!!instance) {
map.addLayer(instance);
// 暂不使用这个 API,这个不兼容 v1.4.xx
// map.addLayer(instance);
map.add(instance);
props.onAdded && props.onAdded();
setTileLayer(instance);
}
return () => {
if (instance) {
map.removeLayer(instance);
// 暂不使用这个 API,这个不兼容 v1.4.xx
// map.removeLayer(instance);

map.remove(instance);
setTileLayer(null as any);
props.onRemoved && props.onRemoved();
}
Expand Down