با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
SubspaceModifier شبیه به Compose Modifier برای Composable ها در یک Subspace است. یک SubspaceModifier به شما امکان میدهد تا در فضای سهبعدی، قابلیتهای ترکیبی را دستکاری کنید، به شما کمک میکند موقعیت، چرخش، و اضافه کردن رفتارها به گرههای طرحبندی سهبعدی را انجام دهید.
اصلاحکنندههای fillMaxSize ، fillMaxWidth ، fillMaxHeight ، و fillMaxDepth باعث میشوند که محتوا (تا حدی) محدودههای والد آن را پر کند. استفاده از اصلاحکنندههای پر به محتوای طرحبندی برنامه شما کمک میکند که مستقل از ویژگیهای نمایشگر دستگاه XR باشد.
تعدیل کننده offset ، ترکیب پذیر را در فضای سه بعدی در امتداد محورهای x ، y و z حرکت می دهد. این واحدها باید در dp مشخص شوند. برای تبدیل از متر به dp، از Meter.toDp() استفاده کنید.
rotate
اصلاح کننده rotate ، ترکیب بندی داده شده را در فضا می چرخاند. می توانید جهت و میزان چرخش را به روش های مختلف مشخص کنید:
با استفاده از pitch، yaw و roll، که چرخش را به ترتیب حول محورهای x ، y و z مشخص میکنند.
با استفاده از یک axisAngle که یک Vector3 است که محور چرخش را نشان می دهد و مقدار درجه هایی که باید به دور آن بچرخد،
با استفاده از یک Quaternion که چرخش را نشان می دهد.
تغییر ظاهر ترکیبات
alpha
اصلاح کننده alpha کدورت عنصر و فرزندان آن را تنظیم می کند، جایی که 0f نشان دهنده کاملاً شفاف و 1.0f نشان دهنده کاملاً مات است.
scale
اصلاح کننده scale ، محتویات کامپوزیبل را در امتداد محورهای افقی، عمودی و عمق مقیاس می کند.
رفتارها را به ترکیبپذیرها اضافه کنید
resizable
هنگامی که اصلاح کننده resizable فعال است، کنترل های رابط کاربری قابل کشیدن نشان داده می شوند که به کاربر اجازه می دهد اندازه عنصر را تغییر دهد. این شبیه به استفاده از ResizableComponent در یک Entity است.
movable
هنگامی که تغییر دهنده movable فعال است، کنترلهای رابط کاربری به مؤلفه اضافه میشوند که به کاربر اجازه میدهد عنصر را در فضای سهبعدی جابجا کند. این شبیه به استفاده از MovableComponent در یک Entity است.
یک گره چیدمان movable می تواند به صورت اختیاری انواع صفحاتی را که باید در زمان جابجایی به آن لنگر بیاندازد را مشخص کند. به عنوان مثال، برای ایجاد یک SpatialPanel که به جداول می چسبد:
SpatialPanel(modifier.movable(anchorPlaneSemantics=setOf(PlaneSemantic.TABLE))){// This panel snaps to available planes that are detected as a TABLE.}
ضربه زدن به هواپیما به مجوز android.permission.SCENE_UNDERSTANDING_COARSEزمان اجرا نیاز دارد تا به برنامه شما اعطا شود.
محتوا و نمونه کدها در این صفحه مشمول پروانههای توصیفشده در پروانه محتوا هستند. جاوا و OpenJDK علامتهای تجاری یا علامتهای تجاری ثبتشده Oracle و/یا وابستههای آن هستند.
تاریخ آخرین بهروزرسانی 2025-07-31 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","easyToUnderstand","thumb-up"],["مشکلم را برطرف کرد","solvedMyProblem","thumb-up"],["غیره","otherUp","thumb-up"]],[["اطلاعاتی که نیاز دارم وجود ندارد","missingTheInformationINeed","thumb-down"],["بیشازحد پیچیده/ مراحل بسیار زیاد","tooComplicatedTooManySteps","thumb-down"],["قدیمی","outOfDate","thumb-down"],["مشکل ترجمه","translationIssue","thumb-down"],["مشکل کد / نمونهها","samplesCodeIssue","thumb-down"],["غیره","otherDown","thumb-down"]],["تاریخ آخرین بهروزرسانی 2025-07-31 بهوقت ساعت هماهنگ جهانی."],[],[],null,["# Subspace modifiers\n\nA [`SubspaceModifier`](/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier) is similar to a [Compose modifier](/develop/ui/compose/modifiers) for composables\nin a [`Subspace`](/develop/xr/jetpack-xr-sdk/add-subspace). A `SubspaceModifier` lets you manipulate composables in 3D\nspace, helping you position, rotate, and add behaviors to 3D layout nodes.\n\nLayout\n------\n\nBy default, a `Subspace` is [bounded by the recommended space for viewing an\napp](/develop/xr/jetpack-xr-sdk/add-subspace#subspace-hierarchies). These bounds are used when measuring the layout of your subspace\ncomponents, similar to [bounds in 2D Compose layouts](/develop/ui/compose/layouts/constraints-modifiers).\n\n### Fill bounds\n\nThe modifiers [`fillMaxSize`](/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier#(androidx.xr.compose.subspace.layout.SubspaceModifier).fillMaxSize(kotlin.Float)), [`fillMaxWidth`](/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier#(androidx.xr.compose.subspace.layout.SubspaceModifier).fillMaxWidth(kotlin.Float)), [`fillMaxHeight`](/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier#(androidx.xr.compose.subspace.layout.SubspaceModifier).fillMaxHeight(kotlin.Float)), and\n[`fillMaxDepth`](/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier#(androidx.xr.compose.subspace.layout.SubspaceModifier).fillMaxDepth(kotlin.Float)) make content (partially) fill the bounds of its parent.\nUsing fill modifiers helps your app layout content that's independent of the XR\ndevice's display characteristics.\n\n### Set the size and required size\n\nThe modifiers [`size`](/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier#(androidx.xr.compose.subspace.layout.SubspaceModifier).size(androidx.compose.ui.unit.Dp)), [`width`](/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier#(androidx.xr.compose.subspace.layout.SubspaceModifier).width(androidx.compose.ui.unit.Dp)), [`height`](/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier#(androidx.xr.compose.subspace.layout.SubspaceModifier).height(androidx.compose.ui.unit.Dp)), and [`depth`](/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier#(androidx.xr.compose.subspace.layout.SubspaceModifier).depth(androidx.compose.ui.unit.Dp))\ndeclare the preferred size of the content. To declare the exact size of the\ncontent, use [`requiredSize`](/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier#(androidx.xr.compose.subspace.layout.SubspaceModifier).requiredSize(androidx.compose.ui.unit.Dp)), [`requiredWidth`](/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier#(androidx.xr.compose.subspace.layout.SubspaceModifier).requiredWidth(androidx.compose.ui.unit.Dp)),\n[`requiredHeight`](/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier#(androidx.xr.compose.subspace.layout.SubspaceModifier).requiredHeight(androidx.compose.ui.unit.Dp)), and [`requiredDepth`](/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier#(androidx.xr.compose.subspace.layout.SubspaceModifier).requiredDepth(androidx.compose.ui.unit.Dp)). These units must be specified\nin `dp`; to convert from meters to dp, use [`Meter.toDp()`](/reference/kotlin/androidx/xr/compose/unit/Meter#toDp()).\n\nPosition composables\n--------------------\n\n### `offset`\n\nThe [`offset`](/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier#(androidx.xr.compose.subspace.layout.SubspaceModifier).offset(androidx.compose.ui.unit.Dp,androidx.compose.ui.unit.Dp,androidx.compose.ui.unit.Dp)) modifier moves the composable in 3D space along the `x`, `y`,\nand `z` axes. These units must be specified in `dp`; to convert from meters to\ndp, use [`Meter.toDp()`](/reference/kotlin/androidx/xr/compose/unit/Meter#toDp()).\n\n### `rotate`\n\nThe [`rotate`](/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier#(androidx.xr.compose.subspace.layout.SubspaceModifier).rotate(androidx.xr.runtime.math.Quaternion)) modifier rotates the given composable in space. You can\nspecify the direction and the amount of rotation in different ways:\n\n- Using pitch, yaw, and roll, which specify the rotation around the `x`, `y`, and `z` axes respectively,\n- Using an `axisAngle`, which is a `Vector3` representing the axis of rotation, and the amount of degrees it should be rotated around,\n- Using a `Quaternion` that represents the rotation.\n\nChange the appearance of composables\n------------------------------------\n\n### `alpha`\n\nThe [`alpha`](/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier#(androidx.xr.compose.subspace.layout.SubspaceModifier).alpha(kotlin.Float)) modifier sets the opacity of the element and its children,\nwhere `0f` represents fully transparent and `1.0f` represents completely opaque.\n| **Preview:** Currently, the `alpha` modifier only works on `SpatialPanel`.\n\n### `scale`\n\nThe [`scale`](/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier#(androidx.xr.compose.subspace.layout.SubspaceModifier).scale(kotlin.Float)) modifier scales the contents of the composible along the\nhorizontal, vertical, and depth axes.\n\nAdd behaviors to composables\n----------------------------\n\n### `resizable`\n\nWhen the [`resizable`](/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier#(androidx.xr.compose.subspace.layout.SubspaceModifier).resizable(kotlin.Boolean,androidx.xr.compose.unit.DpVolumeSize,androidx.xr.compose.unit.DpVolumeSize,kotlin.Boolean,kotlin.Function1)) modifier is enabled, draggable UI controls will be\nshown that allow the user to resize the element. This is similar to using\n[`ResizableComponent`](/reference/kotlin/androidx/xr/scenecore/ResizableComponent) on an `Entity`.\n\n\nYour browser doesn't support HTML video. Here is a\n[link to the video](/static/develop/xr/jetpack-xr-sdk/videos/resizablecomponent.mp4) instead.\n| **Preview:** Currently, the `resizable` modifier only works on `SpatialPanel`.\n\n### `movable`\n\nWhen the [`movable`](/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier#(androidx.xr.compose.subspace.layout.SubspaceModifier).movable(kotlin.Boolean,kotlin.Boolean,kotlin.Boolean,kotlin.Function1,kotlin.Function1,kotlin.Function1)) modifier is enabled, UI controls will be added to the\ncomponent which allow the user to move the element in 3D space. This is similar\nto using [`MovableComponent`](/reference/kotlin/androidx/xr/scenecore/MovableComponent) on an `Entity`.\n\n\nYour browser doesn't support HTML video. Here is a\n[link to the video](/static/develop/xr/jetpack-xr-sdk/videos/movablecomponent.mp4) instead.\n\nA `movable` layout node can optionally specify types of planes it should anchor\nto when it is moved. For example, to create a `SpatialPanel` that snaps to\ntables: \n\n SpatialPanel(\n modifier.movable(anchorPlaneSemantics = setOf(PlaneSemantic.TABLE))\n ) {\n // This panel snaps to available planes that are detected as a TABLE.\n }\n\nSnapping to planes requires the `android.permission.SCENE_UNDERSTANDING_COARSE`\n[runtime permission](/training/permissions/requesting) to be granted to your app.\n| **Preview:** Currently, the `movable` modifier only works on `SpatialPanel`.\n\nTesting and accessibility\n-------------------------\n\n### `semantics`\n\nThe [`semantics`](/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier#(androidx.xr.compose.subspace.layout.SubspaceModifier).semantics(kotlin.Function1)) modifier adds semantics to the layout node, for use in\ntesting and accessibility. See [Semantics in Jetpack Compose](/develop/ui/compose/accessibility/semantics) and\n[`SemanticsModifier`](/reference/kotlin/androidx/compose/ui/semantics/SemanticsModifier).\n\n### `testTag`\n\nThe [`testTag`](/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier#(androidx.xr.compose.subspace.layout.SubspaceModifier).testTag(kotlin.String)) modifier is a shorthand for\n[`SemanticsPropertyReceiver.testTag`](/reference/kotlin/androidx/compose/ui/semantics/SemanticsPropertyReceiver#(androidx.compose.ui.semantics.SemanticsPropertyReceiver).testTag()), which allows test frameworks to find\nthe element in tests."]]