fix messagebyte size on high dpi screens

main
Joost Wooning 2022-02-17 11:25:49 +01:00
parent 125a6ebbf6
commit a7be1cf2ef
1 changed files with 3 additions and 5 deletions

View File

@ -37,7 +37,7 @@ export default class MessageBytes extends Component {
rowCount = Math.ceil(DbcUtils.maxMessageSize(this.props.message, this.state.maxMessageBytes) / 8);
}
if (this.canvas) {
this.canvas.height = rowCount * 15 * window.devicePixelRatio;
this.canvas.height = rowCount * 15;
}
}
@ -132,16 +132,14 @@ export default class MessageBytes extends Component {
if (!ref) return;
this.canvas = ref;
this.canvas.width = 160 * window.devicePixelRatio;
this.canvas.width = 160;
let rowCount;
if (this.props.message.frame && this.props.message.frame.size) {
rowCount = Math.ceil(this.props.message.frame.size / 8);
} else {
rowCount = Math.ceil(DbcUtils.maxMessageSize(this.props.message, this.state.maxMessageBytes) / 8);
}
this.canvas.height = rowCount * 15 * window.devicePixelRatio;
const ctx = this.canvas.getContext('2d');
ctx.scale(window.devicePixelRatio, window.devicePixelRatio);
this.canvas.height = rowCount * 15;
}
render() {