mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-07 12:24:58 +10:00
label offset fixes
This commit is contained in:
@@ -127,7 +127,7 @@ public abstract class AbstractMakerBoard extends AbstractTransparentComponent<Vo
|
||||
public static Font SILK_FONT_SMALL = new Font("SansSerif", Font.PLAIN, 10);
|
||||
public static Font SILK_FONT = new Font("SansSerif", Font.BOLD, 11);
|
||||
public static Font SILK_FONT_LARGE = new Font("SansSerif", Font.BOLD, 13);
|
||||
public static Size PIN_LABEL_OFFSET = new Size(1.8d, SizeUnit.mm);
|
||||
public static Size PIN_LABEL_OFFSET = new Size(1.6d, SizeUnit.mm);
|
||||
public static Size PIN_ROW_LABEL_OFFSET = new Size(2.0d, SizeUnit.mm);
|
||||
public static Font PIN_FONT = new Font("SansSerif", Font.PLAIN, 8);
|
||||
// labels along a row run across the board rather than down a column of pins, so they can afford
|
||||
@@ -279,14 +279,6 @@ public abstract class AbstractMakerBoard extends AbstractTransparentComponent<Vo
|
||||
return getDisplayPinLabel(getControlPointNodeName(index));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gap between a pad and the name printed next to it. Boards that silkscreen their pad names
|
||||
* tighter than the Arduino convention override this.
|
||||
*/
|
||||
protected Size getPinLabelOffset() {
|
||||
return PIN_LABEL_OFFSET;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to draw rotated control point / pin names next to the pins for dual-row DIP/header boards.
|
||||
*
|
||||
@@ -316,7 +308,7 @@ public abstract class AbstractMakerBoard extends AbstractTransparentComponent<Vo
|
||||
protected void drawPinLabels(Graphics2D g2d, double x, double y, double[][] offsets,
|
||||
int pinsPerRow, Color silkColor) {
|
||||
if (offsets == null || offsets.length == 0) return;
|
||||
double labelOffset = getPinLabelOffset().convertToPixels();
|
||||
double labelOffset = PIN_LABEL_OFFSET.convertToPixels();
|
||||
|
||||
g2d.setColor(silkColor);
|
||||
g2d.setFont(PIN_FONT);
|
||||
|
||||
@@ -84,9 +84,6 @@ public class Teensy extends AbstractMakerBoard {
|
||||
public static Color PAD_COLOR = GOLD_COLOR;
|
||||
public static Size HOLE_SIZE = new Size(0.7d, SizeUnit.mm);
|
||||
|
||||
// PJRC prints the pad names tighter to the pads than the Arduino boards do
|
||||
public static Size SILK_LABEL_OFFSET = new Size(1.6d, SizeUnit.mm);
|
||||
|
||||
// ===== Teensy 4.0 dimensions (PJRC dimensions_teensy40.png) =====
|
||||
// 35.56 mm x 17.78 mm (1.4" x 0.7")
|
||||
public static Size BOARD_WIDTH_40 = new Size(17.78d, SizeUnit.mm);
|
||||
@@ -301,11 +298,6 @@ public class Teensy extends AbstractMakerBoard {
|
||||
return super.getSilkPinLabel(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Size getPinLabelOffset() {
|
||||
return SILK_LABEL_OFFSET;
|
||||
}
|
||||
|
||||
private double[][] getRelativeOffsets() {
|
||||
double spacing = PIN_SPACING.convertToPixels();
|
||||
double rowSpacing = ROW_SPACING.convertToPixels();
|
||||
|
||||
@@ -534,7 +534,7 @@ public class ESP32DevKitTest {
|
||||
Assert.assertNotNull(ESP32DevKit.PIN_LABEL_OFFSET);
|
||||
Assert.assertNotNull(ESP32DevKit.PIN_FONT);
|
||||
Assert.assertEquals(8, ESP32DevKit.PIN_FONT.getSize());
|
||||
Assert.assertEquals(1.8d, ESP32DevKit.PIN_LABEL_OFFSET.getValue(), 0.001);
|
||||
Assert.assertEquals(1.6d, ESP32DevKit.PIN_LABEL_OFFSET.getValue(), 0.001);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+1
-1
@@ -206,6 +206,6 @@ public class ESP8266NodeMCUTest {
|
||||
Assert.assertNotNull(ESP8266NodeMCU.PIN_LABEL_OFFSET);
|
||||
Assert.assertNotNull(ESP8266NodeMCU.PIN_FONT);
|
||||
Assert.assertEquals(8, ESP8266NodeMCU.PIN_FONT.getSize());
|
||||
Assert.assertEquals(1.8d, ESP8266NodeMCU.PIN_LABEL_OFFSET.getValue(), 0.001);
|
||||
Assert.assertEquals(1.6d, ESP8266NodeMCU.PIN_LABEL_OFFSET.getValue(), 0.001);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user