Better label position on resistors

This commit is contained in:
bancika
2017-05-16 12:56:20 +02:00
parent 1bcb630619
commit ddd634c825
5 changed files with 7 additions and 3 deletions
Binary file not shown.
@@ -179,15 +179,15 @@ public class Resistor extends AbstractLeadedComponent<Resistance> {
@Override @Override
protected int getLabelOffset(int bodyWidth, int labelWidth) { protected int getLabelOffset(int bodyWidth, int labelWidth) {
if (value == null) if (value == null || getColorCode() == ResistorColorCode.NONE)
return 0; return 0;
int width = getClosestOdd(getWidth().convertToPixels()); int width = getClosestOdd(getWidth().convertToPixels());
Color[] bands = value.getColorCode(colorCode); Color[] bands = value.getColorCode(colorCode);
int bandArea = int bandArea =
getShape() == ResistorShape.Standard ? width + FIRST_BAND + BAND_SPACING * (bands.length - 1) : -FIRST_BAND getShape() == ResistorShape.Standard ? width + FIRST_BAND + BAND_SPACING * (bands.length - 1) : -FIRST_BAND
+ BAND_SPACING * (bands.length - 1); + BAND_SPACING * (bands.length - 1);
return (bodyWidth - bandArea - labelWidth) / 2; return bandArea / 2;
} }
@EditableProperty(name = "Reverse (standing)") @EditableProperty(name = "Reverse (standing)")
Binary file not shown.
Binary file not shown.
+4
View File
@@ -1826,6 +1826,10 @@
<changeType>IMPROVEMENT</changeType> <changeType>IMPROVEMENT</changeType>
<description>Increased padding between schematic symbols and their labels</description> <description>Increased padding between schematic symbols and their labels</description>
</org.diylc.appframework.update.Change> </org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change>
<changeType>IMPROVEMENT</changeType>
<description>Better label position on resistors</description>
</org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change> <org.diylc.appframework.update.Change>
<changeType>BUG_FIX</changeType> <changeType>BUG_FIX</changeType>
<description>Auto-save dialog pops up when running multiple instances of the app at the same time</description> <description>Auto-save dialog pops up when running multiple instances of the app at the same time</description>