Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
nilscognite committed Jul 10, 2024
1 parent 9fd6481 commit 8311256
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,12 @@ export class Range3 {
this.z.scaleDelta(value.z);
}

public scale(value: number): void {
this.x.scale(value);
this.y.scale(value);
this.z.scale(value);
}

public add(value: Vector3): void {
this.x.add(value.x);
this.y.add(value.y);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,8 @@ export class AxisThreeView extends GroupThreeView {
}
labelCount += 1;
end.addScaledVector(tickDirection, 2 * tickLength);
const text = incrementToString(tick);

const text = numberToString(dimension === 2 ? -tick : tick);
const sprite = createSpriteWithText(text, tickFontSize, style.textColor);
if (sprite === undefined) {
continue;
Expand Down Expand Up @@ -601,7 +602,7 @@ function getTickDirection(faceIndex1: number, faceIndex2: number, target: Vector
return target;
}

function incrementToString(value: number): string {
function numberToString(value: number): string {
// Sometimes the number comes out like this: 1.20000005 or 1.19999992 due to numeric precision limitations.
// To get better rounded values, I wrote this myself: Multiply by some high integer and round it, then
// convert to text, and insert the comma manually afterwards.
Expand Down

0 comments on commit 8311256

Please sign in to comment.