ViewSize

ceramic.ViewSize (Abstract)

Type-safe representation of view sizing modes.

ViewSize uses encoded float values to represent different sizing modes:

  • Fixed sizes: Regular positive float values (e.g., 100.0 = 100 pixels)
  • Percentage: Encoded values between -60000 and -40000
  • Fill: Special value around -60002
  • Auto: Special value around -60001

This encoding allows ViewSize to be used directly as a Float while maintaining type safety and avoiding object allocations.

// Fixed size
view.viewWidth = 200; // 200 pixels

// Percentage
view.viewWidth = ViewSize.percent(50); // 50% of parent

// Fill available space
view.viewWidth = ViewSize.fill();

// Size based on content
view.viewHeight = ViewSize.auto();
See: View For usage in the layout system

Type Conversions

From:

  • [Float](/api-docs/clay-native/Float/)

To:

  • [Float](/api-docs/clay-native/Float/)