add row index to bit matrix (#115)
* add row index to bit matrix * reduce padding a bit * fix test Co-authored-by: Joost Wooning <jwooning@gmail.com>main
parent
e73f83bba1
commit
6d07fa48e7
|
@ -19,7 +19,7 @@ configurable in the legend.
|
||||||
const Styles = StyleSheet.create({
|
const Styles = StyleSheet.create({
|
||||||
bit: {
|
bit: {
|
||||||
margin: 0,
|
margin: 0,
|
||||||
padding: 12,
|
padding: 9,
|
||||||
userSelect: 'none',
|
userSelect: 'none',
|
||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
textAlign: 'center',
|
textAlign: 'center',
|
||||||
|
@ -28,6 +28,9 @@ const Styles = StyleSheet.create({
|
||||||
bitSelectedStyle: {
|
bitSelectedStyle: {
|
||||||
backgroundColor: 'rgba(0,119,158,0.5)'
|
backgroundColor: 'rgba(0,119,158,0.5)'
|
||||||
},
|
},
|
||||||
|
byteIndex: {
|
||||||
|
backgroundColor: '#ededed'
|
||||||
|
},
|
||||||
bitSignificance: {
|
bitSignificance: {
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
display: 'block',
|
display: 'block',
|
||||||
|
@ -439,6 +442,9 @@ export default class AddSignals extends Component {
|
||||||
|
|
||||||
for (let i = 0; i < rowCount; i++) {
|
for (let i = 0; i < rowCount; i++) {
|
||||||
const rowBits = [];
|
const rowBits = [];
|
||||||
|
|
||||||
|
rowBits.push(<td key={`rowIndex${i}`} className={css(Styles.bit, Styles.byteIndex)}>{i.toString()}</td>);
|
||||||
|
|
||||||
for (let j = 7; j >= 0; j--) {
|
for (let j = 7; j >= 0; j--) {
|
||||||
const bitIdx = i * 8 + j;
|
const bitIdx = i * 8 + j;
|
||||||
const signal = this.signalForBit(bitIdx);
|
const signal = this.signalForBit(bitIdx);
|
||||||
|
@ -472,7 +478,7 @@ export default class AddSignals extends Component {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
rowBits.push(<td key="hex-repr">{this.byteValueHex(i)}</td>);
|
rowBits.push(<td key="hex-repr" className={css(Styles.bit)}><b>{this.byteValueHex(i)}</b></td>);
|
||||||
rows.push(<tr key={i.toString()}>{rowBits}</tr>);
|
rows.push(<tr key={i.toString()}>{rowBits}</tr>);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue