From 8bc6536a86e81b41fabacb93ccf8406fa16f70d1 Mon Sep 17 00:00:00 2001 From: Jeff Schiller Date: Wed, 9 Sep 2009 15:23:44 +0000 Subject: [PATCH] Bind ctrl+up/down to zoom for compatibility (my + key doesn't work with current bindings) git-svn-id: http://svg-edit.googlecode.com/svn/trunk@613 eee81c28-f429-11dd-99c0-75d572ba1ddd --- editor/svg-editor.js | 2 ++ editor/svgcanvas.js | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/editor/svg-editor.js b/editor/svg-editor.js index 3f4b940d..4cf068ef 100644 --- a/editor/svg-editor.js +++ b/editor/svg-editor.js @@ -757,6 +757,8 @@ function svg_edit_setup() { ['shift+right', function(){rotateSelected(1)}], ['shift+O', selectPrev], ['shift+P', selectNext], + ['ctrl+up', function(evt){clickZoom(true);evt.preventDefault();}], + ['ctrl+down', function(evt){clickZoom();evt.preventDefault();}], ['+', function(evt){clickZoom(true);evt.preventDefault();}], ['-', function(evt){clickZoom();evt.preventDefault();}], ['up', function(evt){moveSelected(0,-1);evt.preventDefault();}], diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index ba3c289a..c5c1f794 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -1031,6 +1031,24 @@ function BatchCommand(text) { if (child.nodeType == 1) { var childBox = child.getBBox(); if (childBox) { + // TODO: to fix the rotation problem, we must account for the + // child's rotation in the bbox adjustment + + // If the child is rotated at all, we should figure out the rotated + // bbox before the group's transform, remap all four corners of the bbox + // via the group's transform, then determine the new angle and the new center + /* + var childAngle = canvas.getRotationAngle(child) * Math.PI / 180.0; + var left = childBox.x - gcx, + top = childBox.y - gcy, + right = childBox.x + childBox.width - gcx, + bottom = childBox.y + childBox.height - gcy; + + var ptTopLeft = remap(left,top), + ptTopRight = remap(right,top), + ptBottomLeft = remap(left,bottom), + ptBottomRight = remap(right,bottom); + */ var pt = remap(childBox.x,childBox.y), w = scalew(childBox.width), h = scaleh(childBox.height);