Added default keyboard shortcuts to common commands including: Undo, Redo, Cut, Copy and Paste

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1949 eee81c28-f429-11dd-99c0-75d572ba1ddd
This commit is contained in:
Alexis Deveria
2011-01-28 20:11:18 +00:00
parent 2a8f6fbd20
commit 81ac3d75c6
2 changed files with 44 additions and 11 deletions

View File

@@ -8849,7 +8849,7 @@ this.copySelectedElements = function() {
canvas.clipBoard = $.merge([], selectedElements);
};
this.pasteElements = function(type) {
this.pasteElements = function(type, x, y) {
var cb = canvas.clipBoard;
var len = cb.length;
if(!len) return;
@@ -8875,9 +8875,20 @@ this.pasteElements = function(type) {
selectOnly(pasted);
if(type !== 'in_place') {
var ctr_x, ctr_y;
if(!type) {
ctr_x = lastClickPoint.x;
ctr_y = lastClickPoint.y;
} else if(type === 'point') {
ctr_x = x;
ctr_y = y;
}
var bbox = getStrokedBBox(pasted);
var cx = lastClickPoint.x - (bbox.x + bbox.width/2),
cy = lastClickPoint.y - (bbox.y + bbox.height/2),
var cx = ctr_x - (bbox.x + bbox.width/2),
cy = ctr_y - (bbox.y + bbox.height/2),
dx = [],
dy = [];
@@ -8890,6 +8901,8 @@ this.pasteElements = function(type) {
batchCmd.addSubCommand(cmd);
}
addCommandToHistory(batchCmd);
call("changed", pasted);
}