reviewsהשקת Places UI Kit: ספריית רכיבים מוכנה לשימוש בעלות נמוכה, שמאפשרת לכם להוסיף לכל מפה שתבחרו את ממשק המשתמש המוכר של 'מקומות' במפות Google. כדאי לנסות אותו ולשלוח לנו משוב כדי לעזור לנו לעצב את העתיד של GMP.
שליטה בהתנהגות במקרה של חפיפה
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
בדף הזה מוסבר איך מגדירים את התנהגות ההתנגשות של סמן.
התנהגות ההתנגשות קובעת איך סמן יוצג אם הוא מתנגש (חופף) עם סמן אחר.
כדי להגדיר את אופן הפעולה במקרה של התנגשות, מגדירים את collisionBehavior
לאחת מהאפשרויות הבאות:
REQUIRED
: הצגת הסמן תמיד, ללא קשר לחפיפה
-
REQUIRED_AND_HIDES_OPTIONAL
: הסמן תמיד יוצג, ללא קשר להתנגשות, וכל סמן OPTIONAL_AND_HIDES_LOWER_PRIORITY
או תווית OPTIONAL_AND_HIDES_LOWER_PRIORITY
שחופפים לסמן יוסתרו.
-
OPTIONAL_AND_HIDES_LOWER_PRIORITY
: הצגת הסמן רק אם הוא לא חופף לסמנים אחרים. אם שני סמנים מהסוג הזה חופפים, הסמן עם הערך הגבוה יותר של zIndex
מוצג. אם יש להם אותו zIndex
, מוצג צילום המסך עם המיקום האנכי הנמוך יותר במסך.
בדוגמה הבאה מוצגת הגדרת התנהגות של התנגשות לסמן:
const marker = new Marker3DElement({
position: {lat, lng},
collisionBehavior: google.maps.CollisionBehavior.REQUIRED
});
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-22 (שעון UTC).
[null,null,["עדכון אחרון: 2025-07-22 (שעון UTC)."],[],[],null,["Select platform: [Android](/maps/documentation/maps-3d/android-sdk/configure-marker-collision-behavior \"View this page for the Android platform docs.\") [iOS](/maps/documentation/maps-3d/ios-sdk/configure-marker-collision-behavior \"View this page for the iOS platform docs.\") [JavaScript](/maps/documentation/javascript/3d/marker-collision \"View this page for the JavaScript platform docs.\")\n\n\u003cbr /\u003e\n\n\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\n\nThis page demonstrates how to set the collision behavior for a marker.\nCollision behavior controls how a marker will display if it collides (overlaps)\nwith another marker.\n\nTo set collision behavior, set `collisionBehavior` to one of the following:\n\n- `REQUIRED`: Always display the marker regardless of collision\n- `REQUIRED_AND_HIDES_OPTIONAL`: Always display the marker regardless of collision, and hide any `OPTIONAL_AND_HIDES_LOWER_PRIORITY` markers or labels that would overlap with the marker.\n- `OPTIONAL_AND_HIDES_LOWER_PRIORITY`: Display the marker only if it does not overlap with other markers. If two markers of this type would overlap, the one with the higher `zIndex` is shown. If they have the same `zIndex`, the one with the lower vertical screen position is shown.\n\nThe following example shows setting collision behavior for a marker: \n\n const marker = new Marker3DElement({\n position: {lat, lng},\n collisionBehavior: google.maps.CollisionBehavior.REQUIRED\n });"]]