Make inputs enter from the top of a block, outputs go to the bottom.
This commit is contained in:
parent
b6c712860d
commit
4d477cfa5d
@ -115,11 +115,11 @@ public class RoundButton implements Part {
|
||||
}
|
||||
|
||||
private int getOutputConnectorCenterX() {
|
||||
return _xCenter + _outerRadius;
|
||||
return _xCenter;
|
||||
}
|
||||
|
||||
private int getOutputConnectorCenterY() {
|
||||
return _yCenter;
|
||||
return _yCenter + _outerRadius;
|
||||
}
|
||||
|
||||
private int getOutputConnectRadius() {
|
||||
|
@ -147,7 +147,8 @@ public class Ticker implements Part {
|
||||
Paint connectorPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
connectorPaint.setColor(Color.RED);
|
||||
|
||||
canvas.drawCircle(_right, getOutputConnectorCenterY(),
|
||||
canvas.drawCircle(getOutputConnectorCenterX(),
|
||||
getOutputConnectorCenterY(),
|
||||
getOutputConnectRadius(),
|
||||
connectorPaint);
|
||||
}
|
||||
@ -289,11 +290,11 @@ public class Ticker implements Part {
|
||||
|
||||
|
||||
private int getOutputConnectorCenterX() {
|
||||
return _right;
|
||||
return (_left + _right) / 2;
|
||||
}
|
||||
|
||||
private int getOutputConnectorCenterY() {
|
||||
return (_top + _bottom) / 2;
|
||||
return _bottom;
|
||||
}
|
||||
|
||||
private int getOutputConnectRadius() {
|
||||
|
@ -132,14 +132,16 @@ public class Toggle implements Part {
|
||||
inputConnectorPaint.setColor(Color.YELLOW);
|
||||
|
||||
canvas.drawCircle(
|
||||
getInputConnectorCenterX(), getInputConnectorCenterY(),
|
||||
getInputConnectorCenterX(),
|
||||
getInputConnectorCenterY(),
|
||||
getInputConnectRadius(),
|
||||
inputConnectorPaint);
|
||||
|
||||
Paint outputConnectorPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
outputConnectorPaint.setColor(Color.RED);
|
||||
|
||||
canvas.drawCircle(_right, getOutputConnectorCenterY(),
|
||||
canvas.drawCircle(getOutputConnectorCenterX(),
|
||||
getOutputConnectorCenterY(),
|
||||
getOutputConnectRadius(),
|
||||
outputConnectorPaint);
|
||||
}
|
||||
@ -306,7 +308,7 @@ public class Toggle implements Part {
|
||||
}
|
||||
|
||||
public int getInputConnectorCenterX() {
|
||||
return get_left();
|
||||
return (get_left() + get_right()) / 2;
|
||||
}
|
||||
|
||||
private int getInputConnectRadius() {
|
||||
@ -314,15 +316,15 @@ public class Toggle implements Part {
|
||||
}
|
||||
|
||||
public int getInputConnectorCenterY() {
|
||||
return (get_top() + get_bottom()) / 2;
|
||||
return get_top();
|
||||
}
|
||||
|
||||
private int getOutputConnectorCenterX() {
|
||||
return _right;
|
||||
return (get_left() + get_right()) / 2;
|
||||
}
|
||||
|
||||
private int getOutputConnectorCenterY() {
|
||||
return (_top + _bottom) / 2;
|
||||
return get_bottom();
|
||||
}
|
||||
|
||||
private int getOutputConnectRadius() {
|
||||
|
@ -109,7 +109,8 @@ public class ColorBox implements Part {
|
||||
connectorPaint.setColor(Color.YELLOW);
|
||||
|
||||
canvas.drawCircle(
|
||||
getInputConnectorCenterX(), getInputConnectorCenterY(),
|
||||
getInputConnectorCenterX(),
|
||||
getInputConnectorCenterY(),
|
||||
getInputConnectRadius(),
|
||||
connectorPaint);
|
||||
}
|
||||
@ -238,7 +239,7 @@ public class ColorBox implements Part {
|
||||
}
|
||||
|
||||
public int getInputConnectorCenterX() {
|
||||
return get_left();
|
||||
return (get_left() + get_right()) / 2;
|
||||
}
|
||||
|
||||
private int getInputConnectRadius() {
|
||||
@ -246,7 +247,7 @@ public class ColorBox implements Part {
|
||||
}
|
||||
|
||||
public int getInputConnectorCenterY() {
|
||||
return (get_top() + get_bottom()) / 2;
|
||||
return get_top();
|
||||
}
|
||||
|
||||
public static PartInstantiator getInstantiator() {
|
||||
|
@ -110,7 +110,7 @@ public class ConvertToString implements Part {
|
||||
drawWires(canvas, devMode);
|
||||
|
||||
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
paint.setColor(Color.WHITE);
|
||||
paint.setColor(Color.BLACK);
|
||||
canvas.drawRect(
|
||||
new Rect(_left, _top,
|
||||
_right, _bottom),
|
||||
@ -120,8 +120,8 @@ public class ConvertToString implements Part {
|
||||
textPaint.setColor(Color.GREEN);
|
||||
textPaint.setTextSize(100);
|
||||
canvas.drawText(_lastValue,
|
||||
_left,
|
||||
_top - 5,
|
||||
_left + 10,
|
||||
_bottom - 10,
|
||||
textPaint);
|
||||
}
|
||||
}
|
||||
@ -131,14 +131,16 @@ public class ConvertToString implements Part {
|
||||
inputConnectorPaint.setColor(Color.YELLOW);
|
||||
|
||||
canvas.drawCircle(
|
||||
getInputConnectorCenterX(), getInputConnectorCenterY(),
|
||||
getInputConnectorCenterX(),
|
||||
getInputConnectorCenterY(),
|
||||
getInputConnectRadius(),
|
||||
inputConnectorPaint);
|
||||
|
||||
Paint outputConnectorPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
outputConnectorPaint.setColor(Color.RED);
|
||||
|
||||
canvas.drawCircle(_right, getOutputConnectorCenterY(),
|
||||
canvas.drawCircle(getOutputConnectorCenterX(),
|
||||
getOutputConnectorCenterY(),
|
||||
getOutputConnectRadius(),
|
||||
outputConnectorPaint);
|
||||
}
|
||||
@ -315,7 +317,7 @@ public class ConvertToString implements Part {
|
||||
}
|
||||
|
||||
public int getInputConnectorCenterX() {
|
||||
return get_left();
|
||||
return (get_left() + get_right()) / 2;
|
||||
}
|
||||
|
||||
private int getInputConnectRadius() {
|
||||
@ -323,15 +325,15 @@ public class ConvertToString implements Part {
|
||||
}
|
||||
|
||||
public int getInputConnectorCenterY() {
|
||||
return (get_top() + get_bottom()) / 2;
|
||||
return get_top();
|
||||
}
|
||||
|
||||
private int getOutputConnectorCenterX() {
|
||||
return _right;
|
||||
return (get_left() + get_right()) / 2;
|
||||
}
|
||||
|
||||
private int getOutputConnectorCenterY() {
|
||||
return (_top + _bottom) / 2;
|
||||
return get_bottom();
|
||||
}
|
||||
|
||||
private int getOutputConnectRadius() {
|
||||
|
@ -53,13 +53,13 @@ public class Wire<T extends WireDataType, InputConnectorType extends InputConnec
|
||||
|
||||
samplePath.moveTo(_xinit, _yinit);
|
||||
samplePath.cubicTo(
|
||||
_xinit + _pathRunWay, _yinit,
|
||||
_xend - _pathRunWay, _yend,
|
||||
_xinit, _yinit + _pathRunWay,
|
||||
_xend, _yend - _pathRunWay,
|
||||
_xend, _yend);
|
||||
|
||||
Paint pathPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
pathPaint.setColor(Color.GREEN);
|
||||
pathPaint.setStrokeWidth(5.0f);
|
||||
pathPaint.setColor(Color.parseColor("#44FF44"));
|
||||
pathPaint.setStrokeWidth(10.0f);
|
||||
pathPaint.setStrokeCap(Paint.Cap.ROUND);
|
||||
pathPaint.setStyle(Paint.Style.STROKE);
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
<com.codigoparallevar.minicards.CanvasView
|
||||
android:id="@+id/canvasView"
|
||||
android:layout_width="383dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:layout_editor_absoluteX="1dp" />
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user