Click or drag to resize

OSATParams, TItemViewsHolderRequestChangeItemSizeAndUpdateLayout Method (Int32, Single, Boolean, Boolean, Boolean)

An item width/height can be changed with this method.

Should NOT be called during ComputeVisibilityForCurrentPosition(Boolean, Boolean), UpdateViewsHolder(TItemViewsHolder), CreateViewsHolder(Int32) or from any critical view-recycling code. Suggestion: call it from MonBehaviour.Update()

Will change the size of the item's RectTransform to requestedSize and will shift the other items accordingly, if needed.

Namespace:  Com.ForbiddenByte.OSA.Core
Assembly:  Assembly-CSharp (in Assembly-CSharp.dll) Version: 0.0.0.0
Syntax
C#
public float RequestChangeItemSizeAndUpdateLayout(
	int itemIndex,
	float requestedSize,
	bool itemEndEdgeStationary = false,
	bool computeVisibility = true,
	bool correctItemPosition = false
)

Parameters

itemIndex
Type: SystemInt32
the index of the item to be resized. It doesn't need to be visible(case in which only the cached size will be updated and, obviously, the visible items will shift accordingly)
requestedSize
Type: SystemSingle
the height or width (depending on scrollview's orientation)
itemEndEdgeStationary (Optional)
Type: SystemBoolean
if to grow to the top/left (less common) instead of down/right (more common)
computeVisibility (Optional)
Type: SystemBoolean
correctItemPosition (Optional)
Type: SystemBoolean
If the item's position might've changed externally, set this to true and OSA will try to guess what's the correct position. Note that if you're externally changing an item's position via ContentSizeFitter and without ScheduleComputeVisibilityTwinPass(Boolean) (for functionalities like expand/collapse variable-sized item), the item's position will be changed depending on its pivot. Example, for a vertical ScrollView, having the pivot set to top-center and passing itemEndEdgeStationary as false will keep the item's top edge fixed. To keep the end edge fixed, do the opposite: pivot to bottom-center and itemEndEdgeStationary true.

Return Value

Type: Single
the resolved size. This can be slightly different than requestedSize if the number of items is huge (>100k))
Version Information

Optimized ScrollView Adapter

Supported in: 4.3
See Also