Skip to content

Content

Crutiatix edited this page Apr 29, 2017 · 10 revisions

Table containing attributes defining a attributes of content drawn inside of element.

Content

You can draw inside an element by setting its content, using element:Content(). It only takes a function as a parameter, which will be given the ref, x and y attributes. It's needed to add atributes x and y to position of any element which is drawn in content for make it move together with main element when is dragged.

Scrolling

Scrolling is set in the content atribute using scroll atribute. You can later set the scroll for a specific axis manually using element:scroll({ x, y }) and retrieve scroll using element:scroll()

  • Attribute of:

  • Attributes:

    • w = [number] (element.w) - virtual width of content. Important when scrolling.
    • h = [number] (element.h) - virtual width of content. Important when scrolling.
    • wrap = [bool] (false) - if true then clip content by borders of element
    • scroll = [table] ({x=0,y=0})- define initial scroll of content
      • x = [number] (0) - Number 0 - 1 defining content scroll. 0 is at left, 1 at right.
      • y = [number] (0) - Number 0 - 1 defining content scroll. 0 is at top, 1 at bottom.
  • Methods:

    • element:Content
      • arguments:
        • [function] - function containing drawing something
          • arguments:
            • [object] - a reference to element
            • [number] = x position of element's content (+border)
            • [number] = y position of element's content (+border)
    • element:scroll
      • arguments:
        • [table]
          • x = [number] - Number 0 - 1 defining content scroll. 0 is at left, 1 at right.
          • y = [number] - Number 0 - 1 defining content scroll. 0 is at top, 1 at bottom.
      • return (if no arguments):
        • [table]
          • x = [number] - Number 0 - 1 defining content scroll. 0 is at left, 1 at right.
          • y = [number] - Number 0 - 1 defining content scroll. 0 is at top, 1 at bottom.

Modifications:

  • v0.7.0
    • renamed setContent to Content
    • removed * setContentDimensions*
    • merged setScroll and getScroll to scroll
Clone this wiki locally