Skip to content

Commit

Permalink
fix: 解决WGS84格式下 LayerPopup 添加字段导致形变的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
syb01094648 committed Dec 22, 2023
1 parent 2ce3be7 commit 27d54cb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
11 changes: 2 additions & 9 deletions src/components/layer-list/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import type {
PolygonLayerProps} from '@antv/larkmap';
import {
LineLayer,
PointLayer,
PolygonLayer,
useScene,
} from '@antv/larkmap';
import type { PolygonLayerProps } from '@antv/larkmap';
import { LineLayer, PointLayer, PolygonLayer, useScene } from '@antv/larkmap';
import type { Feature } from '@turf/turf';
import { useAsyncEffect } from 'ahooks';
import Color from 'color';
Expand Down Expand Up @@ -33,7 +27,6 @@ export const LayerList: React.FC = () => {
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [newFeatures, coordConvert, baseMap]);

const [
pointSource,
lineSource,
Expand Down
13 changes: 10 additions & 3 deletions src/components/layer-popup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import { useDrawHelper } from '../../hooks';
import { useFeature, useGlobal } from '../../recoil';
import { getDrawStyle, isCircle, isRect } from '../../utils';
import { prettierText } from '../../utils/prettier-text';
// import './index.css';
import useStyle from './styles';

const { Paragraph } = Typography;
Expand Down Expand Up @@ -289,7 +288,11 @@ export const LayerPopup: React.FC = () => {
feature.properties?.[FeatureKey.Index]
);
});
features[index] = feature;
const revertFeature = revertCoord([feature])[0];
features[index] = revertFeature as Feature<
Geometry | GeometryCollection,
object
>;
saveEditorText(prettierText({ content: featureCollection(features) }));
}
setTableClick({ isInput: false, index: null });
Expand All @@ -311,7 +314,11 @@ export const LayerPopup: React.FC = () => {
feature.properties?.[FeatureKey.Index]
);
});
features[index] = feature;
const revertFeature = revertCoord([feature])[0];
features[index] = revertFeature as Feature<
Geometry | GeometryCollection,
object
>;
saveEditorText(prettierText({ content: featureCollection(features) }));
setAddValue({ label: undefined, value: undefined });
setAddOpen(!addOpen);
Expand Down

0 comments on commit 27d54cb

Please sign in to comment.