mirror of https://gitee.com/antv-l7/antv-l7
commit
44d7047c68
|
@ -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);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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]);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ export default class Tooltip extends React.Component {
|
|||
'#CF1D49',
|
||||
])
|
||||
.shape('fill')
|
||||
.select(true)
|
||||
.style({
|
||||
opacity: 0.8,
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue