Fixed issue 102: Allow selection of next child/previous child with a key and issue 107: Creating an object selects it automatically and switches to the Select tool
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@430 eee81c28-f429-11dd-99c0-75d572ba1ddd
This commit is contained in:
@@ -263,7 +263,6 @@ function SvgCanvas(c)
|
||||
offset += 2;
|
||||
}
|
||||
var bbox = bbox || canvas.getBBox(this.selectedElement);
|
||||
console.log(bbox);
|
||||
var l=bbox.x-offset, t=bbox.y-offset, w=bbox.width+(offset<<1), h=bbox.height+(offset<<1);
|
||||
// TODO: use suspendRedraw() here
|
||||
selectedBox.setAttribute("x", l);
|
||||
@@ -978,7 +977,7 @@ function SvgCanvas(c)
|
||||
call("selected", selectedElements);
|
||||
};
|
||||
|
||||
this.addToSelection = function(elemsToAdd) {
|
||||
this.addToSelection = function(elemsToAdd, showGrips) {
|
||||
if (elemsToAdd.length == 0) { return; }
|
||||
|
||||
// find the first null in our selectedElements array
|
||||
@@ -1004,6 +1003,10 @@ function SvgCanvas(c)
|
||||
call("selected", selectedElements);
|
||||
}
|
||||
}
|
||||
|
||||
if(showGrips) {
|
||||
selectorManager.requestSelector(selectedElements[0]).showGrips(elem.tagName != "text");
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
@@ -1722,7 +1725,6 @@ function SvgCanvas(c)
|
||||
case "text":
|
||||
keep = true;
|
||||
canvas.clearSelection();
|
||||
canvas.addToSelection([element]);
|
||||
break;
|
||||
case "poly":
|
||||
// set element to null here so that it is not removed nor finalized
|
||||
@@ -1847,6 +1849,8 @@ function SvgCanvas(c)
|
||||
element.parentNode.removeChild(element);
|
||||
element = null;
|
||||
} else if (element != null) {
|
||||
canvas.addedNew = true;
|
||||
canvas.addToSelection([element], true);
|
||||
element.setAttribute("opacity", current_opacity);
|
||||
cleanupElement(element);
|
||||
selectorManager.update();
|
||||
@@ -2034,7 +2038,7 @@ function SvgCanvas(c)
|
||||
};
|
||||
|
||||
this.setFillColor = function(val) {
|
||||
if(selectedElements.length && selectedElements[0].nodeName == 'text') {
|
||||
if(selectedElements[0] != null && selectedElements[0].nodeName == 'text') {
|
||||
current_text_fill = val;
|
||||
} else {
|
||||
current_fill = val;
|
||||
@@ -2171,7 +2175,7 @@ function SvgCanvas(c)
|
||||
};
|
||||
|
||||
this.setStrokeWidth = function(val) {
|
||||
if(selectedElements.length && selectedElements[0].nodeName == 'text') {
|
||||
if(selectedElements[0] != null && selectedElements[0].nodeName == 'text') {
|
||||
current_text_stroke_width = val;
|
||||
} else {
|
||||
current_stroke_width = val;
|
||||
@@ -2618,6 +2622,37 @@ function SvgCanvas(c)
|
||||
}
|
||||
};
|
||||
|
||||
this.cycleElement = function(next) {
|
||||
var cur_elem = selectedElements[0];
|
||||
var elem = false;
|
||||
if (cur_elem == null) {
|
||||
if(next) {
|
||||
var elem = svgroot.firstChild;
|
||||
if (elem.tagName == 'defs') {
|
||||
elem = elem.nextSibling;
|
||||
}
|
||||
} else {
|
||||
var elem = svgroot.lastChild;
|
||||
var id = elem.getAttribute('id');
|
||||
if(!id || id.indexOf('svg_') != 0){
|
||||
elem = elem.previousSibling;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
var type = next?'next':'previous';
|
||||
var elem = cur_elem[type + 'Sibling'];
|
||||
if(!elem) return;
|
||||
|
||||
var id = elem.getAttribute('id');
|
||||
if(!id || id.indexOf('svg_') != 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
canvas.clearSelection();
|
||||
canvas.addToSelection([elem], true);
|
||||
call("selected", selectedElements);
|
||||
}
|
||||
|
||||
var resetUndoStack = function() {
|
||||
undoStack = [];
|
||||
undoStackPointer = 0;
|
||||
|
||||
Reference in New Issue
Block a user