1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
/*********************************************************
* Textback Class
********************************************************/
Textback.prototype = new DynamicComponent();
Textback.parent = DynamicComponent.prototype;
Textback.prototype.constructor = Textback;
/*********************************************************
* Constructor
*********************************************************/
function Textback()
{
}
/*********************************************************
* Initialize object
* svgId -> Id of SVG node
* objectName -> global variable name of the object
*******************************************************/
Textback.prototype.init = function(svgId, objectName)
{
Textback.parent.init.call(this, svgId, objectName, false);
this.m_SizeFont = GetVisioPropAsInt(this.m_SvgNode, "FontSize");
// removeAllChildExceptNodeName(this.m_SvgNode, "text");
this.m_txtParentElem = getChildNodeFromName(this.m_SvgNode, "text");
// get "rect" elem
this.m_rectElem = getChildNodeFromName(this.m_SvgNode, "rect");
removeAllChild(this.m_txtParentElem);
this.m_txtElem = createTextNode(this.m_txtParentElem, "");
}
/********************************************************
* Callback for refresh event
*********************************************************/
Textback.prototype.OnRefresh = function()
{
// Get the value
var value = this.m_arrayValueDefinition[0].getValue();
var coltext = colortext;
var red = Math.round((coltext & 0x000000FF) >> 0);
var green = Math.round((coltext & 0x0000FF00) >> 8);
var blue = Math.round((coltext & 0x00FF0000) >> 16);
var fill = "fill:rgb("+ red +","+ green+","+blue+")";
var size = "font-size:"+this.m_SizeFont;
var fontType = "font-family:Arial Unicode MS"
this.m_txtParentElem.setAttribute("style", fill+";"+size+";"+fontType);
var colback = colorback;
red = Math.round((colback & 0x000000FF) >> 0);
green = Math.round((colback & 0x0000FF00) >> 8);
blue = Math.round((colback & 0x00FF0000) >> 16);
var back = "fill:rgb("+ red +","+ green+","+blue+")";
var colcontour = colorcontour;
red = Math.round((colcontour & 0x000000FF) >> 0);
green = Math.round((colcontour & 0x0000FF00) >> 8);
blue = Math.round((colcontour & 0x00FF0000) >> 16);
var contour = "stroke:rgb("+ red +","+ green+","+blue+")";
this.m_rectElem.setAttribute("style", back+ "; contour");
// Change text value to reflect the read value
var st = value;
this.m_txtElem.nodeValue = st;
} |
Partager