Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 修复 LayerPopup followCursor 默认值问题 #2446

Merged
merged 1 commit into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/demos/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { MapRender as control } from './control';
export { MapRender as layerPopup } from './layerPopup';
export { MapRender as marker } from './marker';
export { MapRender as swipe } from './swipe';
62 changes: 62 additions & 0 deletions examples/demos/components/layerPopup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { LayerPopup, PointLayer, Scene } from '@antv/l7';
import * as allMap from '@antv/l7-maps';
import type { RenderDemoOptions } from '../../types';

export function MapRender(options: RenderDemoOptions) {
const scene = new Scene({
id: 'map',
renderer: options.renderer,
map: new allMap.GaodeMap({
style: 'light',
center: [121.435159, 31.256971],
zoom: 14.89,
minZoom: 10,
}),
});
scene.on('loaded', () => {
fetch('https://gw.alipayobjects.com/os/basement_prod/893d1d5f-11d9-45f3-8322-ee9140d288ae.json')
.then((res) => res.json())
.then((data) => {
const pointLayer = new PointLayer({
name: 'layer',
})
.source(data, {
parser: {
type: 'json',
x: 'longitude',
y: 'latitude',
},
})
.shape('name', [
'circle',
'triangle',
'square',
'pentagon',
'hexagon',
'octogon',
'hexagram',
'rhombus',
'vesica',
])
.size('unit_price', [10, 25])
.color('name', ['#5B8FF9', '#5CCEA1', '#5D7092', '#F6BD16', '#E86452'])
.style({
opacity: 1,
strokeWidth: 2,
});

scene.addLayer(pointLayer);

const layerPopup = new LayerPopup({
items: [
{
layer: 'layer',
fields: ['name', 'count'],
},
],
});

scene.addPopup(layerPopup);
});
});
}
3 changes: 1 addition & 2 deletions packages/component/src/popup/layerPopup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ export default class LayerPopup extends Popup<ILayerPopupOption> {
}

protected getDefault(option: Partial<ILayerPopupOption>): ILayerPopupOption {
const isHoverTrigger = option.trigger === 'hover';

const isHoverTrigger = option.trigger !== 'click';
return {
...super.getDefault(option),
trigger: 'hover',
Expand Down
Loading