Merge pull request #771 from antvis/shihui_dev

Shihui dev
This commit is contained in:
YiQianYao 2021-09-16 17:41:19 +08:00 committed by GitHub
commit 44d7047c68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 63 additions and 32 deletions

View File

@ -135,7 +135,7 @@ export default class Layers extends Control {
this.addLayer(baseLayers[name], name, false);
});
Object.keys(overlayers).forEach((name: any, index: number) => {
// overlayers[name].once('inited', this.update);
overlayers[name].once('inited', this.update);
this.addLayer(overlayers[name], name, true);
});
}

View File

@ -2,6 +2,7 @@ import { decodePickingColor, DOM, encodePickingColor } from '@antv/l7-utils';
import { inject, injectable } from 'inversify';
import 'reflect-metadata';
import { TYPES } from '../../types';
import { isEventCrash } from '../../utils/dom';
import { IGlobalConfigService, ISceneConfig } from '../config/IConfigService';
import {
IInteractionService,
@ -321,28 +322,9 @@ export default class PickingService implements IPickingService {
) {
layer.emit(target.type, target);
// 判断是否发生事件冲突
// if (this.isEventCrash(target)) {
// layer.emit(target.type, target);
// }
}
/**
* marker/popup marker/popup
* @param obj
* @returns
*/
private isEventCrash(obj: any) {
let notCrash = true;
obj.target.path.map((p: HTMLElement) => {
if (p.classList) {
p.classList.forEach((n: any) => {
if (n === 'l7-marker' || n === 'l7-popup') {
notCrash = false;
}
});
}
});
return notCrash;
if (isEventCrash(target)) {
layer.emit(target.type, target);
}
}
/**

View File

@ -25,3 +25,22 @@ export function createRendererContainer(
return null;
}
/**
* marker/popup marker/popup
* @param obj
* @returns
*/
export function isEventCrash(obj: any) {
let notCrash = true;
obj?.target?.path?.map((p: HTMLElement) => {
if (p?.classList) {
p?.classList?.forEach((n: any) => {
if (n === 'l7-marker' || n === 'l7-popup') {
notCrash = false;
}
});
}
});
return notCrash;
}

View File

@ -81,7 +81,7 @@ export default class ScaleComponent extends React.Component {
pointLayer.on('mouseout', (e) => {
console.log(2, e);
});
const scaleControl = new Scale();
// const scaleControl = new Scale();
const layers = {
点图层: pointLayer,
面图层: layer,
@ -91,12 +91,37 @@ export default class ScaleComponent extends React.Component {
position: 'bottomright',
});
scene.addControl(scaleControl);
// scene.addControl(scaleControl);
scene.addControl(layerControl);
const zoomControl = new Zoom({
position: 'bottomright',
});
scene.addControl(zoomControl);
// const zoomControl = new Zoom({
// position: 'bottomright',
// });
// scene.addControl(zoomControl);
setTimeout(() => {
const pointLayer3 = new PointLayer({
name: '02',
enablePropagation: true,
})
.source(pointsData, {
cluster: true,
})
.shape('circle')
.scale('point_count', {
type: 'quantile',
})
.size('point_count', [3])
.animate(false)
.active(false)
.color('red')
.style({
opacity: 0.5,
strokeWidth: 1,
});
scene.addLayer(pointLayer3);
layerControl.addVisualLayer(pointLayer3, 'pointLayer3');
}, 2000);
}
public render() {

View File

@ -219,7 +219,7 @@ export default class Country extends React.Component {
data,
geoDataLevel: 1,
joinBy: ['adcode', 'code'],
adcode: [],
adcode: [province],
stroke: '#7096B3',
depth: 2,
showBorder: false,
@ -244,7 +244,7 @@ export default class Country extends React.Component {
return (
<>
<Select
defaultValue="北京市"
defaultValue="黑龙江省"
style={{
width: 120,
zIndex: 2,
@ -252,7 +252,10 @@ export default class Country extends React.Component {
right: '10px',
top: '10px',
}}
onChange={this.handleProvinceChange}
// onChange={this.handleProvinceChange}
onChange={() => {
console.log('change');
}}
>
{ProvinceData.map((province, i) => {
return (
@ -280,6 +283,7 @@ export default class Country extends React.Component {
this.setState({
province: value,
});
console.log('value', value);
this.provinceLayer.updateDistrict([value]);
};
}

View File

@ -37,6 +37,7 @@ export default class Tooltip extends React.Component {
'#CF1D49',
])
.shape('fill')
.select(true)
.style({
opacity: 0.8,
});