I've got a Canvas and I put some stuff on it, then I scaled it. But, when you run the scales, they don't originate from the point they should, like, if you scale it from one origin a bit, then scale from another origin, the second origin acts as if it's been offset somewhat in a really strange fashion instead of behaving as intended (and as the first origin behaves). I've been using ths code to perform the scaling:
foreach (UIElement element in canvas1.Children)
{
Point p = e.MouseDevice.GetPosition(element);
Matrix m = element.RenderTransform.Value;
if (e.Delta > 0)
m.ScaleAt(1.1, 1.1, p.X, p.Y);
else
m.ScaleAt(1 / 1.1, 1 / 1.1, p.X, p.Y);
element.RenderTransform = new MatrixTransform(m);
}
What on earth could be going on?
I realized that my original question text wasn't as clear as it could be. I scale from the mouse origin, so you move your mouse to the left of my example pair of text objects, scroll the wheel and they zoom in or out and move across the screen in a perfectly good fashion. But if you then move your mouse to the right far on the other side of the objects, and try to scroll, then they act as if the mouse in the middle of them - that is, they zoom in and out without moving across the screen at all.