FLUID-6172: Add a model transformation for rounding to a decimal value

Metadata

Source
FLUID-6172
Type
Improvement
Priority
Major
Status
Closed
Resolution
Fixed
Assignee
Justin Obara
Reporter
Justin Obara
Created
2017-07-25T09:33:11.798-0400
Updated
2017-07-31T10:32:33.976-0400
Versions
N/A
Fixed Versions
  1. 3.0
Component
  1. Model Transformation System

Description

Currently there is only a rounding transformation to round to the nearest integer. However, there may be cases where you'd want to round to some decimal value. For example, in GPII the common terms value for font size is in pts. In the UIO+ browser extension we want a magnification factor. The obvious solution here is to divide by the default size setting ( 12pt in this case ), but that may result in a number like 1.333333333333, which could be handled as 1.3 instead.

The fluid.transforms.round transformation should be modified to handle transforms to optionally handle transforms to a give decimal based on the scale. Similar to how the fluid.transforms.numberToString transformation works.

See: https://botbot.me/freenode/fluid-work/2017-07-25/?msg=89018961&page=1

Comments