[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
@@ -7,8 +7,8 @@ using System.Windows.Shapes;
namespace PamhagenSysCtrl.Helpers.Pipeline {
public class ConveyorBelt : 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; }
@@ -47,15 +47,10 @@ namespace PamhagenSysCtrl.Helpers.Pipeline {
public void Draw(Canvas canvas) {
_rect = new Rectangle() {
Width = WIDTH,
Height = HEIGHT,
Stroke = Brushes.Black,
StrokeThickness = 2,
Fill = Brushes.WhiteSmoke,
StrokeLineJoin = PenLineJoin.Round,
};
_rect.SetValue(Canvas.LeftProperty, CenterX - WIDTH / 2);
_rect.SetValue(Canvas.TopProperty, CenterY - HEIGHT / 2);
var d = 15;
int n = (int)(HEIGHT / d) + 2;
@@ -80,8 +75,8 @@ namespace PamhagenSysCtrl.Helpers.Pipeline {
Storyboard.SetTarget(slideUp, _polyline);
Storyboard.SetTargetProperty(slideUp, new PropertyPath(Canvas.TopProperty));
var clipCanvas = new Canvas() {
Width = WIDTH - 15,
Height = HEIGHT - 8,
Width = WIDTH - 3,
Height = HEIGHT - 1.6,
ClipToBounds = true,
};
clipCanvas.SetValue(Canvas.TopProperty, CenterY - HEIGHT / 2 + 4);
@@ -92,7 +87,17 @@ namespace PamhagenSysCtrl.Helpers.Pipeline {
canvas.Children.Add(clipCanvas);
_storyboard.Begin();
_storyboard.Pause();
}
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);
// TODO clipCanvas
// TODO _polyline
}
public bool IsInside(double x, double y) {