Fixed Issue 651: Allow selection of last created element while still in creation mode
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1704 eee81c28-f429-11dd-99c0-75d572ba1dddmaster
parent
c9b20be85b
commit
73fd86ecd9
|
@ -488,6 +488,10 @@ svgEditor.addExtension("Connector", function(S) {
|
||||||
},
|
},
|
||||||
selectedChanged: function(opts) {
|
selectedChanged: function(opts) {
|
||||||
|
|
||||||
|
if(svgCanvas.getMode() == 'connector') {
|
||||||
|
svgCanvas.setMode('select');
|
||||||
|
}
|
||||||
|
|
||||||
// Use this to update the current selected elements
|
// Use this to update the current selected elements
|
||||||
selElems = opts.elems;
|
selElems = opts.elems;
|
||||||
|
|
||||||
|
|
|
@ -501,9 +501,12 @@
|
||||||
}());
|
}());
|
||||||
|
|
||||||
var setSelectMode = function() {
|
var setSelectMode = function() {
|
||||||
$('.tool_button_current').removeClass('tool_button_current').addClass('tool_button');
|
var curr = $('.tool_button_current');
|
||||||
$('#tool_select').addClass('tool_button_current').removeClass('tool_button');
|
if(curr[0].id !== 'tool_select') {
|
||||||
$('#styleoverrides').text('#svgcanvas svg *{cursor:move;pointer-events:all} #svgcanvas svg{cursor:default}');
|
curr.removeClass('tool_button_current').addClass('tool_button');
|
||||||
|
$('#tool_select').addClass('tool_button_current').removeClass('tool_button');
|
||||||
|
$('#styleoverrides').text('#svgcanvas svg *{cursor:move;pointer-events:all} #svgcanvas svg{cursor:default}');
|
||||||
|
}
|
||||||
svgCanvas.setMode('select');
|
svgCanvas.setMode('select');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -624,7 +627,6 @@
|
||||||
// select mode and this event fires - we need our UI to be in sync
|
// select mode and this event fires - we need our UI to be in sync
|
||||||
|
|
||||||
if (mode != "multiselect" && !is_node) {
|
if (mode != "multiselect" && !is_node) {
|
||||||
setSelectMode();
|
|
||||||
updateToolbar();
|
updateToolbar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -642,6 +644,11 @@
|
||||||
|
|
||||||
// called when any element has changed
|
// called when any element has changed
|
||||||
var elementChanged = function(window,elems) {
|
var elementChanged = function(window,elems) {
|
||||||
|
|
||||||
|
if(svgCanvas.getMode() == "select" && $('.tool_button_current')) {
|
||||||
|
setSelectMode();
|
||||||
|
}
|
||||||
|
|
||||||
for (var i = 0; i < elems.length; ++i) {
|
for (var i = 0; i < elems.length; ++i) {
|
||||||
var elem = elems[i];
|
var elem = elems[i];
|
||||||
|
|
||||||
|
|
|
@ -5251,6 +5251,7 @@ var getMouseTarget = this.getMouseTarget = function(evt) {
|
||||||
t.id != "svgcanvas" && t.id != "svgroot")
|
t.id != "svgcanvas" && t.id != "svgroot")
|
||||||
{
|
{
|
||||||
// switch into "select" mode if we've clicked on an element
|
// switch into "select" mode if we've clicked on an element
|
||||||
|
clearSelection(true);
|
||||||
addToSelection([t], true);
|
addToSelection([t], true);
|
||||||
canvas.setMode("select");
|
canvas.setMode("select");
|
||||||
}
|
}
|
||||||
|
@ -5283,10 +5284,14 @@ var getMouseTarget = this.getMouseTarget = function(evt) {
|
||||||
} else if (current_mode == "text" || current_mode == "image" || current_mode == "foreignObject") {
|
} else if (current_mode == "text" || current_mode == "image" || current_mode == "foreignObject") {
|
||||||
// keep us in the tool we were in unless it was a text or image element
|
// keep us in the tool we were in unless it was a text or image element
|
||||||
addToSelection([element], true);
|
addToSelection([element], true);
|
||||||
|
} else {
|
||||||
|
clearSelection(true);
|
||||||
|
addToSelection([element], true);
|
||||||
}
|
}
|
||||||
// we create the insert command that is stored on the stack
|
// we create the insert command that is stored on the stack
|
||||||
// undo means to call cmd.unapply(), redo means to call cmd.apply()
|
// undo means to call cmd.unapply(), redo means to call cmd.apply()
|
||||||
addCommandToHistory(new InsertElementCommand(element));
|
addCommandToHistory(new InsertElementCommand(element));
|
||||||
|
|
||||||
call("changed",[element]);
|
call("changed",[element]);
|
||||||
}, ani_dur * 1000);
|
}, ani_dur * 1000);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue