From: cannam <ca...@al...> - 2002-08-28 17:15:24
|
Richard Bown <bo...@bo...> writes: > On Wednesday 28 August 2002 00:49, cannam wrote: > > > I assume zooming > > is now done by changing the world matrix but not the scale > > used by the LinedStaff > > The mouse events are definitely just returning x and > y positions unaffected by the world matrix Maybe you just need to translate them back through the inverse of the world matrix, or something. > but I don't know enough > about the ViewElement stuff to work out how this translates. Well, so long as you're no longer changing the time scale for the matrix staff at the same time as changing the world matrix, then you shouldn't have to worry about the ViewElement stuff. For example, assume at normal zoom a 4/4 bar is 100 pixels wide. Then at double zoom, the whole bar should still be 100 pixels wide as far as the staff, the elements and all of the rest of our code is concerned (i.e. any of our getCanvasX()-type methods applied at the right-hand edge of bar zero should return x=100); but translating through the world matrix (which Qt does transparently on rendering) will make it 200 pixels wide on the screen. And I would have expected that a click at the right- hand edge of that bar would have x=100 regardless of zoom, because Qt would translate back through the world matrix before returning the coordinates. But perhaps it doesn't, in which case you'd have to find a way to make it. Either way, it's got nothing to do with our ViewElement or LinedStaff code or anything like that. It's purely about the QCanvas. (So _long_ as you no longer change the staff's time scale when you do the zoom.) Chris |