diff --git a/src/main/angular/src/app/Unit.ts b/src/main/angular/src/app/Unit.ts index 9d8e2ba..56b290b 100644 --- a/src/main/angular/src/app/Unit.ts +++ b/src/main/angular/src/app/Unit.ts @@ -19,8 +19,7 @@ export class Unit { constructor( readonly unit: string, - readonly locale: string, - ) { + readonly locale: string) { // - } @@ -43,6 +42,11 @@ export class Unit { this._divisor = Math.pow(10, exponentFromGroup); } + updateAndApplyPrefixUnit(value: number): string { + this.update(value); + return this.applyPrefixUnit(value); + } + applyPrefixUnit(value: number): string { return applyPrefixUnit(value, this.unit, this.divisor, this.prefix, 2, this.locale); } diff --git a/src/main/angular/src/app/app.component.html b/src/main/angular/src/app/app.component.html index a9cf3fe..5149855 100644 --- a/src/main/angular/src/app/app.component.html +++ b/src/main/angular/src/app/app.component.html @@ -1,5 +1,5 @@ - diff --git a/src/main/angular/src/app/solar-system/solar-system.component.ts b/src/main/angular/src/app/solar-system/solar-system.component.ts index 66e6626..1b3d764 100644 --- a/src/main/angular/src/app/solar-system/solar-system.component.ts +++ b/src/main/angular/src/app/solar-system/solar-system.component.ts @@ -1,9 +1,10 @@ import {Component, Inject, LOCALE_ID, OnInit} from '@angular/core'; import {DecimalPipe, NgForOf} from "@angular/common"; import {FormsModule} from "@angular/forms"; -import {MIO_KM, SolarSystemBody} from "./SolarSystemBody"; -import {BODIES, JUPITER} from "./SOLAR_SYSTEM"; +import {MIO_KILO, SolarSystemBody} from "./SolarSystemBody"; +import {BODIES, JUPITER, JUPITER_SCALED_DIAMETER} from "./SOLAR_SYSTEM"; import {applyPrefixUnit, Unit} from "../Unit"; +import {RouterLink} from "@angular/router"; @Component({ selector: 'app-solar-system', @@ -12,6 +13,7 @@ import {applyPrefixUnit, Unit} from "../Unit"; NgForOf, DecimalPipe, FormsModule, + RouterLink, ], templateUrl: './solar-system.component.html', styleUrl: './solar-system.component.less' @@ -22,7 +24,7 @@ export class SolarSystemComponent implements OnInit { protected readonly BODIES = BODIES; - protected readonly MIO_KM = MIO_KM; + protected readonly MIO_KM = MIO_KILO; protected readonly diameterUnit: Unit; @@ -40,7 +42,7 @@ export class SolarSystemComponent implements OnInit { } ngOnInit() { - this.pivot.scaledDiameter = 0.18; + this.pivot.scaledDiameter = JUPITER_SCALED_DIAMETER; this.update(); }