[Fixed Position] Text size control for text and telemetry objects

Add a select control for text and telemetry objects to allow setting text size. Set the default size to 13px.

Fixes # 1496
This commit is contained in:
Pegah Sarram 2017-09-08 17:06:38 -07:00
parent 469820fb0f
commit bb47feb517
7 changed files with 99 additions and 13 deletions

View File

@ -122,14 +122,6 @@ define([
"description": "Set border color",
"control": "color"
},
{
"property": "color",
"cssClass": "icon-T",
"title": "Text color",
"description": "Set text color",
"mandatory": true,
"control": "color"
},
{
"property": "url",
"cssClass": "icon-image",
@ -145,6 +137,82 @@ define([
}
]
},
{
"items": [
{
"property": "color",
"cssClass": "icon-T",
"title": "Text color",
"description": "Set text color",
"mandatory": true,
"control": "color"
},
{
"property": "size",
"title": "Text size",
"description": "Set text size",
"control": "select",
"options": [
{
"value": "8px",
"name": "8 px"
},
{
"value": "9px",
"name": "9 px"
},
{
"value": "10px",
"name": "10 px"
},
{
"value": "11px",
"name": "11 px"
},
{
"value": "12px",
"name": "12 px"
},
{
"value": "14px",
"name": "14 px"
},
{
"value": "16px",
"name": "16 px"
},
{
"value": "20px",
"name": "20 px"
},
{
"value": "24px",
"name": "24 px"
},
{
"value": "30px",
"name": "30 px"
},
{
"value": "36px",
"name": "36 px"
},
{
"value": "48px",
"name": "48 px"
},
{
"value": "72px",
"name": "72 px"
},
{
"value": "96px",
"name": "96 px"
}
]
}
]
},
{
"items": [
{

View File

@ -21,7 +21,7 @@
-->
<div
class="l-fixed-position-text l-telemetry"
ng-style="{ background: ngModel.fill(), 'border-color': ngModel.stroke(), color: ngModel.color() }"
ng-style="{ background: ngModel.fill(), 'border-color': ngModel.stroke(), color: ngModel.color(), 'font-size': ngModel.size() }"
>
<span
class="l-elem l-value l-obj-val-format"

View File

@ -21,7 +21,7 @@
-->
<div
class="l-fixed-position-text l-static-text"
ng-style="{ background: ngModel.fill(), 'border-color': ngModel.stroke(), color: ngModel.color() }"
ng-style="{ background: ngModel.fill(), 'border-color': ngModel.stroke(), color: ngModel.color(), 'font-size': ngModel.size() }"
>
{{ngModel.element.text}}
</div>

View File

@ -256,7 +256,8 @@ define(
titled: true,
width: DEFAULT_DIMENSIONS[0],
height: DEFAULT_DIMENSIONS[1],
useGrid: true
useGrid: true,
size: "14px"
});
//Re-initialize objects, and subscribe to new object

View File

@ -42,7 +42,8 @@ define(
},
"fixed.text": {
fill: "transparent",
stroke: "transparent"
stroke: "transparent",
size: "14px"
}
},
DIALOGS = {

View File

@ -58,6 +58,15 @@ define(
*/
proxy.text = new AccessorMutator(element, 'text');
/**
* Get and/or set the text size of this element.
*
* @param {string} [size] the new text size (if setting)
* @returns {string} the text size
* @memberof platform/features/layout.TextProxy#
*/
proxy.size = new AccessorMutator(element, 'size');
return proxy;
}

View File

@ -35,7 +35,8 @@ define(
y: 2,
width: 42,
height: 24,
fill: "transparent"
fill: "transparent",
size: "20px"
};
testElements = [{}, {}, testElement, {}];
proxy = new TextProxy(
@ -50,6 +51,12 @@ define(
expect(proxy.fill('#FFF')).toEqual('#FFF');
expect(proxy.fill()).toEqual('#FFF');
});
it("provides getter/setter for text size", function () {
expect(proxy.size()).toEqual('20px');
expect(proxy.size('12px')).toEqual('12px');
expect(proxy.size()).toEqual('12px');
});
});
}
);