The Face Object Field - Facets

From DocBase

Jump to: navigation, search

Facets

Style/facets is an object that provides the main attributes of a style. These attributes are commonly used in the DRAW block that renders the face.

For example, a panel style may set these facets:

   facets: [
       area-color: gold
       edge-color: coal
       margin: 10x10
       spacer: 5x5
       columns: 1
   ]

and a BUTTON style may specify:

   facets: [
       area-color: 60.70.150
       edge-color: 96.96.96
       text-body: "Button"
       text-style: 'button
   ]

Note that because facet fields are used in DRAW blocks, it is a good idea to make their names clear (and distinct) from draw commands. In addition it is suggested that you reuse the same field names for similar concepts between styles (although that is not an enforced requirement, just good coding practice).

If a style is derived from a parent style, the parent facets are cloned so they do not need to be respecified.

The style/facets are used for all face instances of the style, unless the style redefines (overloads) one or more of them (see the style/faced field below).


Face/facets is an object that holds attributes and properties that are unique to the face as an instance of a style.

This object is optimized to hold only those values that are different from the style itself, or that change based on changes in the state of the object (such as when over or selected).

Example, a button would have these face facets:

 area-size: ; set by resize
 pen-color: ; set by on-draw
 area-fill: ; set by on-draw

The face/facets field is merged with the style/facets field during the processing of the DRAW dialect. The face/facets always take precedence over the style/facets.

Personal tools