Made certain layer panel menu items be disabled when appropriate

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1673 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Alexis Deveria 2010-08-19 20:07:18 +00:00
parent 8345aa43d1
commit 996336777b
1 changed files with 6 additions and 1 deletions

View File

@ -3353,6 +3353,9 @@
selLayerNames.empty();
var currentlayer = svgCanvas.getCurrentLayer();
var layer = svgCanvas.getNumLayers();
layer_menu[(layer == 1?'dis':'en') + 'ableContextMenuItems']('#delete,#merge_down,#merge_all');
var icon = $.getSvgIcon('eye');
// we get the layers in the reverse z-order (the layer rendered on top is listed first)
while (layer--) {
@ -3385,6 +3388,8 @@
var row = $(this.parentNode);
row.addClass("layersel");
svgCanvas.setCurrentLayer(this.textContent);
var isLast = $('#layerlist tr.layer').length-1 == row.index();
layer_menu[(isLast?'dis':'en') + 'ableContextMenuItems']('#merge_down');
evt.preventDefault();
})
.mouseover(function(evt){
@ -3409,7 +3414,7 @@
});
// if there were too few rows, let's add a few to make it not so lonely
var num = 5 - $('#layerlist tr.layer').size();
var num = 5 - $('#layerlist tr.layer').length;
while (num-- > 0) {
// FIXME: there must a better way to do this
layerlist.append("<tr><td style=\"color:white\">_</td><td/></tr>");