Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions packages/maptalks/src/map/tool/DrawTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,22 @@ class DrawTool extends MapTool {
* @param name DrawTool mode name
* @return mode actions
*/
static getRegisterMode(name: string): any {
static getRegisterMode(name: string): modeActionType | undefined {
return registeredMode[name.toLowerCase()];
}

/**
* 获取all mode actions
*
* @english
* Get all mode actions
* @return mode actions
*/
static getAllRegisterMode(): Record<string, modeActionType> {
return Object.assign({}, registeredMode);
}


/**
* 实例化DrawTool工具
*
Expand Down Expand Up @@ -438,7 +450,7 @@ class DrawTool extends MapTool {
if (Array.isArray(action)) {
for (let i = 0; i < action.length; i++) {
//@internal
_events[action[i]] = this._events[action[i]];
_events[action[i]] = this._events[action[i]];
}
return _events;
}
Expand All @@ -455,7 +467,7 @@ class DrawTool extends MapTool {
*/
//@internal
_mouseDownHandler(event: any) {
if(!event?.coordinate) {
if (!event?.coordinate) {
return
}
this._createGeometry(event);
Expand All @@ -471,7 +483,7 @@ class DrawTool extends MapTool {
*/
//@internal
_mouseUpHandler(event: any) {
if(!event?.coordinate) {
if (!event?.coordinate) {
return
}
this.endDraw(event);
Expand All @@ -487,7 +499,7 @@ class DrawTool extends MapTool {
*/
//@internal
_clickHandler(event: any) {
if(!event?.coordinate) {
if (!event?.coordinate) {
return
}
if (!this.options.interactive) {
Expand Down Expand Up @@ -644,7 +656,7 @@ class DrawTool extends MapTool {
*/
//@internal
_mouseMoveHandler(event) {
if(!event?.coordinate) {
if (!event?.coordinate) {
return
}
if (!this.options.interactive) {
Expand Down Expand Up @@ -717,7 +729,7 @@ class DrawTool extends MapTool {
*/
//@internal
_doubleClickHandler(event) {
if(!event?.coordinate) {
if (!event?.coordinate) {
return
}
if (!this.options.interactive) {
Expand Down