public static void Scale(this InfiniteScrollViewer self, double scale, double centerX, double centerY) { var d0 = self.TransformPoint(centerX, centerY); self.ScaleMatrix.ScaleX = scale; self.ScaleMatrix.ScaleY = scale; var d1 = self.TransformPoint(centerX, centerY); var diff = d1 - d0; self.TranslateMatrix.X += diff.X * scale; self.TranslateMatrix.Y += diff.Y * scale; }
private void update_thumb(Thumb thumb, InfiniteScrollViewer scrollViewer) { var rect = NetworkView.ItemsRect.ValidateRect(ActualWidth, ActualHeight).ToOffset(scrollViewer.ViewRectOffset); var point = scrollViewer.TransformPoint(0, 0); Canvas.SetLeft(thumb, point.X / (rect.Width / MiniMap.Width)); Canvas.SetTop(thumb, point.Y / (rect.Height / MiniMap.Height)); }