Merge pull request #335 from antvis/fix_draw

fix(draw): fix draw rect bug
This commit is contained in:
@thinkinggis 2020-05-08 14:19:45 +08:00 committed by GitHub
commit 523500c334
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View File

@ -92,6 +92,8 @@ export default abstract class DrawFeature extends DrawMode {
}
public clear() {
this.drawLayer.disableSelect();
this.drawLayer.disableEdit();
this.drawLayer.hide();
this.drawVertexLayer.hide();
this.hideOtherLayer();
@ -197,6 +199,8 @@ export default abstract class DrawFeature extends DrawMode {
break;
case DrawModes.STATIC:
this.source.updateFeature(this.currentFeature as Feature);
this.selectMode.disable();
this.editMode.disable();
this.source.clearFeatureActive();
this.drawVertexLayer.hide();
this.drawVertexLayer.disableEdit();
@ -218,7 +222,9 @@ export default abstract class DrawFeature extends DrawMode {
};
private onDrawMove = (delta: ILngLat) => {
if (this.drawStatus === 'DrawSelected') {
this.moveFeature(delta);
}
};
private onDrawEdit = (endpoint: ILngLat) => {
@ -231,7 +237,9 @@ export default abstract class DrawFeature extends DrawMode {
this.source.removeFeature(this.currentFeature as Feature);
this.normalLayer.update(this.source.data);
this.drawLayer.disableSelect();
this.selectMode.disable();
this.currentFeature = null;
// this.drawStatus = 'DrawDelete';
}
};

View File

@ -17,7 +17,8 @@ export type DrawStatus =
| 'DrawSelected'
| 'DrawEdit'
| 'DrawFinish'
| 'EditFinish';
| 'EditFinish'
| 'DrawDelete';
let DrawFeatureId = 0;