mirror of https://github.com/espruino/BangleApps
Update app.js for new resistor img position
parent
0c2244eb5a
commit
114b8c7f63
|
@ -83,7 +83,7 @@ function colorBandsToResistance(colorBands) {
|
||||||
let firstBand = colorBands[0];
|
let firstBand = colorBands[0];
|
||||||
let secondBand = colorBands[1];
|
let secondBand = colorBands[1];
|
||||||
let multiplierBand = colorBands[2];
|
let multiplierBand = colorBands[2];
|
||||||
let toleranceBand = colorBands[3] || 'none'; // Add a default value for toleranceBand
|
let toleranceBand = colorBands[3] || 'none'; // Add a default value for toleranceBand
|
||||||
let significantDigits = colorData[firstBand].value * 10 + colorData[secondBand].value;
|
let significantDigits = colorData[firstBand].value * 10 + colorData[secondBand].value;
|
||||||
let multiplier = colorData[multiplierBand].multiplier;
|
let multiplier = colorData[multiplierBand].multiplier;
|
||||||
let resistance = significantDigits * multiplier;
|
let resistance = significantDigits * multiplier;
|
||||||
|
@ -134,7 +134,7 @@ function drawResistor(colorBands, tolerance) {
|
||||||
var numcolorBands = bandColors.length;
|
var numcolorBands = bandColors.length;
|
||||||
var resistorStartY = ((g.getHeight() - resistorBodyHeight) / 2) + 48;
|
var resistorStartY = ((g.getHeight() - resistorBodyHeight) / 2) + 48;
|
||||||
clearScreen();
|
clearScreen();
|
||||||
g.drawImage(img, 0, 48);
|
g.drawImage(img, 0, 112);
|
||||||
var bandWidth = (resistorBodyWidth - (numcolorBands * 2 - 1)) / numcolorBands; // width of each band, accounting for the spacing
|
var bandWidth = (resistorBodyWidth - (numcolorBands * 2 - 1)) / numcolorBands; // width of each band, accounting for the spacing
|
||||||
var bandHeight = resistorBodyHeight; // height of each band
|
var bandHeight = resistorBodyHeight; // height of each band
|
||||||
var currentX = resistorStartX; // starting point for the first band
|
var currentX = resistorStartX; // starting point for the first band
|
||||||
|
@ -453,7 +453,7 @@ function drawResistance(resistance, tolerance) {
|
||||||
showDrawingMenu();
|
showDrawingMenu();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function showResistanceEntryMenu() {
|
function showResistanceEntryMenu() {
|
||||||
// Update the 'Ohms' field
|
// Update the 'Ohms' field
|
||||||
resistanceEntryMenu['Ohms'].value = settings.resistance;
|
resistanceEntryMenu['Ohms'].value = settings.resistance;
|
||||||
|
@ -474,7 +474,7 @@ function drawResistance(resistance, tolerance) {
|
||||||
|
|
||||||
E.showMenu(resistanceEntryMenu);
|
E.showMenu(resistanceEntryMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
function showDrawingMenu() {
|
function showDrawingMenu() {
|
||||||
let drawingMenu = {
|
let drawingMenu = {
|
||||||
'': {
|
'': {
|
||||||
|
@ -508,4 +508,4 @@ function drawResistance(resistance, tolerance) {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
E.showMenu(mainMenu);
|
E.showMenu(mainMenu);
|
||||||
})(load);
|
})();
|
||||||
|
|
Loading…
Reference in New Issue