Skip to content

Commit

Permalink
chore: use position instead of margin-left to place defrag hud panels
Browse files Browse the repository at this point in the history
  • Loading branch information
PeenScreeker committed Nov 28, 2023
1 parent a2670f0 commit a78c3fe
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions scripts/hud/cgaz.js
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ class Cgaz {
const leftEdge =
mapAngleToScreenDist(arrowAngle, this.hFov, this.screenX, this.scale, this.projection) -
this.primeArrowSize;
this.primeArrow.style.marginLeft = this.NaNCheck(leftEdge, 0) + 'px';
this.primeArrow.style.position = `${this.NaNCheck(leftEdge, 0)}px 0px 0px`;
this.primeArrow.visible = true;
} else {
this.primeArrow.visible = false;
Expand Down Expand Up @@ -696,7 +696,7 @@ class Cgaz {
const leftEdge =
mapAngleToScreenDist(velocityAngle, this.hFov, this.screenX, this.scale, this.projection) -
this.compassArrowSize;
this.compassArrow.style.marginLeft = this.NaNCheck(leftEdge, 0) + 'px';
this.compassArrow.style.position = `${this.NaNCheck(leftEdge, 0)}px 0px 0px`;
this.compassArrowIcon.style.washColor = getRgbFromRgba(color);
}
this.compassArrow.visible = this.compassMode % 2 && speed >= this.accelMinSpeed;
Expand Down Expand Up @@ -747,7 +747,7 @@ class Cgaz {
const leftEdge =
mapAngleToScreenDist(wTurnAngle, this.hFov, this.screenX, this.scale, this.projection) -
this.windicatorSize;
this.windicatorArrow.style.marginLeft = this.NaNCheck(leftEdge, 0) + 'px';
this.windicatorArrow.style.position = `${this.NaNCheck(leftEdge, 0)}px 0px 0px`;

const minAngle = Math.min(wTurnAngle, 0);
const maxAngle = Math.max(wTurnAngle, 0);
Expand Down Expand Up @@ -1207,8 +1207,8 @@ class Cgaz {
const width = zone.rightPx - zone.leftPx;
zone.style.width = this.NaNCheck(Number(width).toFixed(0), 0) + 'px';

// assign position via margin (center screen at 0)
zone.style.marginLeft = this.NaNCheck(Number(zone.leftPx).toFixed(0), 0) + 'px';
// assign position via position (center screen at 0)
zone.style.position = `${this.NaNCheck(Number(zone.leftPx).toFixed(0), 0)}px 0px 0px`;
}

static zoneCopy(pasteZone, copyZone) {
Expand Down

0 comments on commit a78c3fe

Please sign in to comment.