use of com.cburch.logisim.data.Bounds in project logisim-evolution by reds-heig.
the class SubcircuitPoker method paint.
@Override
public void paint(InstancePainter painter) {
if (painter.getDestination() instanceof Canvas && painter.getData() instanceof CircuitState) {
Bounds bds = painter.getInstance().getBounds();
int cx = bds.getX() + bds.getWidth() / 2;
int cy = bds.getY() + bds.getHeight() / 2;
int tx = cx + 3;
int ty = cy + 3;
int[] xp = { tx - 1, cx + 8, cx + 10, tx + 1 };
int[] yp = { ty + 1, cy + 10, cy + 8, ty - 1 };
Graphics g = painter.getGraphics();
if (mouseDown) {
g.setColor(MAGNIFYING_INTERIOR_DOWN);
} else {
g.setColor(MAGNIFYING_INTERIOR);
}
g.fillOval(cx - 5, cy - 5, 10, 10);
g.setColor(Color.BLACK);
g.drawOval(cx - 5, cy - 5, 10, 10);
g.fillPolygon(xp, yp, xp.length);
}
}
use of com.cburch.logisim.data.Bounds in project logisim-evolution by reds-heig.
the class SubcircuitPoker method isWithin.
private boolean isWithin(InstanceState state, MouseEvent e) {
Bounds bds = state.getInstance().getBounds();
int cx = bds.getX() + bds.getWidth() / 2;
int cy = bds.getY() + bds.getHeight() / 2;
int dx = e.getX() - cx;
int dy = e.getY() - cy;
return dx * dx + dy * dy <= 60;
}
use of com.cburch.logisim.data.Bounds in project logisim-evolution by reds-heig.
the class ComponentDrawContext method drawRectangle.
public void drawRectangle(Component comp, String label) {
Bounds bds = comp.getBounds(g);
drawRectangle(bds.getX(), bds.getY(), bds.getWidth(), bds.getHeight(), label);
}
use of com.cburch.logisim.data.Bounds in project logisim-evolution by reds-heig.
the class ComponentDrawContext method drawHandles.
public void drawHandles(Component comp) {
Bounds b = comp.getBounds(g);
int left = b.getX();
int right = left + b.getWidth();
int top = b.getY();
int bot = top + b.getHeight();
drawHandle(right, top);
drawHandle(left, bot);
drawHandle(right, bot);
drawHandle(left, top);
}
use of com.cburch.logisim.data.Bounds in project logisim-evolution by reds-heig.
the class ComponentDrawContext method drawRectangle.
public void drawRectangle(ComponentFactory source, int x, int y, AttributeSet attrs, String label) {
Bounds bds = source.getOffsetBounds(attrs);
drawRectangle(source, x + bds.getX(), y + bds.getY(), bds.getWidth(), bds.getHeight(), label);
}
Aggregations