I am encountering an issue with the OnClientMarkerDragged event for the SimpleMarkerOverlay. My eventual goal is to place markers on the map based on the result of geocoding an address, and allow the user to drag the marker to a new position to handle poor geocoding and then update backend with the new position based on the marker’s new position. I’ve rigged up a simple map for testing marker dragging. However, whenever I make the ajax callback to the server from the function attached to the OnClientMarkerDragged event the map and argument parameters of the function are null. I’ve also rigged up a button that calls the same function serverside when clicked and it works properly, both the map and parameters are being passed. Is there something wrong, or am I trying to do something with the event that it wasn’t designed for?
Issue with SimpleMarkerOverlay OnClientMarkerDragged Event
Hi Michael,
Would you please attach your test sample for us? and which version you are referring? we didn’t recreate your issue in our end.
Thanks,
Troy
I am running the evaluation version of MVC Edition 7.0. I’ve attached the project directory.
Hi Michael,
Thanks for the sample, I find the issue is from the parameters when you package it, Please try to modify the codes from:
var param = { postion: e.worldXY, marker: e.markerId, overlay: e.overlayId };
To
var param = { "postion": e.worldXY.lat + "," + e.worldXY.lon, "marker": e.markerId, "overlay": e.overlayId };
That is because currently, the parameter not support the complex object.
Hope it helps,
Troy
Yes, it is working now. I have one more question regarding this. According to the wiki the OnClientMarkerDragged event has a default parameter e whose parameters are worldXY, overlayId and markerId. Is the overlayId the id of the SimpleMarkerOverlay containing the marker dragged? I ask because in the uploaded code I specifically give the SimpleMarkerOverlay used the id of “Markers” when I create it, yet the parameter e.overlayId is returning as undefined.
Edit: I also would like to report a bug. It appears that the Opacity property of markers and popups (at least when they are attached to a marker) does not work.
Edit2: Also, popup location seems to display odd behavior. Specifically it doesn’t appear to be placing the popup correctly when the marker the popup is attached to on the right half of the screen. I’ve modified my sample project from the original post to show this and uploaded it as the file MarkerTestingPopupBug.zip. The problem is clearly visible with the rightmost marker.
Hi Michael,
Thanks for reporting bugs. Now, we have fixed the two bugs: 1)the undefined of parameter e.overlayId. 2)the Opacity property of popup don’t work.(marker’s property works fine)
In order to fix the bugs, please get the latest development version(7.0.337.0) or higher.
As for the “Edit2”, I didn’t see the wired behavior after I comment out Popup.OffsetXInPixels and Popup.OffsetYInPixels, would you let me know more details on your issue? Maybe a screenshot is better.
Thanks,
Troy
I did a bit more testing, and the problem is that the placement of the popup with regards to the marker (and thus how the offset is applied) seems to be dependent on which quadrant of the screen the marker is in. I’ve attached three screenshots of a simple test with one marker in each quadrant of the screen with the popup visibility set to true so it is always displayed. Notice the placement of the popup with respect to the marker. One screenshot has no offset applied, the second has an offset of 50 pixels in X and 0 in Y, and the third has an offset of 50 pixels in Y and 0 in X.
Hi Michael,
Thanks for the details but I have to say it is hard to auto-adjust the position of popup once we have set the offset for the popup. I have reported it to our issue system so that we will keep working on it in the future.
Sorry for any inconvenience.
Thanks,
Troy