-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: this.rectDrawEnd is null #3
Comments
@GruianDavid yep, reproduced too. Thanks for reporting this! I'll take a look ASAP. |
After a few hours of digging i noticed that once in a while, the longer press of the button to create the first marker will trigger 2 types of events: The drag event will access the function onMouseMove(event) which prepares the variables for an upcoming square but the drag event has only the starting position (latlong). To get the ending position there must be at least 2 sets of data(2 drag events). Once the drag event actions finish, the click will trigger a new Point. On function onAddPoint(event) there is a validation to check if there was a square generation in progress (which was previously triggered). That validation passes and the generation of that square is taking place but since the coordinates are not yet set, an error will be thrown. My Solution:
should be replaced with this
|
I still seem to have issues with random squares generating when i click on a trackpad (easier to trigger drag event while clicking). I see that the else statement from my suggestion did not reach production (which was meant to fix this exact issue), any reason for that? |
Let's reopen this. Your suggestion with the |
Found the issue when i toggled the drawing button and sometimes on first click the marker didn't appear. On second try or third, one would eventually appear and work as expected. At first i thought it was something on my side but i managed to reproduce it on the demo site (https://bopen.github.io/leaflet-area-selection/).
How to reproduce:
It does not happen every time so multiple tries are required.
Step 1: Toggle draw button and click once on map.
Step 2: Toggle draw button again to stop drawing.
Step 3: Toggle draw button again and click once on map.
Step 4: Repeat a few times and it will eventually throw the error. (3-5 times worked for me)
Error on demo site:
TypeError: this.rectDrawEnd is null events.js:424:20 (function onDraggingRectEnd() )
C events.js:424
fire Events.js:190
f events.js:29
fire Events.js:190
m drawing-pane.js:29
m drawing-pane.js:31
onAdd control.js:76
addTo Control.js:70
addControl Control.js:137
index.js:75
u (index):1
main.a5a2d999.chunk.js:1
u (index):1
r (index):1
t (index):1
main.a5a2d999.chunk.js:1
events.js:424:20
Really appreciate the work put in on this repo. This has been my first issue opened on GitHub so if i need to provide more info on this issue, let me know :)
The text was updated successfully, but these errors were encountered: