Home Reference Source
import ConstrainedFloat from './gui/data-items/ConstrainedFloat.jsx'
public class | source

ConstrainedFloat

Extends:

gui/data-items/SimpleFloat.js~SimpleFloat → ConstrainedFloat

The purpose of ConstrainedFloat is to store a precise numerical value, which conforms to a number of acceptable validation rules. The value will be confined between a minimum and a maximum. The value will be truncated (not rounded) to the allowed precision of digits past the decimal. It has an acceptable incrementing step property to use for driving UI controls so it's easier to modify the value within the expected precision. The default value is 0.0.

Constructor Summary

Public Constructor
public

constructor(dataName: string, dataItemProps: object)

Constructor

Member Summary

Public Members
public

Function that returns the current allowed precision of the data item.

public

Function that returns the current maximum allowable value for the data item.

public

Function that returns the current minimum allowable value for the data item.

public

Function that returns the current default increment and decrement step of the value for the data item.

public

Function that changes the current allowed precision of the data item.

public

setMax(val: number): *

Function that changes the current maximum allowable value for the data item.

public

setMin(val: number): *

Function that changes the current minimum allowable value for the data item.

public

setStep(val: number): *

Function that changes the current default increment and decrement step of the value for the data item.

Public Constructors

public constructor(dataName: string, dataItemProps: object) source

Constructor

Params:

NameTypeAttributeDescription
dataName string

The name of the data item.

dataItemProps object
  • optional

An object of properties such as hidden, disabled, suppressed etc.

dataItemProps.min number
  • optional
  • default: -9007199254740991

The minimum allowable value for the data item.

dataItemProps.max number
  • optional
  • default: 9007199254740991

The maximum allowable value for the data item.

dataItemProps.step number
  • optional
  • default: 1

The value to increment or decrement by for driving UI controls bound to this data item.

dataItemProps.allowedPrecision number
  • optional
  • default: 0

The number of digits allowed on the right side of the decimal point.

Public Members

public getAllowedPrecision: number: * source

Function that returns the current allowed precision of the data item. Allowed precision dictates the number of digits allowed on the right side of the decimal point for the value of this data item. The value will be truncated (not rounded) to this number of digits of precision.

Return:

number

public getMax: number: * source

Function that returns the current maximum allowable value for the data item.

Return:

number

public getMin: number: * source

Function that returns the current minimum allowable value for the data item.

Return:

number

public getStep: number: * source

Function that returns the current default increment and decrement step of the value for the data item.

Return:

number

public setAllowedPrecision(val: number): * source

Function that changes the current allowed precision of the data item. Allowed precision dictates the number of digits allowed on the right side of the decimal point for the value of this data item. The value will be truncated (not rounded) to this number of digits of precision.

public setMax(val: number): * source

Function that changes the current maximum allowable value for the data item.

public setMin(val: number): * source

Function that changes the current minimum allowable value for the data item.

public setStep(val: number): * source

Function that changes the current default increment and decrement step of the value for the data item.