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

View File

@ -18,6 +18,6 @@ describe('extrude polyline', () => {
coord[1] = lat; coord[1] = lat;
}); });
const mesh = extrude.extrude(coords); 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.normal = null;
this.totalDistance = 0; this.totalDistance = 0;
// 去除数组里重复的点 // 去除数组里重复的点
points = getArrayUnique(points); // points = getArrayUnique(points);
const total = points.length; const total = points.length;
let count = complex.startIndex; let count = complex.startIndex;
for (let i = 1; i < total; i++) { for (let i = 1; i < total; i++) {

View File

@ -39,7 +39,7 @@
}, },
"devDependencies": { "devDependencies": {
"@types/gl-matrix": "^2.4.5", "@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" "@types/viewport-mercator-project": "^6.1.0"
}, },
"gitHead": "20154fe30d512024b03ac5e40f77731bc0580bb0", "gitHead": "20154fe30d512024b03ac5e40f77731bc0580bb0",

View File

@ -2,6 +2,8 @@ import {
AMapScene, AMapScene,
LayerContext, LayerContext,
LineLayer, LineLayer,
PolygonLayer,
MapboxScene,
Marker, Marker,
Popup, Popup,
SceneContext, SceneContext,
@ -45,14 +47,14 @@ export default React.memo(function Map() {
option={{ option={{
closeOnClick: false, 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> </Popup>
<Marker lnglat={[110.1938, 30.25] as number[]}> <Marker lnglat={[100.1938, 30.25] as number[]}>
<p onClick={popupClick}>122222</p> <p onClick={popupClick}>tes</p>
</Marker> </Marker>
<LineLayer <PolygonLayer
key={'2'} key={'2'}
source={{ source={{
data, data,
@ -64,7 +66,7 @@ export default React.memo(function Map() {
values: '#fff', values: '#fff',
}} }}
shape={{ shape={{
values: 'line', values: 'fill',
}} }}
style={{ style={{
opacity: 1, opacity: 1,
@ -76,7 +78,7 @@ export default React.memo(function Map() {
return null; return null;
}} }}
</LayerContext.Consumer> </LayerContext.Consumer>
</LineLayer> </PolygonLayer>
</AMapScene> </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" 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= integrity sha1-ohygd32rxuT0Tz0H83t2X1QYixg=
"@types/mapbox-gl@^0.54.3": "@types/mapbox-gl@^1.11.2":
version "0.54.5" version "1.11.2"
resolved "https://registry.npm.taobao.org/@types/mapbox-gl/download/@types/mapbox-gl-0.54.5.tgz#d50285796cb9d3544121d9e2b5314da99f9774bf" resolved "https://registry.npmjs.org/@types/mapbox-gl/-/mapbox-gl-1.11.2.tgz#e989264075ac6be633837c21241f4acd54692ceb"
integrity sha1-1QKFeWy501RBIdnitTFNqZ+XdL8= integrity sha512-IXfOnFPAbxnEhSG89MjFxuqIX6bJioPHA55yExM0qAaVdT+kfJX7P4d0wfW0Br3iSdq9ym8C9jCYHpuLT4FE6Q==
dependencies: dependencies:
"@types/geojson" "*" "@types/geojson" "*"