Renamed clone to duplicate and added ALT arrow and ALT drag duplicate

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1951 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Adrian Jones 2011-01-30 05:55:33 +00:00
parent 81ac3d75c6
commit 4da11c4924
3 changed files with 18 additions and 6 deletions

View File

@ -184,7 +184,7 @@
<div id="selected_panel">
<div class="toolset">
<div class="tool_sep"></div>
<div class="push_button" id="tool_clone" title="Clone Element [C]"></div>
<div class="push_button" id="tool_clone" title="Duplicate Element [D]"></div>
<div class="push_button" id="tool_delete" title="Delete Element [Delete/Backspace]"></div>
<div class="tool_sep"></div>
<div class="push_button" id="tool_move_top" title="Bring to Front [ Ctrl+Shift+] ]"></div>

View File

@ -2643,7 +2643,7 @@
};
var clickClone = function(){
svgCanvas.cloneSelectedElements();
svgCanvas.cloneSelectedElements(20,20);
};
var clickAlign = function() {
@ -3944,7 +3944,7 @@
{sel:'#tool_make_link,#tool_make_link_multi', fn: makeHyperlink, evt: 'click'},
{sel:'#tool_undo', fn: clickUndo, evt: 'click', key: ['Z', true]},
{sel:'#tool_redo', fn: clickRedo, evt: 'click', key: ['Y', true]},
{sel:'#tool_clone,#tool_clone_multi', fn: clickClone, evt: 'click', key: ['C', true]},
{sel:'#tool_clone,#tool_clone_multi', fn: clickClone, evt: 'click', key: ['D', true]},
{sel:'#tool_group', fn: clickGroup, evt: 'click', key: ['G', true]},
{sel:'#tool_ungroup', fn: clickGroup, evt: 'click'},
{sel:'#tool_unlink_use', fn: clickGroup, evt: 'click'},
@ -3977,6 +3977,14 @@
{key: 'shift+down', fn: function(){moveSelected(0,10)}},
{key: 'shift+left', fn: function(){moveSelected(-10,0)}},
{key: 'shift+right', fn: function(){moveSelected(10,0)}},
{key: ['alt+up', true], fn: function(){svgCanvas.cloneSelectedElements(0,-1)}},
{key: ['alt+down', true], fn: function(){svgCanvas.cloneSelectedElements(0,1)}},
{key: ['alt+left', true], fn: function(){svgCanvas.cloneSelectedElements(-1,0)}},
{key: ['alt+right', true], fn: function(){svgCanvas.cloneSelectedElements(1,0)}},
{key: ['alt+shift+up', true], fn: function(){svgCanvas.cloneSelectedElements(0,-10)}},
{key: ['alt+shift+down', true], fn: function(){svgCanvas.cloneSelectedElements(0,10)}},
{key: ['alt+shift+left', true], fn: function(){svgCanvas.cloneSelectedElements(-10,0)}},
{key: ['alt+shift+right', true], fn: function(){svgCanvas.cloneSelectedElements(10,0)}},
{key: 'A', fn: function(){svgCanvas.selectAllInCurrentLayer();}},
// Standard shortcuts

View File

@ -2485,6 +2485,10 @@ var getMouseTarget = this.getMouseTarget = function(evt) {
var right_click = evt.button === 2;
if(evt.altKey) { // duplicate when dragging
svgCanvas.cloneSelectedElements(0,0);
}
root_sctm = svgcontent.getScreenCTM().inverse();
var pt = transformPoint( evt.pageX, evt.pageY, root_sctm ),
mouse_x = pt.x * current_zoom,
@ -9362,7 +9366,7 @@ this.moveSelectedElements = function(dx, dy, undoable) {
// Function: cloneSelectedElements
// Create deep DOM copies (clones) of all selected elements and move them slightly
// from their originals
this.cloneSelectedElements = function() {
this.cloneSelectedElements = function(x,y) {
var batchCmd = new BatchCommand("Clone Elements");
// find all the elements selected (stop at first null)
var len = selectedElements.length;
@ -9385,7 +9389,7 @@ this.cloneSelectedElements = function() {
if (!batchCmd.isEmpty()) {
addToSelection(copiedElements.reverse()); // Need to reverse for correct selection-adding
this.moveSelectedElements(20,20,false);
this.moveSelectedElements(x,y,false);
addCommandToHistory(batchCmd);
}
};