Fix Issue 78: Merge copy/paste button into one clone button
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@354 eee81c28-f429-11dd-99c0-75d572ba1dddmaster
parent
1840240003
commit
86173b1832
|
@ -42,13 +42,12 @@
|
||||||
<img class="tool_sep" src="images/sep.png" alt="|"/>
|
<img class="tool_sep" src="images/sep.png" alt="|"/>
|
||||||
<img class="tool_button tool_button_disabled" id="tool_undo" src="images/undo.png" title="Undo [Z]" alt="Undo" />
|
<img class="tool_button tool_button_disabled" id="tool_undo" src="images/undo.png" title="Undo [Z]" alt="Undo" />
|
||||||
<img class="tool_button tool_button_disabled" id="tool_redo" src="images/redo.png" title="Redo [Shift+Z/Y]" alt="Redo"/>
|
<img class="tool_button tool_button_disabled" id="tool_redo" src="images/redo.png" title="Redo [Shift+Z/Y]" alt="Redo"/>
|
||||||
<img class="tool_button" id="tool_paste" src="images/paste.png" title="Paste Element [V]" alt="Paste"/>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Buttons when something a single element is selected -->
|
<!-- Buttons when something a single element is selected -->
|
||||||
<div id="selected_panel">
|
<div id="selected_panel">
|
||||||
<img class="tool_sep" src="images/sep.png" alt="|"/>
|
<img class="tool_sep" src="images/sep.png" alt="|"/>
|
||||||
<img class="tool_button" id="tool_copy" src="images/copy.png" title="Copy Element [C]" alt="Copy"/>
|
<img class="tool_button" id="tool_clone" src="images/copy.png" title="Clone Element [C]" alt="Copy"/>
|
||||||
<img class="tool_button" id="tool_delete" src="images/delete.png" title="Delete Element [Delete/Backspace]" alt="Delete"/>
|
<img class="tool_button" id="tool_delete" src="images/delete.png" title="Delete Element [Delete/Backspace]" alt="Delete"/>
|
||||||
<img class="tool_button" id="tool_move_top" src="images/move_top.png" title="Move to Top [Shift+Up]" alt="Top"/>
|
<img class="tool_button" id="tool_move_top" src="images/move_top.png" title="Move to Top [Shift+Up]" alt="Top"/>
|
||||||
<img class="tool_button" id="tool_move_bottom" src="images/move_bottom.png" title="Move to Bottom [Shift+Down]" alt="Bottom"/>
|
<img class="tool_button" id="tool_move_bottom" src="images/move_bottom.png" title="Move to Bottom [Shift+Down]" alt="Bottom"/>
|
||||||
|
@ -69,7 +68,7 @@
|
||||||
<!-- Buttons when something a single element is selected -->
|
<!-- Buttons when something a single element is selected -->
|
||||||
<div id="multiselected_panel">
|
<div id="multiselected_panel">
|
||||||
<img class="tool_sep" src="images/sep.png" alt="|"/>
|
<img class="tool_sep" src="images/sep.png" alt="|"/>
|
||||||
<img class="tool_button" id="tool_copy_multi" src="images/copy.png" title="Copy Elements [C]" alt="Copy"/>
|
<img class="tool_button" id="tool_clone_multi" src="images/copy.png" title="Clone Elements [C]" alt="Clone"/>
|
||||||
<img class="tool_button" id="tool_delete_multi" src="images/delete.png" title="Delete Selected Elements [Delete/Backspace]" alt="Delete"/>
|
<img class="tool_button" id="tool_delete_multi" src="images/delete.png" title="Delete Selected Elements [Delete/Backspace]" alt="Delete"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -457,11 +457,8 @@ function svg_edit_setup() {
|
||||||
svgCanvas.redo();
|
svgCanvas.redo();
|
||||||
};
|
};
|
||||||
|
|
||||||
var clickCopy = function(){
|
var clickClone = function(){
|
||||||
svgCanvas.copySelectedElements();
|
svgCanvas.cloneSelectedElements();
|
||||||
};
|
|
||||||
var clickPaste = function(){
|
|
||||||
svgCanvas.pasteElements();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var showSourceEditor = function(){
|
var showSourceEditor = function(){
|
||||||
|
@ -519,9 +516,8 @@ function svg_edit_setup() {
|
||||||
$('#tool_move_bottom').click(moveToBottomSelected);
|
$('#tool_move_bottom').click(moveToBottomSelected);
|
||||||
$('#tool_undo').click(clickUndo);
|
$('#tool_undo').click(clickUndo);
|
||||||
$('#tool_redo').click(clickRedo);
|
$('#tool_redo').click(clickRedo);
|
||||||
$('#tool_paste').click(clickPaste);
|
$('#tool_clone').click(clickClone);
|
||||||
$('#tool_copy').click(clickCopy);
|
$('#tool_clone_multi').click(clickClone);
|
||||||
$('#tool_copy_multi').click(clickCopy);
|
|
||||||
// these two lines are required to make Opera work properly with the flyout mechanism
|
// these two lines are required to make Opera work properly with the flyout mechanism
|
||||||
$('#tools_rect_show').click(clickSquare);
|
$('#tools_rect_show').click(clickSquare);
|
||||||
$('#tools_ellipse_show').click(clickCircle);
|
$('#tools_ellipse_show').click(clickCircle);
|
||||||
|
@ -590,8 +586,7 @@ function svg_edit_setup() {
|
||||||
$(document).bind('keydown', {combi:'shift+z', disableInInput: true}, clickRedo);
|
$(document).bind('keydown', {combi:'shift+z', disableInInput: true}, clickRedo);
|
||||||
$(document).bind('keydown', {combi:'y', disableInInput: true}, clickRedo);
|
$(document).bind('keydown', {combi:'y', disableInInput: true}, clickRedo);
|
||||||
$(document).bind('keydown', {combi:'u', disableInInput: true}, function(evt){showSourceEditor();evt.preventDefault();});
|
$(document).bind('keydown', {combi:'u', disableInInput: true}, function(evt){showSourceEditor();evt.preventDefault();});
|
||||||
$(document).bind('keydown', {combi:'c', disableInInput: true}, clickCopy);
|
$(document).bind('keydown', {combi:'c', disableInInput: true}, clickClone);
|
||||||
$(document).bind('keydown', {combi:'v', disableInInput: true}, clickPaste);
|
|
||||||
$(document).bind('keydown', {combi:'esc', disableInInput: false}, hideSourceEditor);
|
$(document).bind('keydown', {combi:'esc', disableInInput: false}, hideSourceEditor);
|
||||||
|
|
||||||
// TODO: fix opacity being updated
|
// TODO: fix opacity being updated
|
||||||
|
|
|
@ -1905,17 +1905,14 @@ function SvgCanvas(c)
|
||||||
};
|
};
|
||||||
|
|
||||||
// this creates deep DOM copies (clones) of all selected elements
|
// this creates deep DOM copies (clones) of all selected elements
|
||||||
this.copySelectedElements = function() {
|
this.cloneSelectedElements = function() {
|
||||||
|
var batchCmd = new BatchCommand("Clone Elements");
|
||||||
copiedElements = [];
|
copiedElements = [];
|
||||||
var len = selectedElements.length;
|
var len = selectedElements.length;
|
||||||
for (var i = 0; i < len; ++i) {
|
for (var i = 0; i < len; ++i) {
|
||||||
if (selectedElements[i] == null) break;
|
if (selectedElements[i] == null) break;
|
||||||
copiedElements.push(selectedElements[i].cloneNode(true));
|
copiedElements.push(selectedElements[i].cloneNode(true));
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
this.pasteElements = function() {
|
|
||||||
var batchCmd = new BatchCommand("Paste Elements");
|
|
||||||
this.clearSelection();
|
this.clearSelection();
|
||||||
var len = copiedElements.length;
|
var len = copiedElements.length;
|
||||||
for (var i = 0; i < len; ++i) {
|
for (var i = 0; i < len; ++i) {
|
||||||
|
@ -1929,11 +1926,8 @@ function SvgCanvas(c)
|
||||||
this.addToSelection(copiedElements);
|
this.addToSelection(copiedElements);
|
||||||
this.moveSelectedElements(20,20,false);
|
this.moveSelectedElements(20,20,false);
|
||||||
addCommandToHistory(batchCmd);
|
addCommandToHistory(batchCmd);
|
||||||
// re-copy the elements so we can paste again
|
|
||||||
this.copySelectedElements();
|
|
||||||
call("selected", selectedElements);
|
call("selected", selectedElements);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue