Merge pull request #512 from antvis/fix_map_dependencies

Fix map dependencies
This commit is contained in:
@thinkinggis 2020-09-09 18:04:20 +08:00 committed by GitHub
commit 024765a97d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 26 additions and 21 deletions

View File

@ -214,13 +214,16 @@ export default class Popup extends EventEmitter implements IPopup {
}
// 高德地图需要阻止事件冒泡 // 测试mapbox 地图不需要添加
['mousemove', 'mousedown', 'mouseup', 'click', 'dblclick'].forEach(
(type) => {
this.container.addEventListener(type, (e) => {
e.stopPropagation();
});
},
);
const { stopPropagation } = this.popupOption;
if (stopPropagation) {
['mousemove', 'mousedown', 'mouseup', 'click', 'dblclick'].forEach(
(type) => {
this.container.addEventListener(type, (e) => {
e.stopPropagation();
});
},
);
}
}
if (maxWidth && this.container.style.maxWidth !== maxWidth) {
this.container.style.maxWidth = maxWidth;

View File

@ -18,6 +18,6 @@ describe('extrude polyline', () => {
coord[1] = lat;
});
const mesh = extrude.extrude(coords);
expect(mesh.indices.length).toBe(6);
expect(mesh.indices.length).toBe(12);
});
});

View File

@ -97,7 +97,7 @@ export default class ExtrudePolyline {
this.normal = null;
this.totalDistance = 0;
// 去除数组里重复的点
points = getArrayUnique(points);
// points = getArrayUnique(points);
const total = points.length;
let count = complex.startIndex;
for (let i = 1; i < total; i++) {

View File

@ -39,7 +39,7 @@
},
"devDependencies": {
"@types/gl-matrix": "^2.4.5",
"@types/mapbox-gl": "^0.54.3",
"@types/mapbox-gl": "^1.11.2",
"@types/viewport-mercator-project": "^6.1.0"
},
"gitHead": "20154fe30d512024b03ac5e40f77731bc0580bb0",

View File

@ -2,6 +2,8 @@ import {
AMapScene,
LayerContext,
LineLayer,
PolygonLayer,
MapboxScene,
Marker,
Popup,
SceneContext,
@ -45,14 +47,14 @@ export default React.memo(function Map() {
option={{
closeOnClick: false,
}}
lnglat={[110.1938, 50.25] as number[]}
lnglat={[110.1938, 30.25] as number[]}
>
<p onClick={popupClick}>122222</p>
<p onClick={popupClick}>122224</p>
</Popup>
<Marker lnglat={[110.1938, 30.25] as number[]}>
<p onClick={popupClick}>122222</p>
<Marker lnglat={[100.1938, 30.25] as number[]}>
<p onClick={popupClick}>tes</p>
</Marker>
<LineLayer
<PolygonLayer
key={'2'}
source={{
data,
@ -64,7 +66,7 @@ export default React.memo(function Map() {
values: '#fff',
}}
shape={{
values: 'line',
values: 'fill',
}}
style={{
opacity: 1,
@ -76,7 +78,7 @@ export default React.memo(function Map() {
return null;
}}
</LayerContext.Consumer>
</LineLayer>
</PolygonLayer>
</AMapScene>
</>
);

View File

@ -5429,10 +5429,10 @@
resolved "https://registry.npm.taobao.org/@types/lodash/download/@types/lodash-4.14.161.tgz?cache=0&sync_timestamp=1598664997598&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Flodash%2Fdownload%2F%40types%2Flodash-4.14.161.tgz#a21ca0777dabc6e4f44f3d07f37b765f54188b18"
integrity sha1-ohygd32rxuT0Tz0H83t2X1QYixg=
"@types/mapbox-gl@^0.54.3":
version "0.54.5"
resolved "https://registry.npm.taobao.org/@types/mapbox-gl/download/@types/mapbox-gl-0.54.5.tgz#d50285796cb9d3544121d9e2b5314da99f9774bf"
integrity sha1-1QKFeWy501RBIdnitTFNqZ+XdL8=
"@types/mapbox-gl@^1.11.2":
version "1.11.2"
resolved "https://registry.npmjs.org/@types/mapbox-gl/-/mapbox-gl-1.11.2.tgz#e989264075ac6be633837c21241f4acd54692ceb"
integrity sha512-IXfOnFPAbxnEhSG89MjFxuqIX6bJioPHA55yExM0qAaVdT+kfJX7P4d0wfW0Br3iSdq9ym8C9jCYHpuLT4FE6Q==
dependencies:
"@types/geojson" "*"