[POO] shape + couleur fond
bonjour,
j'ai créer un bouton, j'ai changer la couleur du texte mais je n'arrive pas à changer la couleur de fond!!!
voici mon code :
Code:
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
|
boutoncolor.prototype.init = function(svgId, objectName)
{
boutoncolor.parent.init.call(this, svgId, objectName, false);
// Retreive boutoncolorOn shape
this.m_shapeboutoncolorOn = getVisiogroup(this.m_SvgNode, "boutoncolorOn");
this.m_shapeboutoncolorOnStyle = this.m_shapeboutoncolorOn.getStyle();
// Retreive boutoncolorOff shape
this.m_shapeboutoncolorOff = getVisiogroup(this.m_SvgNode, "boutoncolorOff");
this.m_shapeboutoncolorOffStyle = this.m_shapeboutoncolorOff.getStyle();
// Retreive BBox of text
this.m_groupElemText = getVisiogroup(this.m_SvgNode, "boutoncolorText");
this.m_bboxElem = getChildNodeFromName(this.m_groupElemText, "rect")
this.m_bbox = this.m_bboxElem.getBBox();
// Retreive focus shape
this.m_shapeFocus = getVisiogroup(this.m_SvgNode, "ShapeFocus");
this.m_shapeFocusStyle = this.m_shapeFocus.getStyle();
this.m_shapeFocusStyle.setProperty("visibility","hidden");
// Add text node
this.m_textElemBase = createChild(this.m_groupElemText, "text");
}
/*********************************************************
* Callback for refresh event
*********************************************************/
boutoncolor.prototype.OnRefresh = function()
{
var value = this.m_arrayValueDefinition[0].getValue();
var coltext = texte_couleur;
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 fontSize;
fontSize = GetVisioPropAsInt(this.m_SvgNode, "boutoncolorSize");
var size = "font-size:" + fontSize;
var baseline = "baseline-shift:0%"
var fontType = "font-family:Arial Unicode MS"
this.m_textElemBase.setAttribute("style", fill + ";" + size + ";" + baseline+ ";" + fontType);
var colback = rect_couleur;
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+")";
this.m_shapeboutoncolorOn.setAttribute("style", back);
} |
je pensé que la couleur de fond se changer pour la shape OK grace à :
Code:
this.m_shapeboutoncolorOn.setAttribute("style", back);
merci