Skip to content

Commit

Permalink
fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Heathermcx committed Jan 2, 2024
1 parent 04a8e57 commit 22f4c2a
Show file tree
Hide file tree
Showing 8 changed files with 225 additions and 225 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ namespace Blazor.Diagrams.Core.Positions.Resizing
{
public class BottomLeftResizerProvider : IResizerProvider
{
public string? Class => "bottomleft";
public string? Class => "bottomleft";

private Size _originalSize = null!;
private Size _originalSize = null!;
private Point _originalPosition = null!;
private Point _originalMousePosition = null!;
private NodeModel _nodeModel = null!;
private Diagram _diagram = null!;
private Diagram _diagram = null!;


public Point? GetPosition(Model model)
public Point? GetPosition(Model model)
{
if (model is NodeModel nodeModel && nodeModel.Size is not null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class BottomRightResizerProvider : IResizerProvider
private NodeModel _nodeModel = null!;
private Diagram _diagram = null!;

public Point? GetPosition(Model model)
public Point? GetPosition(Model model)
{
if (model is NodeModel nodeModel && nodeModel.Size is not null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ namespace Blazor.Diagrams.Core.Positions.Resizing
{
public class TopLeftResizerProvider : IResizerProvider
{
public string? Class => "topleft";
public string? Class => "topleft";

private Size _originalSize = null!;
private Size _originalSize = null!;
private Point _originalPosition = null!;
private Point _originalMousePosition = null!;
private NodeModel _nodeModel = null!;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ namespace Blazor.Diagrams.Core.Positions.Resizing
{
public class TopRightResizerProvider : IResizerProvider
{
public string? Class => "topright";
public string? Class => "topright";

private Size _originalSize = null!;
private Size _originalSize = null!;
private Point _originalPosition = null!;
private Point _originalMousePosition = null!;
private NodeModel _nodeModel = null!;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,68 +79,68 @@ public void DragResizer_SmallerThanMinSize_SetsNodeToMinSize()
node.Size.Height.Should().Be(0);
}

[Fact]
public void DragResizer_ShouldResizeNode_WhenDiagramZoomedOut()
{
// setup
var diagram = new TestDiagram();
diagram.SetContainer(new Rectangle(0, 0, 1000, 400));
var node = new NodeModel(position: new Point(0, 0));
node.Size = new Size(100, 200);
var control = new ResizeControl(new BottomLeftResizerProvider());
diagram.Controls.AddFor(node).Add(control);
diagram.SelectModel(node, false);
[Fact]
public void DragResizer_ShouldResizeNode_WhenDiagramZoomedOut()
{
// setup
var diagram = new TestDiagram();
diagram.SetContainer(new Rectangle(0, 0, 1000, 400));
var node = new NodeModel(position: new Point(0, 0));
node.Size = new Size(100, 200);
var control = new ResizeControl(new BottomLeftResizerProvider());
diagram.Controls.AddFor(node).Add(control);
diagram.SelectModel(node, false);
diagram.SetZoom(0.5);

// before resize
node.Position.X.Should().Be(0);
node.Position.Y.Should().Be(0);
node.Size.Width.Should().Be(100);
node.Size.Height.Should().Be(200);

// resize
var eventArgs = new PointerEventArgs(0, 0, 0, 0, false, false, false, 1, 1, 1, 1, 1, 1, "arrow", true);
control.OnPointerDown(diagram, node, eventArgs);
eventArgs = new PointerEventArgs(10, 15, 0, 0, false, false, false, 1, 1, 1, 1, 1, 1, "arrow", true);
diagram.TriggerPointerMove(null, eventArgs);

// after resize
node.Position.X.Should().Be(20);
node.Position.Y.Should().Be(0);
node.Size.Width.Should().Be(80);
node.Size.Height.Should().Be(230);
}

[Fact]
public void DragResizer_ShouldResizeNode_WhenDiagramZoomedIn()
{
// setup
var diagram = new TestDiagram();
diagram.SetContainer(new Rectangle(0, 0, 1000, 400));
var node = new NodeModel(position: new Point(0, 0));
node.Size = new Size(100, 200);
var control = new ResizeControl(new BottomLeftResizerProvider());
diagram.Controls.AddFor(node).Add(control);
diagram.SelectModel(node, false);
diagram.SetZoom(2);

// before resize
node.Position.X.Should().Be(0);
node.Position.Y.Should().Be(0);
node.Size.Width.Should().Be(100);
node.Size.Height.Should().Be(200);

// resize
var eventArgs = new PointerEventArgs(0, 0, 0, 0, false, false, false, 1, 1, 1, 1, 1, 1, "arrow", true);
control.OnPointerDown(diagram, node, eventArgs);
eventArgs = new PointerEventArgs(10, 15, 0, 0, false, false, false, 1, 1, 1, 1, 1, 1, "arrow", true);
diagram.TriggerPointerMove(null, eventArgs);

// after resize
node.Position.X.Should().Be(5);
node.Position.Y.Should().Be(0);
node.Size.Width.Should().Be(95);
node.Size.Height.Should().Be(207.5);
}
}
// before resize
node.Position.X.Should().Be(0);
node.Position.Y.Should().Be(0);
node.Size.Width.Should().Be(100);
node.Size.Height.Should().Be(200);

// resize
var eventArgs = new PointerEventArgs(0, 0, 0, 0, false, false, false, 1, 1, 1, 1, 1, 1, "arrow", true);
control.OnPointerDown(diagram, node, eventArgs);
eventArgs = new PointerEventArgs(10, 15, 0, 0, false, false, false, 1, 1, 1, 1, 1, 1, "arrow", true);
diagram.TriggerPointerMove(null, eventArgs);

// after resize
node.Position.X.Should().Be(20);
node.Position.Y.Should().Be(0);
node.Size.Width.Should().Be(80);
node.Size.Height.Should().Be(230);
}

[Fact]
public void DragResizer_ShouldResizeNode_WhenDiagramZoomedIn()
{
// setup
var diagram = new TestDiagram();
diagram.SetContainer(new Rectangle(0, 0, 1000, 400));
var node = new NodeModel(position: new Point(0, 0));
node.Size = new Size(100, 200);
var control = new ResizeControl(new BottomLeftResizerProvider());
diagram.Controls.AddFor(node).Add(control);
diagram.SelectModel(node, false);
diagram.SetZoom(2);

// before resize
node.Position.X.Should().Be(0);
node.Position.Y.Should().Be(0);
node.Size.Width.Should().Be(100);
node.Size.Height.Should().Be(200);

// resize
var eventArgs = new PointerEventArgs(0, 0, 0, 0, false, false, false, 1, 1, 1, 1, 1, 1, "arrow", true);
control.OnPointerDown(diagram, node, eventArgs);
eventArgs = new PointerEventArgs(10, 15, 0, 0, false, false, false, 1, 1, 1, 1, 1, 1, "arrow", true);
diagram.TriggerPointerMove(null, eventArgs);

// after resize
node.Position.X.Should().Be(5);
node.Position.Y.Should().Be(0);
node.Size.Width.Should().Be(95);
node.Size.Height.Should().Be(207.5);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -109,36 +109,36 @@ public void DragResizer_ShouldResizeNode_WhenDiagramZoomedOut()
node.Size.Height.Should().Be(230);
}

[Fact]
public void DragResizer_ShouldResizeNode_WhenDiagramZoomedIn()
{
// setup
var diagram = new TestDiagram();
diagram.SetContainer(new Rectangle(0, 0, 1000, 400));
var node = new NodeModel(position: new Point(0, 0));
node.Size = new Size(100, 200);
var control = new ResizeControl(new BottomRightResizerProvider());
diagram.Controls.AddFor(node).Add(control);
diagram.SelectModel(node, false);
diagram.SetZoom(2);

// before resize
node.Position.X.Should().Be(0);
node.Position.Y.Should().Be(0);
node.Size.Width.Should().Be(100);
node.Size.Height.Should().Be(200);

// resize
var eventArgs = new PointerEventArgs(0, 0, 0, 0, false, false, false, 1, 1, 1, 1, 1, 1, "arrow", true);
control.OnPointerDown(diagram, node, eventArgs);
eventArgs = new PointerEventArgs(10, 15, 0, 0, false, false, false, 1, 1, 1, 1, 1, 1, "arrow", true);
diagram.TriggerPointerMove(null, eventArgs);

// after resize
node.Position.X.Should().Be(0);
node.Position.Y.Should().Be(0);
node.Size.Width.Should().Be(105);
node.Size.Height.Should().Be(207.5);
}
}
[Fact]
public void DragResizer_ShouldResizeNode_WhenDiagramZoomedIn()
{
// setup
var diagram = new TestDiagram();
diagram.SetContainer(new Rectangle(0, 0, 1000, 400));
var node = new NodeModel(position: new Point(0, 0));
node.Size = new Size(100, 200);
var control = new ResizeControl(new BottomRightResizerProvider());
diagram.Controls.AddFor(node).Add(control);
diagram.SelectModel(node, false);
diagram.SetZoom(2);

// before resize
node.Position.X.Should().Be(0);
node.Position.Y.Should().Be(0);
node.Size.Width.Should().Be(100);
node.Size.Height.Should().Be(200);

// resize
var eventArgs = new PointerEventArgs(0, 0, 0, 0, false, false, false, 1, 1, 1, 1, 1, 1, "arrow", true);
control.OnPointerDown(diagram, node, eventArgs);
eventArgs = new PointerEventArgs(10, 15, 0, 0, false, false, false, 1, 1, 1, 1, 1, 1, "arrow", true);
diagram.TriggerPointerMove(null, eventArgs);

// after resize
node.Position.X.Should().Be(0);
node.Position.Y.Should().Be(0);
node.Size.Width.Should().Be(105);
node.Size.Height.Should().Be(207.5);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,68 +79,68 @@ public void DragResizer_SmallerThanMinSize_SetsNodeToMinSize()
node.Size.Height.Should().Be(0);
}

[Fact]
public void DragResizer_ShouldResizeNode_WhenDiagramZoomedOut()
{
// setup
var diagram = new TestDiagram();
diagram.SetContainer(new Rectangle(0, 0, 1000, 400));
var node = new NodeModel(position: new Point(0, 0));
node.Size = new Size(100, 200);
var control = new ResizeControl(new TopLeftResizerProvider());
diagram.Controls.AddFor(node).Add(control);
diagram.SelectModel(node, false);
[Fact]
public void DragResizer_ShouldResizeNode_WhenDiagramZoomedOut()
{
// setup
var diagram = new TestDiagram();
diagram.SetContainer(new Rectangle(0, 0, 1000, 400));
var node = new NodeModel(position: new Point(0, 0));
node.Size = new Size(100, 200);
var control = new ResizeControl(new TopLeftResizerProvider());
diagram.Controls.AddFor(node).Add(control);
diagram.SelectModel(node, false);
diagram.SetZoom(0.5);

// before resize
node.Position.X.Should().Be(0);
node.Position.Y.Should().Be(0);
node.Size.Width.Should().Be(100);
node.Size.Height.Should().Be(200);

// resize
var eventArgs = new PointerEventArgs(0, 0, 0, 0, false, false, false, 1, 1, 1, 1, 1, 1, "arrow", true);
control.OnPointerDown(diagram, node, eventArgs);
eventArgs = new PointerEventArgs(10, 15, 0, 0, false, false, false, 1, 1, 1, 1, 1, 1, "arrow", true);
diagram.TriggerPointerMove(null, eventArgs);

// after resize
node.Position.X.Should().Be(20);
node.Position.Y.Should().Be(30);
node.Size.Width.Should().Be(80);
node.Size.Height.Should().Be(170);
}

[Fact]
public void DragResizer_ShouldResizeNode_WhenDiagramZoomedIn()
{
// setup
var diagram = new TestDiagram();
diagram.SetContainer(new Rectangle(0, 0, 1000, 400));
var node = new NodeModel(position: new Point(0, 0));
node.Size = new Size(100, 200);
var control = new ResizeControl(new TopLeftResizerProvider());
diagram.Controls.AddFor(node).Add(control);
diagram.SelectModel(node, false);
diagram.SetZoom(2);

// before resize
node.Position.X.Should().Be(0);
node.Position.Y.Should().Be(0);
node.Size.Width.Should().Be(100);
node.Size.Height.Should().Be(200);

// resize
var eventArgs = new PointerEventArgs(0, 0, 0, 0, false, false, false, 1, 1, 1, 1, 1, 1, "arrow", true);
control.OnPointerDown(diagram, node, eventArgs);
eventArgs = new PointerEventArgs(10, 15, 0, 0, false, false, false, 1, 1, 1, 1, 1, 1, "arrow", true);
diagram.TriggerPointerMove(null, eventArgs);

// after resize
node.Position.X.Should().Be(5);
node.Position.Y.Should().Be(7.5);
node.Size.Width.Should().Be(95);
node.Size.Height.Should().Be(192.5);
}
}
// before resize
node.Position.X.Should().Be(0);
node.Position.Y.Should().Be(0);
node.Size.Width.Should().Be(100);
node.Size.Height.Should().Be(200);

// resize
var eventArgs = new PointerEventArgs(0, 0, 0, 0, false, false, false, 1, 1, 1, 1, 1, 1, "arrow", true);
control.OnPointerDown(diagram, node, eventArgs);
eventArgs = new PointerEventArgs(10, 15, 0, 0, false, false, false, 1, 1, 1, 1, 1, 1, "arrow", true);
diagram.TriggerPointerMove(null, eventArgs);

// after resize
node.Position.X.Should().Be(20);
node.Position.Y.Should().Be(30);
node.Size.Width.Should().Be(80);
node.Size.Height.Should().Be(170);
}

[Fact]
public void DragResizer_ShouldResizeNode_WhenDiagramZoomedIn()
{
// setup
var diagram = new TestDiagram();
diagram.SetContainer(new Rectangle(0, 0, 1000, 400));
var node = new NodeModel(position: new Point(0, 0));
node.Size = new Size(100, 200);
var control = new ResizeControl(new TopLeftResizerProvider());
diagram.Controls.AddFor(node).Add(control);
diagram.SelectModel(node, false);
diagram.SetZoom(2);

// before resize
node.Position.X.Should().Be(0);
node.Position.Y.Should().Be(0);
node.Size.Width.Should().Be(100);
node.Size.Height.Should().Be(200);

// resize
var eventArgs = new PointerEventArgs(0, 0, 0, 0, false, false, false, 1, 1, 1, 1, 1, 1, "arrow", true);
control.OnPointerDown(diagram, node, eventArgs);
eventArgs = new PointerEventArgs(10, 15, 0, 0, false, false, false, 1, 1, 1, 1, 1, 1, "arrow", true);
diagram.TriggerPointerMove(null, eventArgs);

// after resize
node.Position.X.Should().Be(5);
node.Position.Y.Should().Be(7.5);
node.Size.Width.Should().Be(95);
node.Size.Height.Should().Be(192.5);
}
}
}
Loading

0 comments on commit 22f4c2a

Please sign in to comment.