[WIP] Scaling
Test / Run tests (push) Successful in 14s

This commit is contained in:
2026-08-12 16:39:02 +02:00
parent 2dee3a9ae9
commit 31e1347376
22 changed files with 430 additions and 409 deletions
@@ -6,8 +6,8 @@ using System.Windows.Shapes;
namespace PamhagenSysCtrl.Helpers.Pipeline {
public class HeatExchanger : INode {
public const double WIDTH = 30;
public const double HEIGHT = 120;
public const double WIDTH = 6;
public const double HEIGHT = 24;
public double CenterX { get; set; }
public double CenterY { get; set; }
@@ -28,29 +28,32 @@ namespace PamhagenSysCtrl.Helpers.Pipeline {
public void Draw(Canvas canvas) {
_rect = new Rectangle() {
Width = WIDTH,
Height = HEIGHT,
Stroke = Brushes.Black,
StrokeThickness = 2,
Fill = Brushes.WhiteSmoke,
};
_text = new() {
Text = Label,
FontSize = 12,
Width = HEIGHT,
TextAlignment = TextAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
RenderTransform = new RotateTransform(270),
SnapsToDevicePixels = true,
};
_rect.SetValue(Canvas.LeftProperty, CenterX - WIDTH / 2);
_rect.SetValue(Canvas.TopProperty, CenterY - HEIGHT / 2);
_text.SetValue(Canvas.LeftProperty, CenterX - 9);
_text.SetValue(Canvas.TopProperty, CenterY + HEIGHT / 2);
canvas.Children.Add(_rect);
canvas.Children.Add(_text);
}
public void Scale(double scale) {
_rect?.Width = WIDTH * scale;
_rect?.Height = HEIGHT * scale;
_rect?.StrokeThickness = 2;
_rect?.SetValue(Canvas.LeftProperty, (CenterX - WIDTH / 2) * scale);
_rect?.SetValue(Canvas.TopProperty, (CenterY - HEIGHT / 2) * scale);
_text?.FontSize = 12;
_text?.Width = HEIGHT * scale;
_text?.SetValue(Canvas.LeftProperty, (CenterX * scale) - 9);
_text?.SetValue(Canvas.TopProperty, (CenterY + HEIGHT / 2) * scale);
}
public bool IsInside(double x, double y) {
return Math.Abs(x - CenterX) <= WIDTH / 2 && Math.Abs(y - CenterY) <= HEIGHT / 2;
}