JTopo自定義透明背景node
var ele = {
"id":"${element.id}",
"type":"${element.type}",
"url":"${element.url}",
"x":parseInt("${element.x}"),
"y":parseInt("${element.y}"),
"width":parseInt("${element.width}"),
"height":parseInt("${element.height}"),
"code":"${element.code}",
"remarks":"${element.remarks}",
"fillColor":"${element.fillColor}",
"zindex":"${element.zindex}",
"assetIds":"${element.assetIds}",
"alarm":"${element.alarm}",
"alpha":"${element.alpha}",
"rotate":"${element.rotate}"};
function addRectNode(ele){
if(null ==ele.remarks || ele.remarks == ""){
ele.remarks = "矩形框";
}
var rectNode = new JTopo.Node(ele.remarks);
rectNode.setImage("", false);
rectNode.setLocation(ele.x, ele.y);
rectNode.setSize(ele.width, ele.height);
if(ele.fillColor =="" || typeof(ele.alpha) == "undefined"){
ele.fillColor = "128,128,128";
}
if(ele.alpha =="" || typeof(ele.alpha) == "undefined"){
ele.alpha = 1;
}
rectNode.alpha = ele.alpha;
if(ele.fillColor !="none"){
rectNode.fillColor = ele.fillColor;//底色
}
rectNode.textPosition = 'Top_Left';//標題顯示位置
//向左偏移 20畫素
rectNode.textOffsetX = 15*ele.remarks.length+15;
//向下偏移 25畫素
rectNode.textOffsetY = 30;
if(ele.zindex =="" || typeof(ele.zindex) == "undefined"){
ele.zindex = 11;
}
rectNode.zIndex = ele.zindex;
if(editStatus!=1){
rectNode.editAble = false;
rectNode.dragable = false;
}
rectNode.font='bold 16px 宋體';
if(ele.fontColor =="" || typeof(ele.fontColor) == "undefined"){
ele.fontColor = '0,0,0';
}
if(ele.borderColor =="" || typeof(ele.borderColor) == "undefined"){
ele.borderColor = '0,0,0';
}
rectNode.fontColor = ele.fontColor;
rectNode.borderWidth = 1; // 邊框的寬度
rectNode.borderColor = ele.borderColor; //邊框顏色
return rectNode;
}
var node = addRectNode(ele);
node.paint = function(a){
this.paintText(a);
this.paintBorder(a);
};
return node;