From 53bab05798359e3b3d51e7117dc00fae15ed9640 Mon Sep 17 00:00:00 2001 From: kenkeiras Date: Sun, 21 Jan 2018 23:07:22 +0100 Subject: [PATCH] Move getCenteredOn to PartGrid. --- .../com/codigoparallevar/minicards/PartInstantiator.java | 6 +++--- .../java/com/codigoparallevar/minicards/types/PartGrid.java | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/codigoparallevar/minicards/PartInstantiator.java b/app/src/main/java/com/codigoparallevar/minicards/PartInstantiator.java index 87804c7..4338730 100644 --- a/app/src/main/java/com/codigoparallevar/minicards/PartInstantiator.java +++ b/app/src/main/java/com/codigoparallevar/minicards/PartInstantiator.java @@ -7,9 +7,9 @@ import com.codigoparallevar.minicards.types.Tuple2; public abstract class PartInstantiator { protected abstract Part instantiate(PartGrid grid, Tuple2 center); - public Part build(CanvasView canvasView) { - Tuple2 center = canvasView.getCenteredOn(); + public Part build(PartGrid grid) { + Tuple2 center = grid.getCenteredOn(); - return instantiate(canvasView, center); + return instantiate(grid, center); } } diff --git a/app/src/main/java/com/codigoparallevar/minicards/types/PartGrid.java b/app/src/main/java/com/codigoparallevar/minicards/types/PartGrid.java index 2502b0c..ad098be 100644 --- a/app/src/main/java/com/codigoparallevar/minicards/types/PartGrid.java +++ b/app/src/main/java/com/codigoparallevar/minicards/types/PartGrid.java @@ -1,10 +1,11 @@ package com.codigoparallevar.minicards.types; -import com.codigoparallevar.minicards.types.connectors.input.InputConnector; import com.codigoparallevar.minicards.types.connectors.input.SignalInputConnector; public interface PartGrid { Selectable getPartOn(int x, int y); SignalInputConnector getSignalInputConnectorOn(int x, int y); + + Tuple2 getCenteredOn(); }