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 populateLayers = function() {
|
||||||
var layerlist = $('#layerlist tbody');
|
var layerlist = $('#layerlist tbody').empty();
|
||||||
var selLayerNames = $('#selLayerNames');
|
var selLayerNames = $('#selLayerNames').empty();
|
||||||
layerlist.empty();
|
var drawing = svgCanvas.getCurrentDrawing();
|
||||||
selLayerNames.empty();
|
var currentLayerName = drawing.getCurrentLayerName();
|
||||||
var currentLayerName = svgCanvas.getCurrentDrawing().getCurrentLayerName();
|
|
||||||
var layer = svgCanvas.getCurrentDrawing().getNumLayers();
|
var layer = svgCanvas.getCurrentDrawing().getNumLayers();
|
||||||
var icon = $.getSvgIcon('eye');
|
var icon = $.getSvgIcon('eye');
|
||||||
// we get the layers in the reverse z-order (the layer rendered on top is listed first)
|
// we get the layers in the reverse z-order (the layer rendered on top is listed first)
|
||||||
while (layer--) {
|
while (layer--) {
|
||||||
var name = svgCanvas.getCurrentDrawing().getLayerName(layer);
|
var name = drawing.getLayerName(layer);
|
||||||
// contenteditable=\"true\"
|
var layerTr = $('<tr class="layer">').toggleClass('layersel', name === currentLayerName);
|
||||||
var appendstr = "<tr class=\"layer";
|
var layerVis = $('<td class="layervis">').toggleClass('layerinvis', !drawing.getLayerVisibility(name));
|
||||||
if (name == currentLayerName) {
|
var layerName = $('<td class="layername">' + name + '</td>');
|
||||||
appendstr += " layersel";
|
layerlist.append(layerTr.append(layerVis, layerName));
|
||||||
}
|
selLayerNames.append('<option value="' + name + '">' + name + '</option>');
|
||||||
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>");
|
|
||||||
}
|
}
|
||||||
if (icon !== undefined) {
|
if (icon !== undefined) {
|
||||||
var copy = icon.clone();
|
var copy = icon.clone();
|
||||||
|
@ -3707,18 +3697,17 @@
|
||||||
$('#layerlist td.layername')
|
$('#layerlist td.layername')
|
||||||
.mouseup(function(evt) {
|
.mouseup(function(evt) {
|
||||||
$('#layerlist tr.layer').removeClass('layersel');
|
$('#layerlist tr.layer').removeClass('layersel');
|
||||||
var row = $(this.parentNode);
|
$(this.parentNode).addClass('layersel');
|
||||||
row.addClass('layersel');
|
|
||||||
svgCanvas.setCurrentLayer(this.textContent);
|
svgCanvas.setCurrentLayer(this.textContent);
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
})
|
})
|
||||||
.mouseover(function(evt){
|
.mouseover(function() {
|
||||||
toggleHighlightLayer(this.textContent);
|
toggleHighlightLayer(this.textContent);
|
||||||
})
|
})
|
||||||
.mouseout(function(evt){
|
.mouseout(function() {
|
||||||
toggleHighlightLayer();
|
toggleHighlightLayer();
|
||||||
});
|
});
|
||||||
$('#layerlist td.layervis').click(function(evt){
|
$('#layerlist td.layervis').click(function() {
|
||||||
var row = $(this.parentNode).prevAll().length;
|
var row = $(this.parentNode).prevAll().length;
|
||||||
var name = $('#layerlist tr.layer:eq(' + row + ') td.layername').text();
|
var name = $('#layerlist tr.layer:eq(' + row + ') td.layername').text();
|
||||||
var vis = $(this).hasClass('layerinvis');
|
var vis = $(this).hasClass('layerinvis');
|
||||||
|
|
Loading…
Reference in New Issue