No, there is loss of precision (and not slight) when using event:MapMouseEvent(). With fromViewportToLatLng it places marker exactly where I dropped image.
Thank you once more! On 26 мар, 22:53, Arothian <[email protected]> wrote: > Glad to see it works! It seems there is a slight loss of precision > when using the fromViewportToLatLng but not bad at all! > > On Mar 26, 11:30 am, flibustier <[email protected]> wrote: > > > thank you! > > fromViewportToLatLng works fine > > > this are: > > > > localX, localY > > > current LatLng > > > the resulting point of fromLatLngToPoint(current_LatLng) > > > (x=619, y=428) > > (55.794296803725715, 49.11244842327883) > > (x=21354827.97492338, y=10482822.074857805) > > > (55.79483359317204, 49.112266033065815) // > > fromViewportToLatLng.toString() > > (55.79502056303964, 49.113006322753925) //this.current_latlng.toString > > () > > > On 26 мар, 18:13, Arothian <[email protected]> wrote: > > > > What happens if you use fromViewportToLatLng? > > > > Can you print out the following: > > > localX, localY > > > current LatLng > > > the resulting point of fromLatLngToPoint(current_LatLng) > > > > On Mar 26, 11:08 am, flibustier <[email protected]> wrote: > > > > > no, it doesn't work :( > > > > > (85.05076040053704, -179.99280095100403) // this.map.fromPointToLatLng > > > > (new Point > > > > (event.localX, event.localY)).toString() > > > > (55.79488787483897, 49.113017051589985) // current_LatLng.toString() > > > > > with globalX and globalY doesn't work either > > > > > On 26 мар, 15:24, Arothian <[email protected]> wrote: > > > > > > Do you need to keep track of the latLng throught the drag'n'drop? > > > > > > If you don't, then simply get the latLng in your onDragEnd handler: > > > > > > var position:LatLng = this.map.fromPointToLatLng(new Point > > > > > (event.localX, event.localY)); > > > > > > Let me know how it goes. I haven't tried using drop'n'drag yet with > > > > > the map but I plan on doing so soon. > > > > > > On Mar 26, 7:25 am, flibustier <[email protected]> wrote: > > > > > > > May be I should use dispatchEvent after drag'n'drop instead of using > > > > > > > private function onRollover_map (event:MapMouseEvent):void { > > > > > > trace(event.latLng.toString()); > > > > > > this.current_latlng=event.latLng; > > > > > > > } > > > > > > > On 25 мар, 18:54, flibustier <[email protected]> wrote: > > > > > > > > Hello > > > > > > > > I'm making application where user can drag image and place it on > > > > > > > map > > > > > > > and I met such problem. > > > > > > > I'm catching current_latlng using such code: > > > > > > > > private var current_latlng :LatLng; > > > > > > > this.map.addEventListener(MapMouseEvent.MOUSE_MOVE,onRollover_map); > > > > > > > > private function onRollover_map (event:MapMouseEvent):void { > > > > > > > trace(event.latLng.toString()); > > > > > > > this.current_latlng=event.latLng; > > > > > > > > } > > > > > > > > It works fine and debugger shows me current LatLng, but when I'm > > > > > > > dragging Image over over map debugger shows me LatLng only when I > > > > > > > move > > > > > > > Image quickly and when I'm moving Image pixel by pixel LatLng > > > > > > > stops > > > > > > > refreshing. > > > > > > > But when I'm dragging a created marker over map refresh goes fine. > > > > > > > So, with this problem I can't position new marker on map > > > > > > > correctly. > > > > > > > > That is code for "drag and drop": > > > > > > > > private function onDrag_icon (event:MouseEvent) : void { > > > > > > > var img:Image = event.currentTarget as Image; > > > > > > > var dragImg:Image = new Image(); > > > > > > > dragImg.source = img.source; > > > > > > > var dsource:DragSource = new DragSource(); > > > > > > > dsource.addData(img, 'img'); > > > > > > > DragManager.doDrag(img, dsource , event, dragImg); > > > > > > > > } > > > > > > > > private function dragAccept (event:DragEvent):void > > > > > > > { > > > > > > > var dropTarget:Map = event.currentTarget as > > > > > > > com.google.maps.Map; > > > > > > > DragManager.acceptDragDrop(dropTarget); > > > > > > > } > > > > > > > > private function onDragEnd (event:DragEvent):void { > > > > > > > this.markerHouse.icon=this.cloneIcon(this.iconBMP); > > > > > > > this.map.addOverlay(new Marker (current_latlng, > > > > > > > this.markerHouse)); > > > > > > > > } > > > > > > > > PS: Sorry for my English. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Maps API For Flash" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-maps-api-for-flash?hl=en -~----------~----~----~----~------~----~------~--~---
