mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-16 08:25:09 -04:00
fixed the label position in the relay shapes
This commit is contained in:
parent
6525256813
commit
ded9976b92
@ -69,6 +69,19 @@ public interface Graphic extends Closeable {
|
||||
*/
|
||||
void drawText(VectorInterface p1, VectorInterface p2, String text, Orientation orientation, Style style);
|
||||
|
||||
/**
|
||||
* Helper to draw a horizontal left to right text
|
||||
*
|
||||
* @param g the Graphic instance to draw to
|
||||
* @param pos the text position
|
||||
* @param text the text
|
||||
* @param orientation the text orientation
|
||||
* @param style the text style
|
||||
*/
|
||||
static void drawText(Graphic g, VectorInterface pos, String text, Orientation orientation, Style style) {
|
||||
g.drawText(pos, pos.add(new Vector(1, 0)), text, orientation, style);
|
||||
}
|
||||
|
||||
/**
|
||||
* opens a new group, used to create SVG grouping
|
||||
*/
|
||||
@ -91,7 +104,6 @@ public interface Graphic extends Closeable {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* closes the graphics instance
|
||||
*
|
||||
|
@ -111,6 +111,6 @@ public class RelayDTShape implements Shape {
|
||||
graphic.drawLine(new Vector(SIZE + SIZE2, -SIZE * 2), new Vector(SIZE * 2, -SIZE * 2), Style.NORMAL);
|
||||
|
||||
if (label != null && label.length() > 0)
|
||||
graphic.drawText(new Vector(SIZE, 4), new Vector(SIZE * 2, 4), label, Orientation.CENTERTOP, Style.SHAPE_PIN);
|
||||
Graphic.drawText(graphic, new Vector(SIZE, -SIZE * 3 - 4), label, Orientation.CENTERBOTTOM, Style.SHAPE_PIN);
|
||||
}
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ public class RelayShape implements Shape {
|
||||
graphic.drawLine(new Vector(SIZE + SIZE2, -SIZE * 2), new Vector(SIZE * 2, -SIZE * 2), Style.NORMAL);
|
||||
|
||||
if (label != null && label.length() > 0)
|
||||
graphic.drawText(new Vector(SIZE, 4), new Vector(SIZE * 2, 4), label, Orientation.CENTERTOP, Style.SHAPE_PIN);
|
||||
Graphic.drawText(graphic, new Vector(SIZE, -SIZE * 3 - 4), label, Orientation.CENTERBOTTOM, Style.SHAPE_PIN);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user