diff --git a/packages/draw/src/draw_control.ts b/packages/draw/src/draw_control.ts index 230fa40159..84b0e18ebd 100644 --- a/packages/draw/src/draw_control.ts +++ b/packages/draw/src/draw_control.ts @@ -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, diff --git a/stories/Draw/Components/Circle.tsx b/stories/Draw/Components/Circle.tsx index ebe983aae3..9fd4f9b724 100644 --- a/stories/Draw/Components/Circle.tsx +++ b/stories/Draw/Components/Circle.tsx @@ -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); }); }); } diff --git a/stories/Draw/Components/DrawControl.tsx b/stories/Draw/Components/DrawControl.tsx index b1e50eb5c2..eff28c6996 100644 --- a/stories/Draw/Components/DrawControl.tsx +++ b/stories/Draw/Components/DrawControl.tsx @@ -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); }); }