From acfa2dec33db454c0bba706778fb0756e4b9f4e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=81=86=E4=B8=80?= Date: Fri, 21 Feb 2020 14:43:37 +0800 Subject: [PATCH 1/5] =?UTF-8?q?fix:=20=E5=88=A0=E9=99=A4react=20Scene?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E9=94=99=E8=AF=AF=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/react/src/component/Scene.tsx | 8 -------- 1 file changed, 8 deletions(-) diff --git a/packages/react/src/component/Scene.tsx b/packages/react/src/component/Scene.tsx index 2dd72e741e..ea4d47940c 100644 --- a/packages/react/src/component/Scene.tsx +++ b/packages/react/src/component/Scene.tsx @@ -37,14 +37,6 @@ export default React.memo((props: IMapSceneConig) => { }; }, []); - // 更新地图 - useEffect(() => { - if (!scene) { - return; - } - scene.setMapStyle(style); - }, [style]); - return ( {createElement( From 7a3105f156ca10c992cf180d6bce310095471e9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=81=86=E4=B8=80?= Date: Fri, 21 Feb 2020 14:49:20 +0800 Subject: [PATCH 2/5] =?UTF-8?q?fix:=20=E4=BA=8B=E4=BB=B6=E5=8F=96=E6=B6=88?= =?UTF-8?q?=E8=AE=A2=E9=98=85bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/react/src/component/SceneEvent.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react/src/component/SceneEvent.tsx b/packages/react/src/component/SceneEvent.tsx index 96e23347b5..e0840267d4 100644 --- a/packages/react/src/component/SceneEvent.tsx +++ b/packages/react/src/component/SceneEvent.tsx @@ -14,7 +14,7 @@ export const SceneEvent = React.memo((props: ILayerProps) => { useEffect(() => { mapScene.on(type, handler); return () => { - mapScene.off('type', handler); + mapScene.off(type, handler); }; }, [type]); return null; From 304302a3ac6aa1e9eb2ece701c6a952a99626cec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=81=86=E4=B8=80?= Date: Fri, 21 Feb 2020 14:53:13 +0800 Subject: [PATCH 3/5] =?UTF-8?q?fix:=20=20=E5=88=A0=E9=99=A4Scene=E7=9A=84o?= =?UTF-8?q?ption?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/react/src/component/Scene.tsx | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/packages/react/src/component/Scene.tsx b/packages/react/src/component/Scene.tsx index ea4d47940c..61ac72a269 100644 --- a/packages/react/src/component/Scene.tsx +++ b/packages/react/src/component/Scene.tsx @@ -4,16 +4,12 @@ import { SceneContext } from './SceneContext'; interface IMapSceneConig { style?: React.CSSProperties; - // 配置项,比如是否禁止鼠标缩放地图 - options?: { - [key: string]: any; - }; className?: string; map: IMapWrapper; children?: JSX.Element | JSX.Element[] | Array; } export default React.memo((props: IMapSceneConig) => { - const { style, className, map, options } = props; + const { style, className, map } = props; const container = createRef(); const [scene, setScene] = useState(); useEffect(() => { @@ -23,14 +19,6 @@ export default React.memo((props: IMapSceneConig) => { }); sceneInstance.on('loaded', () => { setScene(sceneInstance); - // 禁止鼠标滚轮缩放地图 - if (options && !options.enableMouseZoom) { - const mapsService = sceneInstance.getMapService(); - if (mapsService && mapsService.getType() === 'mapbox') { - (mapsService.map as any).scrollZoom.disable(); - } - // TODO高德地图的禁止待补充 - } }); return () => { sceneInstance.destroy(); From 9af05f2671a36618dfd8437b8c2837af34ac743c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=81=86=E4=B8=80?= Date: Fri, 21 Feb 2020 15:00:10 +0800 Subject: [PATCH 4/5] =?UTF-8?q?fix:=20=E4=BA=8B=E4=BB=B6off=E4=BC=A0?= =?UTF-8?q?=E5=8F=82=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/react/src/component/LayerEvent.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react/src/component/LayerEvent.tsx b/packages/react/src/component/LayerEvent.tsx index db290fa300..5f57ec9683 100644 --- a/packages/react/src/component/LayerEvent.tsx +++ b/packages/react/src/component/LayerEvent.tsx @@ -14,7 +14,7 @@ export const LayerEvent = React.memo((props: ILayerProps) => { useEffect(() => { layer.on(type, handler); return () => { - layer.off('type', handler); + layer.off(type, handler); }; }, [type]); return null; From 26f3a7b7419def3d67a2806b9f9bde212ef96927 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=81=86=E4=B8=80?= Date: Fri, 21 Feb 2020 15:15:12 +0800 Subject: [PATCH 5/5] =?UTF-8?q?fix(l7-react):=20=E4=BF=AE=E5=A4=8DautoFit?= =?UTF-8?q?=E4=B8=80=E7=9B=B4=E4=B8=BAtrue=EF=BC=8C=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E8=87=AA=E9=80=82=E5=BA=94=E7=BC=A9=E6=94=BE?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/react/src/component/LayerAttribute/Layer.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/react/src/component/LayerAttribute/Layer.tsx b/packages/react/src/component/LayerAttribute/Layer.tsx index 55aec053da..c7382c5a9f 100644 --- a/packages/react/src/component/LayerAttribute/Layer.tsx +++ b/packages/react/src/component/LayerAttribute/Layer.tsx @@ -58,6 +58,10 @@ export default function BaseLayer(type: string, props: ILayerProps) { // 重绘layer if (layer) { mapScene.render(); + // 如果autoFit为true,执行自适应操作 + if (options?.autoFit) { + layer.fitBounds(); + } } }); @@ -65,7 +69,7 @@ export default function BaseLayer(type: string, props: ILayerProps) { if (layer && layer.inited) { layer.updateLayerConfig(options); } - }, [options?.maxZoom, options?.maxZoom, options?.visible, options?.autoFit]); + }, [options?.maxZoom, options?.maxZoom, options?.visible]); useEffect(() => { if (layer && layer.inited && options && options.zIndex) {