mirror of https://gitee.com/antv-l7/antv-l7
Merge pull request #317 from antvis/fix_draw
fix(draw): draw control event
This commit is contained in:
commit
e0c9f5cff0
|
@ -142,7 +142,7 @@ export class DrawControl extends Control {
|
|||
if (this.draw[draw]) {
|
||||
['draw.create', 'draw.update', 'draw.delete'].forEach(
|
||||
(type: string) => {
|
||||
this.draw[draw].on('draw.create', (feature) => {
|
||||
this.draw[draw].on(type, (feature) => {
|
||||
this.emit(type, {
|
||||
drawType: draw,
|
||||
feature,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { LineLayer, PointLayer, PolygonLayer, Popup, Scene } from '@antv/l7';
|
||||
import { DrawCircle } from '@antv/l7-draw';
|
||||
import { DrawPolygon } from '@antv/l7-draw';
|
||||
import { GaodeMap, Mapbox } from '@antv/l7-maps';
|
||||
|
||||
import * as React from 'react';
|
||||
|
@ -23,13 +23,13 @@ export default class Circle extends React.Component {
|
|||
this.scene = scene;
|
||||
|
||||
scene.on('loaded', () => {
|
||||
const drawCircle = new DrawCircle(scene);
|
||||
const drawCircle = new DrawPolygon(scene);
|
||||
drawCircle.enable();
|
||||
drawCircle.on('draw.create', (e: any) => {
|
||||
console.log(e);
|
||||
});
|
||||
drawCircle.on('draw.update', (e: any) => {
|
||||
console.log(e);
|
||||
console.log('update', e);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -36,6 +36,9 @@ export default class Circle extends React.Component {
|
|||
},
|
||||
});
|
||||
scene.on('click', () => {});
|
||||
drawControl.on('draw.update', (e: any) => {
|
||||
console.log('update', e);
|
||||
});
|
||||
scene.addControl(drawControl);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue