Mixin: SC.InnerFrame

InnerFrame provides the innerFrameForSize function, which will return a frame for the given size adjusted to fit within the given outer size, according to the align and scale properties.

View's that render images will find this mixin particularly useful for fitting their images.

Defined in: inner_frame.js

Field Summary

Class Methods

Field Detail

SC.InnerFrame.align String

Align the shape within its frame. Possible values:

  • SC.ALIGN_TOP_LEFT
  • SC.ALIGN_TOP
  • SC.ALIGN_TOP_RIGHT
  • SC.ALIGN_LEFT
  • SC.ALIGN_CENTER
  • SC.ALIGN_RIGHT
  • SC.ALIGN_BOTTOM_LEFT
  • SC.ALIGN_BOTTOM
  • SC.ALIGN_BOTTOM_RIGHT
Default value:
SC.ALIGN_CENTER
SC.InnerFrame.scale String

Determines how the shape will scale to fit within its containing space. Possible values:

  • SC.SCALE_NONE
  • SC.FILL
  • SC.BEST_FILL
  • SC.BEST_FIT
  • SC.BEST_FIT_DOWN_ONLY
Default value:
SC.FILL

Class Method Detail

innerFrameForSize(sourceWidth, sourceHeight, destWidth, destHeight)

Returns a frame (x, y, width, height) fitting the source size (sourceWidth & sourceHeight) within the destination size (destWidth & destHeight) according to the align and scale properties. This is essential to positioning child views or elements within parent views or elements in elegant ways.

Parameters:
sourceWidth Number
sourceHeight Number
destWidth Number
destHeight Number
Returns:
Object
the inner frame with properties: {x: value, y: value, width: value, height: value }
Documentation generated by JsDoc Toolkit 2.4.0 on Wed Apr 08 2015 10:02:20 GMT-0600 (CST)