ScreenObjectEditor

class ScreenObjectEditor(screen: ScreenObject, objects: List<ScreenObject> = emptyList(), val minimumSize: Float = 24.0f)

Hit testing, positioning and proportional resizing for editable direct children of a composition.

screen supplies the composition size through its frame. Supply objects in drawing order (last drawn is frontmost); exclude background video or other objects that should not be edited. Register/unregister objects alongside scene insertion/removal. This editor does not attach, detach, reorder, or own their rendering resources, and does not handle gestures or selection UI.

All input coordinates are composition pixels. Call from one thread, as with direct frame changes. Bounds are taken from the most recent layout until edited, then retained at fractional precision so consecutive input events do not depend on rendering completing between events. Call invalidateBounds after changing an object's layout outside this editor.

Constructors

Link copied to clipboard
constructor(screen: ScreenObject, objects: List<ScreenObject> = emptyList(), minimumSize: Float = 24.0f)

Properties

Link copied to clipboard

Functions

Link copied to clipboard

Whether an object is registered for editing.

Link copied to clipboard
fun fitObjectsToScreen(composition: Size)

Fits positioned and edited objects to the requested composition size.

Link copied to clipboard

Returns a copy of the current editing bounds, or null for an unregistered object.

Link copied to clipboard

Returns the frontmost visible registered object at point, or null outside the composition.

Link copied to clipboard

Discards cached geometry so subsequent operations use the object's next rendered bounds.

Link copied to clipboard
fun moveTo(target: ScreenObject, position: PointF): Boolean

Moves the object's top-left corner, preserving its current size and clamping its position.

Link copied to clipboard
fun register(target: ScreenObject, position: PointF? = null)

Registers an object at the front of the editable drawing order. Optionally centers its requested size at position, clamping its position inside the composition. Auto-sized dimensions retain their automatic layout behavior. Duplicate registrations are ignored.

Link copied to clipboard
fun transform(target: ScreenObject, anchor: PointF, destination: PointF = anchor, scale: Float = 1.0f): Boolean

Scales around anchor while moving that anchor to destination. Use equal points to zoom in place, or a scale of 1 to pan. The aspect ratio is preserved; the smaller dimension is limited by minimumSize and the larger size by the composition. Text font size scales too. Alignment and margins are resolved into a left/top frame. Invalid input returns false.

Link copied to clipboard

Stops editing an object and releases cached geometry without removing it from its scene.