ui.Map.DrawingTools.onLayerSelect
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
یک تماس برگشتی را ثبت می کند که هنگام انتخاب یک لایه فعال می شود.
شناسهای را برمیگرداند که میتوان آن را به unlisten() برای لغو ثبت تماس برگشت داد.
استفاده | برمی گرداند | DrawingTools. onLayerSelect (callback) | رشته |
استدلال | تایپ کنید | جزئیات | این: ui.map.drawingtools | ui.Map.DrawingTools | نمونه ui.Map.DrawingTools. |
callback | تابع | هنگامی که یک شکل انتخاب می شود، تماس پاسخ داده می شود. به فراخوانی دو پارامتر ارسال می شود: GeometryLayer انتخاب شده (یا تهی برای عدم انتخاب) و ویجت ui.Map.DrawingTools که شنونده رویداد به آن محدود شده است. |
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eRegisters a callback function that is executed when a layer is selected within the DrawingTools.\u003c/p\u003e\n"],["\u003cp\u003eProvides a method, \u003ccode\u003eonLayerSelect\u003c/code\u003e, to register the callback, accepting the callback function as an argument and returning a unique ID.\u003c/p\u003e\n"],["\u003cp\u003eThe callback function receives the selected GeometryLayer (or null if deselected) and the DrawingTools widget as parameters.\u003c/p\u003e\n"],["\u003cp\u003eThe returned ID can be utilized with the \u003ccode\u003eunlisten()\u003c/code\u003e method to unregister the callback when it's no longer needed.\u003c/p\u003e\n"]]],["A callback function is registered to be executed upon layer selection. The `onLayerSelect` method takes a callback as an argument, which receives the selected `GeometryLayer` (or null if deselected) and the `ui.Map.DrawingTools` instance. This method returns a unique string ID, enabling the callback to be unregistered later via the `unlisten()` method. The method's `ui.Map.DrawingTools` instance is implicitly bound to this.\n"],null,["# ui.Map.DrawingTools.onLayerSelect\n\n\u003cbr /\u003e\n\nRegisters a callback that's fired when a layer is selected.\n\n\u003cbr /\u003e\n\nReturns an ID which can be passed to unlisten() to unregister the callback.\n\n| Usage | Returns |\n|----------------------------------------|---------|\n| DrawingTools.onLayerSelect`(callback)` | String |\n\n| Argument | Type | Details |\n|-----------------------------|---------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| this: `ui.map.drawingtools` | ui.Map.DrawingTools | The ui.Map.DrawingTools instance. |\n| `callback` | Function | The callback to fire when a shape is selected. The callback is passed two parameters: the selected GeometryLayer (or null for deselect) and the ui.Map.DrawingTools widget that the event listener is bound to. |"]]