Made arrow-key nudging work on grid-snap, made shift-arrow move elements by 10x multiple

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1741 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Alexis Deveria 2010-09-21 19:22:52 +00:00
parent 2b09b9d8bf
commit 1a494c3a42
2 changed files with 14 additions and 3 deletions

View File

@ -2270,6 +2270,12 @@
var moveSelected = function(dx,dy) {
if (selectedElement != null || multiselected) {
if(curConfig.gridSnapping) {
// Use grid snap value regardless of zoom level
var multi = svgCanvas.getZoom() * curConfig.snappingStep;
dx *= multi;
dy *= multi;
}
svgCanvas.moveSelectedElements(dx,dy);
}
};
@ -3593,8 +3599,8 @@
{sel:'#copy_save_done', fn: cancelOverlays, evt: 'click'},
// Shortcuts not associated with buttons
{key: 'shift+left', fn: function(){rotateSelected(0)}},
{key: 'shift+right', fn: function(){rotateSelected(1)}},
{key: 'ctrl+shift+left', fn: function(){rotateSelected(0)}},
{key: 'ctrl+shift+right', fn: function(){rotateSelected(1)}},
{key: 'shift+O', fn: selectPrev},
{key: 'shift+P', fn: selectNext},
{key: [modKey+'up', true], fn: function(){zoomImage(2);}},
@ -3605,6 +3611,10 @@
{key: ['down', true], fn: function(){moveSelected(0,1);}},
{key: ['left', true], fn: function(){moveSelected(-1,0);}},
{key: ['right', true], fn: function(){moveSelected(1,0);}},
{key: 'shift+up', fn: function(){moveSelected(0,-10)}},
{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: 'A', fn: function(){svgCanvas.selectAllInCurrentLayer();}}
];

View File

@ -10744,7 +10744,7 @@ this.moveUpDownSelected = function(dir) {
//
// Returns:
// Batch command for the move
this.moveSelectedElements = function(dx,dy,undoable) {
this.moveSelectedElements = function(dx, dy, undoable) {
// if undoable is not sent, default to true
// if single values, scale them to the zoom
if (dx.constructor != Array) {
@ -10792,6 +10792,7 @@ this.moveSelectedElements = function(dx,dy,undoable) {
if (cmd) {
batchCmd.addSubCommand(cmd);
}
selectorManager.requestSelector(selected).resize();
}
}