Fixed Issue 232: undo after fit to content (Document properties)
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@876 eee81c28-f429-11dd-99c0-75d572ba1dddmaster
parent
80696e17eb
commit
0fa6da2afc
|
@ -53,7 +53,7 @@ function svg_edit_setup() {
|
|||
// upon creation of a text element the editor is switched into
|
||||
// select mode and this event fires - we need our UI to be in sync
|
||||
|
||||
is_node = selectedElement.id && selectedElement.id.indexOf('pathpointgrip') == 0;
|
||||
is_node = !!(selectedElement.id && selectedElement.id.indexOf('pathpointgrip') == 0);
|
||||
|
||||
if (svgCanvas.getMode() != "multiselect" && !is_node) {
|
||||
setSelectMode();
|
||||
|
|
|
@ -3907,6 +3907,7 @@ function BatchCommand(text) {
|
|||
this.setResolution = function(x, y) {
|
||||
var res = canvas.getResolution();
|
||||
var w = res.w, h = res.h;
|
||||
var batchCmd;
|
||||
|
||||
if(x == 'fit') {
|
||||
canvas.clearSelection();
|
||||
|
@ -3915,15 +3916,17 @@ function BatchCommand(text) {
|
|||
var bbox = canvas.getStrokedBBox();
|
||||
|
||||
if(bbox) {
|
||||
batchCmd = new BatchCommand("Fit Canvas to Content");
|
||||
canvas.addToSelection(canvas.getVisibleElements());
|
||||
$.each(selectedElements, function(i, item) {
|
||||
var sel_bb = item.getBBox();
|
||||
recalculateDimensions(item, {
|
||||
var cmd = recalculateDimensions(item, {
|
||||
x: sel_bb.x - bbox.x,
|
||||
y: sel_bb.y - bbox.y,
|
||||
width: sel_bb.width,
|
||||
height: sel_bb.height
|
||||
});
|
||||
batchCmd.addSubCommand(cmd);
|
||||
});
|
||||
canvas.clearSelection();
|
||||
x = Math.round(bbox.width);
|
||||
|
@ -3936,7 +3939,9 @@ function BatchCommand(text) {
|
|||
y *= current_zoom;
|
||||
if (x != w || y != h) {
|
||||
var handle = svgroot.suspendRedraw(1000);
|
||||
var batchCmd = new BatchCommand("Change Image Dimensions");
|
||||
if(!batchCmd) {
|
||||
batchCmd = new BatchCommand("Change Image Dimensions");
|
||||
}
|
||||
svgroot.setAttribute('width', x);
|
||||
svgroot.setAttribute('height', y);
|
||||
batchCmd.addSubCommand(new ChangeElementCommand(svgroot, {"width":w, "height":h}));
|
||||
|
|
Loading…
Reference in New Issue