cleaned up populateLayers()
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2467 eee81c28-f429-11dd-99c0-75d572ba1dddmaster
parent
78cb0e48bb
commit
f6dcf51e37
|
@ -3673,30 +3673,20 @@
|
|||
};
|
||||
|
||||
var populateLayers = function() {
|
||||
var layerlist = $('#layerlist tbody');
|
||||
var selLayerNames = $('#selLayerNames');
|
||||
layerlist.empty();
|
||||
selLayerNames.empty();
|
||||
var currentLayerName = svgCanvas.getCurrentDrawing().getCurrentLayerName();
|
||||
var layerlist = $('#layerlist tbody').empty();
|
||||
var selLayerNames = $('#selLayerNames').empty();
|
||||
var drawing = svgCanvas.getCurrentDrawing();
|
||||
var currentLayerName = drawing.getCurrentLayerName();
|
||||
var layer = svgCanvas.getCurrentDrawing().getNumLayers();
|
||||
var icon = $.getSvgIcon('eye');
|
||||
// we get the layers in the reverse z-order (the layer rendered on top is listed first)
|
||||
while (layer--) {
|
||||
var name = svgCanvas.getCurrentDrawing().getLayerName(layer);
|
||||
// contenteditable=\"true\"
|
||||
var appendstr = "<tr class=\"layer";
|
||||
if (name == currentLayerName) {
|
||||
appendstr += " layersel";
|
||||
}
|
||||
appendstr += "\">";
|
||||
|
||||
if (svgCanvas.getCurrentDrawing().getLayerVisibility(name)) {
|
||||
appendstr += "<td class=\"layervis\"/><td class=\"layername\" >" + name + "</td></tr>";
|
||||
} else {
|
||||
appendstr += "<td class=\"layervis layerinvis\"/><td class=\"layername\" >" + name + "</td></tr>";
|
||||
}
|
||||
layerlist.append(appendstr);
|
||||
selLayerNames.append("<option value=\"" + name + "\">" + name + "</option>");
|
||||
var name = drawing.getLayerName(layer);
|
||||
var layerTr = $('<tr class="layer">').toggleClass('layersel', name === currentLayerName);
|
||||
var layerVis = $('<td class="layervis">').toggleClass('layerinvis', !drawing.getLayerVisibility(name));
|
||||
var layerName = $('<td class="layername">' + name + '</td>');
|
||||
layerlist.append(layerTr.append(layerVis, layerName));
|
||||
selLayerNames.append('<option value="' + name + '">' + name + '</option>');
|
||||
}
|
||||
if (icon !== undefined) {
|
||||
var copy = icon.clone();
|
||||
|
@ -3707,18 +3697,17 @@
|
|||
$('#layerlist td.layername')
|
||||
.mouseup(function(evt) {
|
||||
$('#layerlist tr.layer').removeClass('layersel');
|
||||
var row = $(this.parentNode);
|
||||
row.addClass('layersel');
|
||||
$(this.parentNode).addClass('layersel');
|
||||
svgCanvas.setCurrentLayer(this.textContent);
|
||||
evt.preventDefault();
|
||||
})
|
||||
.mouseover(function(evt){
|
||||
.mouseover(function() {
|
||||
toggleHighlightLayer(this.textContent);
|
||||
})
|
||||
.mouseout(function(evt){
|
||||
.mouseout(function() {
|
||||
toggleHighlightLayer();
|
||||
});
|
||||
$('#layerlist td.layervis').click(function(evt){
|
||||
$('#layerlist td.layervis').click(function() {
|
||||
var row = $(this.parentNode).prevAll().length;
|
||||
var name = $('#layerlist tr.layer:eq(' + row + ') td.layername').text();
|
||||
var vis = $(this).hasClass('layerinvis');
|
||||
|
|
Loading…
Reference in New Issue