megaplot
megaplot copied to clipboard
Create and export constants for meaningful values
When specifying Sprite attributes, all values are numeric. However, some values have special meaning. Rather than requiring API users to specify numeric values, the Megaplot API should supply an object which names these values.
Example:
export const CONSTANTS = Object.freeze({
// Values for the SpriteView Sides attribute.
SHAPE_CIRCLE: 1,
SHAPE_SQUARE: 2,
SHAPE_TRIANGLE: 3,
SHAPE_DIAMOND: 4,
SHAPE_PENTAGON: 5,
// Values for TextView attributes.
TEXT_ANCHOR_BOTTOM: -1,
TEXT_ANCHOR_MIDDLE: 0,
TEXT_ANCHOR_TOP: 1,
TEXT_ANCHOR_LEFT: -1,
TEXT_ANCHOR_CENTER: 0,
TEXT_ANCHOR_RIGHT: 1,
TEXT_ALIGN_BOTTOM: -1,
TEXT_ALIGN_MIDDLE: 0,
TEXT_ALIGN_TOP: 1,
TEXT_ALIGN_LEFT: -1,
TEXT_ALIGN_CENTER: 0,
TEXT_ALIGN_RIGHT: 1,
});
The TextView values above refer to the proposal in #57.