Moving a custom overlay in Google Maps javascript API v3

文章推薦指數: 80 %
投票人數:10人

I found no problem in doing it using Google Maps Markers, but I need a more customized marker so I'm using Google Maps custom overlays and I can ... Resultsfromthe2022DeveloperSurveyarehere. Home Public Questions Tags Users Companies Collectives ExploreCollectives Teams StackOverflowforTeams –Startcollaboratingandsharingorganizationalknowledge. CreateafreeTeam WhyTeams? Teams CreatefreeTeam Collectives™onStackOverflow Findcentralized,trustedcontentandcollaboratearoundthetechnologiesyouusemost. Learnmore Teams Q&Aforwork Connectandshareknowledgewithinasinglelocationthatisstructuredandeasytosearch. Learnmore MovingacustomoverlayinGoogleMapsjavascriptAPIv3 AskQuestion Asked 5years,2monthsago Modified 5years,2monthsago Viewed 4ktimes 1 2 I'mdevelopingasmallappusingGoogleMapsjavascriptAPIv3whereIneedtodisplay2markersandupdatetheirpositionsusingajax.IfoundnoproblemindoingitusingGoogleMapsMarkers,butIneedamorecustomizedmarkersoI'musingGoogleMapscustomoverlaysandIcan'tfindthewaytomakethemovementssmooth. Thisisthedesignofthemarkers(thatalsousescssanimations,soIneedcustomhtml): Markersdesign TheproblemIhaveisthatIcan'tfindawaytoactuallymovethecustomoverlayonthemap.WhatI'mdoingnowisremovingtheoverlayandcreatinganewoneeverytimeIhavetomoveit,whatmakesalittleblinkanddon'tallowmetomakeasmoothtransitionfromonepositiontotheother. Soherearemyquestions: 1-Isusingcustomoverlaysthebestwaytobuildthemarkersaccordingtothedesign?IsthereanywaytomakeGoogleMapsMarkerslooklikethedesign? 2-Ifusingcustomoverlays(https://developers.google.com/maps/documentation/javascript/customoverlays)isthebestoption,isthereanotherwayformovingthemthatisnotremovingandcreatinganewone? Thanksinadvance! javascriptgoogle-mapsgoogle-maps-api-3 Share Follow editedMar31,2017at14:48 JavierGbas askedMar31,2017at10:09 JavierGbasJavierGbas 13611silverbadge1010bronzebadges Addacomment  |  1Answer 1 Sortedby: Resettodefault Highestscore(default) Trending(recentvotescountmore) Datemodified(newestfirst) Datecreated(oldestfirst) 7 Afterstrugglingwiththissometime(itreallytookmeseveralhours)Ihavemanagetodoitgettinginspiredbythisfiddle: https://jsfiddle.net/doktormolle/QRuW8/ Thefunctionalityisnotthesame,butIcouldgetsomeideas. SincethereisnotalotofdocumentationIhavecreatedmyownfiddlewithaworking(andsimplified)example,justincaseisusefulforanyone: https://jsfiddle.net/javigbas/3zx5xa2u/ :) Share Follow answeredMar31,2017at12:42 JavierGbasJavierGbas 13611silverbadge1010bronzebadges 0 Addacomment  |  YourAnswer ThanksforcontributingananswertoStackOverflow!Pleasebesuretoanswerthequestion.Providedetailsandshareyourresearch!Butavoid…Askingforhelp,clarification,orrespondingtootheranswers.Makingstatementsbasedonopinion;backthemupwithreferencesorpersonalexperience.Tolearnmore,seeourtipsonwritinggreatanswers. Draftsaved Draftdiscarded Signuporlogin SignupusingGoogle SignupusingFacebook SignupusingEmailandPassword Submit Postasaguest Name Email Required,butnevershown PostYourAnswer Discard Byclicking“PostYourAnswer”,youagreetoourtermsofservice,privacypolicyandcookiepolicy Nottheansweryou'relookingfor?Browseotherquestionstaggedjavascriptgoogle-mapsgoogle-maps-api-3oraskyourownquestion. TheOverflowBlog ExpertsfromStripeandWaymoexplainhowtocraftgreatdocumentation(Ep.455) Askedandanswered:theresultsforthe2022Developersurveyarehere! FeaturedonMeta AnnouncingthearrivalofValuedAssociate#1214:Dalmarus Testingnewtrafficmanagementtool AskWizardTestResultsandNextSteps Trending:Anewanswersortingoption Related 698 WhattechniquescanbeusedtodefineaclassinJavaScript,andwhataretheirtrade-offs? 1532 HowdoIfindoutwhichDOMelementhasthefocus? 441 GoogleMapsAPIv3:Howtoremoveallmarkers? 569 HowtodisablemousescrollwheelscalingwithGoogleMapsAPI 706 GoogleMapsJSAPIv3-SimpleMultipleMarkerExample 34 Makecustomoverlayclickable(GoogleMapsAPIv3) 295 GoogleMapsAPI3-Custommarkercolorfordefault(dot)marker 587 Smoothscrollingwhenclickingananchorlink 2 HowtomakeGoogleMaps'customoverlayabovemarker'sclickzone? HotNetworkQuestions Solutionataparticularpoint Isthereanotionof"because"inmathematics? Howdoes/procinteractwithPIDnamespaces? InP.J.Plauger's"TheStandardCLibrary"(1992),whyareforloopsusedsofrequentlyinsteadofwhileloopsintheimplementations? Whatdoes"ifinlocation"contextmeaninNginx? Howtallarethemushrooms? Addingnoisetonon-negativeimputeddata Whywouldaparticularheatpumpmodelbeillegalinmystate? Assemblermadeinassembly Howisenergy"storedinanelectricfield"? Installinga48"vanitybetweentwowallsthatare51"apart.HowcanIcoverthe1.5"gapsonthecabinetmarbletopandthecabinetsides? BestWaytoStyleRidiculouslyLongHair(formagicpurposes) Arechemicalsusedtoripenfruitindevelopingcountriesharmfultothehealthofconsumers? Howfarfrombinary? RouteMapping:Roadchoice Running15ampsthrougha10ampswitchtopowera13ampcircuit? Whycan'tanMCU'sGPIOpinsdirectlycontrolpowerMOSFETs? Canaclericofthegrave'sgodbeSarenrae? Thelongestpathofedgesona3x3grid Whyusedecltypeonatemplateargument? PartofapolygonthatisclosertopointAthanpointB StartupDiskCreatordoesnotexist Animatingasolarsystem:'childof'constraintresetsafter180°rotationwheninfluenceislowerthan1 Whataresomepossiblereasonsthataheatingoilrepwouldbeanticipatingoilpricesfalling? morehotquestions Questionfeed SubscribetoRSS Questionfeed TosubscribetothisRSSfeed,copyandpastethisURLintoyourRSSreader. lang-js Yourprivacy Byclicking“Acceptallcookies”,youagreeStackExchangecanstorecookiesonyourdeviceanddiscloseinformationinaccordancewithourCookiePolicy. Acceptallcookies Customizesettings  



請為這篇文章評分?