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