fix rectangle blurriness on retina screens

This commit is contained in:
Scott Bell 2023-05-09 11:44:09 +02:00
parent 6b2adcb7b7
commit 09df2f64f2

View File

@ -74,6 +74,12 @@ export default {
mounted() {
this.canvas = this.$refs.canvas;
this.context = this.canvas.getContext("2d");
// adjust canvas size for retina displays
const scale = window.devicePixelRatio;
this.canvas.width = Math.floor(this.canvas.width * scale);
this.canvas.height = Math.floor(this.canvas.height * scale);
this.keyString = this.openmct.objects.makeKeyString(this.domainObject.identifier);
this.openmct.selection.on('change', this.updateSelection);
this.buildAnnotationIndex();
@ -149,7 +155,7 @@ export default {
},
drawRectInCanvas(rectangle, fillStyle, strokeStyle) {
this.context.beginPath();
this.context.lineWidth = "1";
this.context.lineWidth = 1;
this.context.fillStyle = fillStyle;
this.context.strokeStyle = strokeStyle;
this.context.rect(rectangle.x, rectangle.y, rectangle.width, rectangle.height);