mirror of
https://github.com/nasa/openmct.git
synced 2025-06-14 05:08:15 +00:00
[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:
@ -122,14 +122,6 @@ define([
|
|||||||
"description": "Set border color",
|
"description": "Set border color",
|
||||||
"control": "color"
|
"control": "color"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"property": "color",
|
|
||||||
"cssClass": "icon-T",
|
|
||||||
"title": "Text color",
|
|
||||||
"description": "Set text color",
|
|
||||||
"mandatory": true,
|
|
||||||
"control": "color"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"property": "url",
|
"property": "url",
|
||||||
"cssClass": "icon-image",
|
"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": [
|
"items": [
|
||||||
{
|
{
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
-->
|
-->
|
||||||
<div
|
<div
|
||||||
class="l-fixed-position-text l-telemetry"
|
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
|
<span
|
||||||
class="l-elem l-value l-obj-val-format"
|
class="l-elem l-value l-obj-val-format"
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
-->
|
-->
|
||||||
<div
|
<div
|
||||||
class="l-fixed-position-text l-static-text"
|
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}}
|
{{ngModel.element.text}}
|
||||||
</div>
|
</div>
|
||||||
|
@ -256,7 +256,8 @@ define(
|
|||||||
titled: true,
|
titled: true,
|
||||||
width: DEFAULT_DIMENSIONS[0],
|
width: DEFAULT_DIMENSIONS[0],
|
||||||
height: DEFAULT_DIMENSIONS[1],
|
height: DEFAULT_DIMENSIONS[1],
|
||||||
useGrid: true
|
useGrid: true,
|
||||||
|
size: "14px"
|
||||||
});
|
});
|
||||||
|
|
||||||
//Re-initialize objects, and subscribe to new object
|
//Re-initialize objects, and subscribe to new object
|
||||||
|
@ -42,7 +42,8 @@ define(
|
|||||||
},
|
},
|
||||||
"fixed.text": {
|
"fixed.text": {
|
||||||
fill: "transparent",
|
fill: "transparent",
|
||||||
stroke: "transparent"
|
stroke: "transparent",
|
||||||
|
size: "14px"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
DIALOGS = {
|
DIALOGS = {
|
||||||
|
@ -58,6 +58,15 @@ define(
|
|||||||
*/
|
*/
|
||||||
proxy.text = new AccessorMutator(element, 'text');
|
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;
|
return proxy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,8 @@ define(
|
|||||||
y: 2,
|
y: 2,
|
||||||
width: 42,
|
width: 42,
|
||||||
height: 24,
|
height: 24,
|
||||||
fill: "transparent"
|
fill: "transparent",
|
||||||
|
size: "20px"
|
||||||
};
|
};
|
||||||
testElements = [{}, {}, testElement, {}];
|
testElements = [{}, {}, testElement, {}];
|
||||||
proxy = new TextProxy(
|
proxy = new TextProxy(
|
||||||
@ -50,6 +51,12 @@ define(
|
|||||||
expect(proxy.fill('#FFF')).toEqual('#FFF');
|
expect(proxy.fill('#FFF')).toEqual('#FFF');
|
||||||
expect(proxy.fill()).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');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user