با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
این صفحه رویدادهای رابط کاربری و رخدادهای خطا را توصیف میکند که میتوانید به آنها گوش دهید و به صورت برنامهریزی مدیریت کنید.
رویدادهای رابط کاربری
این بخش به تشریح رویدادهای تعاملی و اعلانهای تغییر حالت میپردازد که میتوانید هنگام کار با نقشههای سهبعدی به آنها گوش دهید و به صورت برنامهنویسی به آنها رسیدگی کنید. جاوا اسکریپت در مرورگر رویداد محور است، به این معنی که با ایجاد رویدادهایی که برنامه شما می تواند به آنها گوش دهد و کد را اجرا کند، به تعاملات کاربر پاسخ می دهد.
دو نوع اصلی رویداد وجود دارد:
رویدادهای تعامل کاربر (مانند کلیک های ماوس) از نمای نقشه سه بعدی به کد شما منتشر می شوند. این رویدادها به شما این امکان را می دهد که به اقدامات مستقیم کاربر در محیط نقشه سه بعدی پاسخ دهید. مشاهده نمونه
اعلانهای تغییر حالت، بهروزرسانیهای مدلهای داده نقشه سهبعدی و وضعیت رندر را با استفاده از یک طرح نامگذاری متداول gmp-propertychange منعکس میکنند.
هر شیء API نگاشت سهبعدی مجموعهای از رویدادهای نامگذاری شده را نشان میدهد که برنامه شما میتواند شنوندگان رویداد را برای آنها ثبت کند و زمانی که آن رویدادها با استفاده از تابع addEventListener() داخلی رخ میدهند، منطق را اجرا کند.
نمونه زیر نشان می دهد که کدام رویدادها هنگام تعامل کاربر با نقشه فعال می شوند:
تاریخ آخرین بهروزرسانی 2025-04-29 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-04-29 بهوقت ساعت هماهنگ جهانی."],[],[],null,["\u003cbr /\u003e\n\n| This product or feature is in Preview (pre-GA). Pre-GA products and features might have limited support, and changes to pre-GA products and features might not be compatible with other pre-GA versions. Pre-GA Offerings are covered by the [Google\n| Maps Platform Service Specific Terms](https://cloud.google.com/maps-platform/terms/maps-service-terms). For more information, see the [launch stage\n| descriptions](/maps/launch-stages).\n\n\u003cbr /\u003e\n\nThis page describes the user interface events and error events that you can\nlisten for and handle programmatically.\n\nUser Interface Events\n\nThis section outlines the interactive events and state change notifications you\ncan listen for and handle programmatically when working with 3D maps. JavaScript\nwithin the browser is event-driven, meaning it responds to user interactions by\ngenerating events that your program can listen to and execute code accordingly.\n\nThere are two main types of events:\n\n- User interaction events (such as mouse clicks) are propagated from the 3D map viewport to your code. These events allow you to respond to direct user actions within the 3D map environment. [View\n sample](/maps/documentation/javascript/examples/3d/polygon-click-event).\n- State change notifications reflect updates to the underlying 3D map data models and rendering state, using a conventional `gmp-propertychange` naming scheme.\n\nEach 3D mapping API object exposes a set of named events that your program can\nregister event listeners for and execute logic when those events occur using the\nbuilt-in `addEventListener()` function.\n\nThe following sample shows which events are triggered as a user interacts with\nthe map:"]]