Skip to content

Commit

Permalink
fix:Defend against the issue of being unable to obtain coordinates wh… (
Browse files Browse the repository at this point in the history
#2451)

* fix:Defend against the issue of being unable to obtain coordinates when the mouse moves to the sky.

* fix:Defend against the issue of being unable to obtain coordinates when the mouse moves to the sky
  • Loading branch information
minemine-m authored Oct 31, 2024
1 parent adba026 commit f44196f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/map/tool/DrawTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,9 @@ class DrawTool extends MapTool {
*/
//@internal
_mouseDownHandler(event: any) {
if(!event?.coordinate) {
return
}
this._createGeometry(event);
}

Expand All @@ -468,6 +471,9 @@ class DrawTool extends MapTool {
*/
//@internal
_mouseUpHandler(event: any) {
if(!event?.coordinate) {
return
}
this.endDraw(event);
}

Expand All @@ -481,6 +487,9 @@ class DrawTool extends MapTool {
*/
//@internal
_clickHandler(event: any) {
if(!event?.coordinate) {
return
}
if (!this.options.interactive) {
return this;
}
Expand Down Expand Up @@ -559,6 +568,7 @@ class DrawTool extends MapTool {
*/
//@internal
_createGeometry(event: any) {

const mode = this.getMode();
const map: any = this.getMap()
const registerMode = this._getRegisterMode();
Expand Down Expand Up @@ -634,6 +644,9 @@ class DrawTool extends MapTool {
*/
//@internal
_mouseMoveHandler(event) {
if(!event?.coordinate) {
return
}
if (!this.options.interactive) {
return this;
}
Expand Down Expand Up @@ -704,6 +717,9 @@ class DrawTool extends MapTool {
*/
//@internal
_doubleClickHandler(event) {
if(!event?.coordinate) {
return
}
if (!this.options.interactive) {
return this;
}
Expand Down

0 comments on commit f44196f

Please sign in to comment.