On 4/24/07, Derek Hinchliffe <derek@...> wrote:
> The idea: allow the view of the canvas to be rotated (around the
> current mouse cursor position) using keystrokes. I see three
> keystrokes being required: rotate anti-clockwise, rotate clockwise,
> and reset to normal.
That's a very good idea and something I always wanted to do,
eventually. The only problem is to find a free keyboard shortcut for
> My questions:
> 1. Is the architecture of the Inkscape canvas suited to implementing
> this, or would is require major changes?
Hopefully, yes. But you can't be sure until you try :)
> 2. I have tried to work my way through the source relating to canvas
> drawing but I'm still not sure what layer I should be looking at. Any
> hints on what object(s) I should focus on?
Hopefully all you need to change is the SPDesktop class (corresponding
to an editing window with a document), see below
> 3. Any comments as to how to approach it? Should I focus on trying to
> rotate the view of the canvas, or should I look at applying a
> (temporary) rotation to the entire SVG file?
Certainly not. We already handle zooming and panning in window, and
rotating would use the same mechanism. Namely, the SPDesktop class has
the _d2w member which is a matrix that translates the desktop
coordinate system (which is the same as document except it's flipped
vertically so that Y increases downwards - but this should not concern
you) into the window's coordinate system. This matrix currently holds
the scale (zoom) and translate (pan) components. But nothing prevents
you from adding rotation to it as well. In theory, that is all that's
needed - all display and interaction use _d2w, so everything should
just work. In practice, of course, there will be some gotchas, most
likely because some code silently assumes that _d2w can only contain
scales and translates but will break with rotation. But I think these
problems will be relatively easy to fix. Try it :)
Inkscape. Draw Freely.