cleaned up populateLayers()
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2467 eee81c28-f429-11dd-99c0-75d572ba1dddmaster
parent
78cb0e48bb
commit
f6dcf51e37
|
@ -1679,7 +1679,7 @@
|
||||||
svgCanvas.textActions.setInputElem($('#text')[0]);
|
svgCanvas.textActions.setInputElem($('#text')[0]);
|
||||||
|
|
||||||
var str = '<div class="palette_item" data-rgb="none"></div>';
|
var str = '<div class="palette_item" data-rgb="none"></div>';
|
||||||
$.each(palette, function(i,item){
|
$.each(palette, function(i,item) {
|
||||||
str += '<div class="palette_item" style="background-color: ' + item + ';" data-rgb="' + item + '"></div>';
|
str += '<div class="palette_item" style="background-color: ' + item + ';" data-rgb="' + item + '"></div>';
|
||||||
});
|
});
|
||||||
$('#palette').append(str);
|
$('#palette').append(str);
|
||||||
|
@ -2196,7 +2196,7 @@
|
||||||
$('#opacity_dropdown li').show();
|
$('#opacity_dropdown li').show();
|
||||||
$(window).mouseup();
|
$(window).mouseup();
|
||||||
},
|
},
|
||||||
slide: function(evt, ui){
|
slide: function(evt, ui) {
|
||||||
changeOpacity(ui);
|
changeOpacity(ui);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -2217,7 +2217,7 @@
|
||||||
start: function() {
|
start: function() {
|
||||||
slideStart = true;
|
slideStart = true;
|
||||||
},
|
},
|
||||||
slide: function(evt, ui){
|
slide: function(evt, ui) {
|
||||||
changeBlur(ui, null, slideStart);
|
changeBlur(ui, null, slideStart);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -2625,7 +2625,7 @@
|
||||||
$('#wireframe_rules').text(workarea.hasClass('wireframe') ? rule : '');
|
$('#wireframe_rules').text(workarea.hasClass('wireframe') ? rule : '');
|
||||||
};
|
};
|
||||||
|
|
||||||
var showSourceEditor = function(e, forSaving){
|
var showSourceEditor = function(e, forSaving) {
|
||||||
if (editingsource) return;
|
if (editingsource) return;
|
||||||
|
|
||||||
editingsource = true;
|
editingsource = true;
|
||||||
|
@ -3482,7 +3482,7 @@
|
||||||
$(window).mouseup();
|
$(window).mouseup();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#tool_move_top').mousedown(function(evt){
|
$('#tool_move_top').mousedown(function(evt) {
|
||||||
$('#tools_stacking').show();
|
$('#tools_stacking').show();
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
});
|
});
|
||||||
|
@ -3673,52 +3673,41 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
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();
|
||||||
$('td.layervis',layerlist).append(icon.clone());
|
$('td.layervis', layerlist).append(icon.clone());
|
||||||
$.resizeSvgIcons({'td.layervis .svg_icon':14});
|
$.resizeSvgIcons({'td.layervis .svg_icon': 14});
|
||||||
}
|
}
|
||||||
// handle selection of layer
|
// handle selection of layer
|
||||||
$('#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');
|
||||||
|
@ -4060,7 +4049,7 @@
|
||||||
reg_tool = container.find('#' + itool);
|
reg_tool = container.find('#' + itool);
|
||||||
if (pre_tool.length) {
|
if (pre_tool.length) {
|
||||||
tool = pre_tool;
|
tool = pre_tool;
|
||||||
} else if (reg_tool.length){
|
} else if (reg_tool.length) {
|
||||||
tool = reg_tool;
|
tool = reg_tool;
|
||||||
} else {
|
} else {
|
||||||
tool = $('#tool_select');
|
tool = $('#tool_select');
|
||||||
|
@ -4149,7 +4138,7 @@
|
||||||
moveToBottomSelected();
|
moveToBottomSelected();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (svgedit.contextmenu && svgedit.contextmenu.hasCustomHandler(action)){
|
if (svgedit.contextmenu && svgedit.contextmenu.hasCustomHandler(action)) {
|
||||||
svgedit.contextmenu.getCustomHandler(action).call();
|
svgedit.contextmenu.getCustomHandler(action).call();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue