concord-consortium/lab — pull request #44 by pjanik (2013-09-27 10:34:50+00:00)
Title: Textbox fix

This should fix the problem of text boxes that scale together with the interactive container. Now text boxes use model units ('nm') to specify font size. They are converted from MML too.

There is 'fontSize' property instead of 'fontScale'. Note that definition in 'nm' isn't so bad: Classic MW has constant nm to px ratio equal to 1:100. So, in most cases reasonable font sizes are about 0.12 - 0.15nm (12px - 15px divided by 100).

I had to do only a few changes in interactive JSONs. I've tested all curricular interactives and I hope they look good (sometimes slightly different).

I had to do one unrelated improvement to make this work easier: now it's possible to overwrite only a few properties of an object in Interactive JSON. Authors are no longer forced to copy all original properties from model JSON.

So, when author wants to tweak only "x", "y" properties of text box, it's enough to define only them in Interactive JSON:
```
"viewOptions": {
"textBoxes": [
{
"x": 2,
"y": 2
}
]
```
instead of copying all original properties just to tweak one or two:
```
"viewOptions": {
"controlButtons": "play_reset",
"textBoxes": [
{
"text": "Separated oil and water",
"x": 2,
"y": 2,
"fontScale": 1.3,
"layer": 1,
"frame": "rounded rectangle",
"backgroundColor": "rgb(245,245,245)"
}
]
```
or using ```.setTextBoxProperties()``` in onLoad script.

This let me leave all overwritten text box properties in Interactive JSON and they still read automatically converted "fontSize" from model JSON.

If you want to overwrite position of the third text box, you can use empty objects in array:
```
"viewOptions": {
"textBoxes": [
{
},
{
},
{
"x": 2,
"y": 2
}
]
```