private void TransformControl(HeliosVisual visual, double scale, Point translation) { visual.Left = visual.Left * scale + translation.X; visual.Top = visual.Top * scale + translation.Y; visual.Width = Math.Max(visual.Width * scale, 1d); visual.Height = Math.Max(visual.Height * scale, 1d); // child coordinates are relative, so we don't have to translate visual.ScaleChildren(scale, scale); }
private void ScaleControl(HeliosVisual visual, double scale) { if (visual.Left > 0) { double locXDif = visual.Left; visual.Left += (locXDif * scale) - locXDif; } if (visual.Top > 0) { double locYDif = visual.Top; visual.Top += (locYDif * scale) - locYDif; } visual.Width = Math.Max(visual.Width * scale, 1d); visual.Height = Math.Max(visual.Height * scale, 1d); visual.ScaleChildren(scale, scale); }