Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[Simulator] Implement PB.showNumberAtDigit() to display numbers right…

…-aligning on display
  • Loading branch information...
commit 3bbd4c0e6a638d5963f5c2e33deb4ec0202e102e 1 parent 11ebb8a
@lpereira lpereira authored
Showing with 12 additions and 0 deletions.
  1. +12 −0 simulador/pensebem.js
View
12 simulador/pensebem.js
@@ -764,6 +764,18 @@ PB = {
PB.setSegment(i, "abcdefg"[segment - 1], state[segment - 1]);
}
},
+ showNumberAtDigit: function(n, d) {
+ if (n < 10) {
+ PB.setDigit(d, n);
+ } else if (n < 100) {
+ PB.setDigit(d, n % 10);
+ n = Math.round(n / 10);
+ PB.setDigit(d - 1, n % 10);
+ } else {
+ PB.setDigit(d, n % 10);
+ PB.showNumberAtDigit(Math.round(n / 10), d - 1);
+ }
+ },
setSpecialDigit: function(c) {
if (c in PB.FontTable) {
PB.setDigit(3, c);
Please sign in to comment.
Something went wrong with that request. Please try again.