|
|
|
@ -2,8 +2,33 @@ import { OverlayTypes } from "@types";
|
|
|
|
|
import { BaseOverlayEditor } from "./BaseOverlayEditor"; |
|
|
|
|
|
|
|
|
|
export class RectangleEditor extends BaseOverlayEditor<AMap.RectangleEditor> { |
|
|
|
|
// private _rect: AMap.Rectangle | undefined;
|
|
|
|
|
// constructor(map: AMap.Map) {
|
|
|
|
|
// super(map);
|
|
|
|
|
// this._rect = new AMap.Rectangle({
|
|
|
|
|
// bounds: new AMap.Bounds(
|
|
|
|
|
// new AMap.LngLat(0, 0.001),
|
|
|
|
|
// new AMap.LngLat(0, 0.001)
|
|
|
|
|
// ),
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
initEditor(map: AMap.Map) { |
|
|
|
|
return new AMap.RectangleEditor(this.map); |
|
|
|
|
return new AMap.RectangleEditor(map); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
finish() { |
|
|
|
|
const target = this.editor.getTarget(); |
|
|
|
|
if (target == null) { |
|
|
|
|
this.editor.close(); |
|
|
|
|
// FixME: 直接close, 切换其他工具会有报错.
|
|
|
|
|
(this.editor as any)._creator?.close(); |
|
|
|
|
} else { |
|
|
|
|
this.editor.setTarget(null); |
|
|
|
|
this.editor.close(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return target; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
getType(): OverlayTypes { |
|
|
|
|