ui.Map.onClick
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
פונקציה שרושמת קריאה חוזרת (callback) שמופעלת כשלוחצים על המפה.
מחזירה מזהה שאפשר להעביר אל unlisten() כדי לבטל את הרישום של הקריאה החוזרת.
שימוש | החזרות |
---|
Map.onClick(callback) | מחרוזת |
ארגומנט | סוג | פרטים |
---|
זה: ui.map | ui.Map | המופע ui.Map. |
callback | פונקציה | הקריאה החוזרת שמופעלת כשלוחצים על המפה. הפונקציה להחזרת קריאה מקבלת אובייקט שמכיל את הקואורדינטות של הנקודה שהמשתמש לחץ עליה במפה (עם המפתחות lon ו-lat) ואת הווידג'ט של המפה עצמו. |
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-26 (שעון UTC).
[null,null,["עדכון אחרון: 2025-07-26 (שעון UTC)."],[[["\u003cp\u003eRegisters a callback function that is triggered when the map is clicked, providing the coordinates of the clicked point.\u003c/p\u003e\n"],["\u003cp\u003eReturns a unique ID that can be used to unregister the callback function using the \u003ccode\u003eunlisten()\u003c/code\u003e method.\u003c/p\u003e\n"],["\u003cp\u003eThe callback function receives an object containing the longitude (\u003ccode\u003elon\u003c/code\u003e), latitude (\u003ccode\u003elat\u003c/code\u003e) of the clicked point, and the map widget instance.\u003c/p\u003e\n"]]],[],null,["# ui.Map.onClick\n\n\u003cbr /\u003e\n\nRegisters a callback that's fired when the map is clicked.\n\n\u003cbr /\u003e\n\nReturns an ID which can be passed to unlisten() to unregister the callback.\n\n| Usage | Returns |\n|-------------------------|---------|\n| Map.onClick`(callback)` | String |\n\n| Argument | Type | Details |\n|----------------|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| this: `ui.map` | ui.Map | The ui.Map instance. |\n| `callback` | Function | The callback to fire when the map is clicked. The callback is passed an object containing the coordinates of the clicked point on the map (with keys lon and lat) and the map widget itself. |"]]