diff --git a/editor/svg-editor.html b/editor/svg-editor.html index fd1d87d1..194321d4 100644 --- a/editor/svg-editor.html +++ b/editor/svg-editor.html @@ -184,7 +184,7 @@
-
+
diff --git a/editor/svg-editor.js b/editor/svg-editor.js index af264167..9a3f4df3 100644 --- a/editor/svg-editor.js +++ b/editor/svg-editor.js @@ -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 diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index 1b0fcfc0..f4df9775 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -2484,7 +2484,11 @@ var getMouseTarget = this.getMouseTarget = function(evt) { if(canvas.spaceKey || evt.button === 1) return; 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); } };