Merge pull request #623 from antvis/fix_mousedown

Fix mousedown
This commit is contained in:
@thinkinggis 2021-01-14 17:41:42 +08:00 committed by GitHub
commit 975d6be65f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 6 deletions

View File

@ -81,11 +81,10 @@ export default class InteractionService extends EventEmitter
// hammertime.get('pinch').set({ enable: true }); // hammertime.get('pinch').set({ enable: true });
hammertime.on('dblclick click', this.onHammer); hammertime.on('dblclick click', this.onHammer);
hammertime.on('panstart panmove panend pancancel', this.onDrag); hammertime.on('panstart panmove panend pancancel', this.onDrag);
// hammertime.on('press pressup', this.onHammer);
// $containter.addEventListener('touchstart', this.onTouch); // $containter.addEventListener('touchstart', this.onTouch);
$containter.addEventListener('mousemove', this.onHover); $containter.addEventListener('mousemove', this.onHover);
// $containter.addEventListener('click', this.onHover); // $containter.addEventListener('click', this.onHover);
$containter.addEventListener('mousedown', this.onHover); $containter.addEventListener('mousedown', this.onHover, true);
$containter.addEventListener('mouseup', this.onHover); $containter.addEventListener('mouseup', this.onHover);
$containter.addEventListener('contextmenu', this.onHover); $containter.addEventListener('contextmenu', this.onHover);

View File

@ -1,2 +1,2 @@
const version = '2.3.4'; const version = '2.3.5';
export { version }; export { version };

View File

@ -15,9 +15,9 @@ export default class PointImage extends React.Component {
); );
const scene = new Scene({ const scene = new Scene({
id: 'map', id: 'map',
map: new GaodeMap({ map: new Mapbox({
center: [121.4, 31.258134], center: [121.4, 31.258134],
zoom: 5, zoom: 12,
pitch: 0, pitch: 0,
style: 'normal', style: 'normal',
}), }),
@ -52,7 +52,6 @@ export default class PointImage extends React.Component {
}, },
}) })
.shape('type', (v: any) => { .shape('type', (v: any) => {
console.log(v);
return v; return v;
}) })
// .shape('triangle') // .shape('triangle')
@ -60,6 +59,12 @@ export default class PointImage extends React.Component {
.active(false) .active(false)
.size(20); .size(20);
scene.addLayer(imageLayer); scene.addLayer(imageLayer);
imageLayer.on('mousedown', (e) => {
console.log('mousedown', e);
});
imageLayer.on('click', (e) => {
console.log('click', e);
});
} }
public render() { public render() {