Shrink config node appearance in info table

This commit is contained in:
Nick O'Leary 2017-04-10 14:33:21 +01:00
parent aefae79186
commit 1c11e7f97b
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
2 changed files with 31 additions and 8 deletions

View File

@ -163,17 +163,21 @@ RED.sidebar.info = (function() {
RED.utils.createObjectElement(undefined).appendTo(propRow.children()[1]);
} else {
var configLabel = RED.utils.getNodeLabel(configNode,val);
var nodeContainer = $('<span></span>').appendTo(propRow.children()[1]);
var entry = $('<span class="palette_node config_node"></span>')
.css({marginLeft:"5px",width:"calc(100% - 20px)"}).appendTo(nodeContainer);
$('<div class="palette_label"></div>').text(configLabel).appendTo(entry);
var icon_url = RED.utils.getNodeIcon(node._def);
var iconContainer = $('<div/>',{class:"palette_icon_container"}).appendTo(entry);
$('<div/>',{class:"palette_icon",style:"background-image: url("+icon_url+")"}).appendTo(iconContainer);
var container = propRow.children()[1];
entry.dblclick(function(e) {
var div = $('<span>',{class:""}).appendTo(container);
var nodeDiv = $('<div>',{class:"palette_node palette_node_small"}).appendTo(div);
var colour = configNode._def.color;
var icon_url = RED.utils.getNodeIcon(configNode._def);
nodeDiv.css({'backgroundColor':colour, "cursor":"pointer"});
var iconContainer = $('<div/>',{class:"palette_icon_container"}).appendTo(nodeDiv);
$('<div/>',{class:"palette_icon",style:"background-image: url("+icon_url+")"}).appendTo(iconContainer);
var nodeContainer = $('<span></span>').css({"verticalAlign":"top","marginLeft":"6px"}).html(configLabel).appendTo(container);
nodeDiv.on('dblclick',function() {
RED.editor.editConfig("", configNode.type, configNode.id);
})
}
} else {
RED.utils.createObjectElement(val).appendTo(propRow.children()[1]);

View File

@ -187,3 +187,22 @@
background-size: contain;
background-repeat: no-repeat;
}
.palette_node_small {
display: inline-block;
position: relative;
width: 18px;
height: 15px;
margin: 3px 0px;
vertical-align: middle;
cursor: default;
.palette_icon_container {
width: 18px;
border-right: none;
}
.palette_icon {
margin-left: -1px;
width: 15px;
}
}