fix(draw): mapbox 删除组件不生效

This commit is contained in:
thinkinggis 2020-04-20 20:43:46 +08:00
parent 0b83a3b8f0
commit 12808f17ee
2 changed files with 8 additions and 3 deletions

View File

@ -1,8 +1,8 @@
/*
* @Author: lzxue
* @Date: 2020-04-03 19:24:16
* @Last Modified by: mikey.zhaopeng
* @Last Modified time: 2020-04-09 19:34:41
* @Last Modified by: lzxue
* @Last Modified time: 2020-04-20 20:40:33
*/
import { Control, DOM, IControlOption, PositionType, Scene } from '@antv/l7';
import './css/draw.less';
@ -90,6 +90,7 @@ export class DrawControl extends Control {
draw.title,
'draw-' + type,
container,
'click',
this.onButtonClick.bind(null, type),
);
} else if (type === 'delete' && controls[type] !== false) {
@ -99,6 +100,7 @@ export class DrawControl extends Control {
draw.title,
'draw-' + type,
container,
'mousedown',
this.onDeleteMode.bind(null, type),
);
}
@ -109,11 +111,12 @@ export class DrawControl extends Control {
tile: string,
className: string,
container: HTMLElement,
eventType: string,
fn: (...arg: any[]) => any,
) {
const link = DOM.create('button', className, container);
link.title = tile;
link.addEventListener('mouseup', fn, false);
link.addEventListener(eventType, fn, false);
return link;
}

View File

@ -217,6 +217,8 @@ export default abstract class DrawFeature extends DrawMode {
this.clear();
this.source.removeFeature(this.currentFeature as Feature);
this.normalLayer.update(this.source.data);
this.drawLayer.disableSelect();
this.currentFeature = null;
}
};