Fix Issue 412: Press 'A' to select all elements in the current layer

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1312 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Jeff Schiller 2010-01-31 20:17:50 +00:00
parent 3e94e85e31
commit 31ec4fec91
2 changed files with 19 additions and 6 deletions

View File

@ -1275,12 +1275,12 @@ function svg_edit_setup() {
var selectNext = function() { var selectNext = function() {
svgCanvas.cycleElement(1); svgCanvas.cycleElement(1);
} };
var selectPrev = function() { var selectPrev = function() {
svgCanvas.cycleElement(0); svgCanvas.cycleElement(0);
} };
var rotateSelected = function(cw) { var rotateSelected = function(cw) {
if (selectedElement == null || multiselected) return; if (selectedElement == null || multiselected) return;
var step = 5; var step = 5;
@ -1288,7 +1288,7 @@ function svg_edit_setup() {
var new_angle = $('#angle').val()*1 + step; var new_angle = $('#angle').val()*1 + step;
svgCanvas.setRotationAngle(new_angle); svgCanvas.setRotationAngle(new_angle);
updateContextPanel(); updateContextPanel();
} };
var clickClear = function(){ var clickClear = function(){
$.confirm(uiStrings.QwantToClear, function(ok) { $.confirm(uiStrings.QwantToClear, function(ok) {
@ -2330,7 +2330,8 @@ function svg_edit_setup() {
{key: ['up', true], fn: function(){moveSelected(0,-1);}}, {key: ['up', true], fn: function(){moveSelected(0,-1);}},
{key: ['down', true], fn: function(){moveSelected(0,1);}}, {key: ['down', true], fn: function(){moveSelected(0,1);}},
{key: ['left', true], fn: function(){moveSelected(-1,0);}}, {key: ['left', true], fn: function(){moveSelected(-1,0);}},
{key: ['right', true], fn: function(){moveSelected(1,0);}} {key: ['right', true], fn: function(){moveSelected(1,0);}},
{key: 'A', fn: function(){svgCanvas.selectAllInCurrentLayer();}}
]; ];
// Tooltips not directly associated with a single function // Tooltips not directly associated with a single function

View File

@ -2217,7 +2217,7 @@ function BatchCommand(text) {
while (i--) { while (i--) {
var elem = elemsToAdd[i]; var elem = elemsToAdd[i];
// we ignore any selectors // we ignore any selectors
if (!elem || elem.id.substr(0,13) == "selectorGrip_") continue; if (!elem || elem.id.substr(0,13) == "selectorGrip_" || !this.getBBox(elem)) continue;
// if it's not already there, add it // if it's not already there, add it
if (selectedElements.indexOf(elem) == -1) { if (selectedElements.indexOf(elem) == -1) {
selectedElements[j] = elem; selectedElements[j] = elem;
@ -5656,6 +5656,18 @@ function BatchCommand(text) {
} }
} }
}; };
// Function: selectAllInCurrentLayer
// Clears the selection, then adds all elements in the current layer to the selection.
// This function then fires the selected event.
this.selectAllInCurrentLayer = function() {
if (current_layer) {
canvas.clearSelection();
canvas.addToSelection($(current_layer).children());
current_mode = "select";
call("selected", selectedElements);
}
};
// Function: clear // Function: clear
// Clears the current document. This is not an undoable action. // Clears the current document. This is not an undoable action.