diff --git a/.eslintrc b/.eslintrc index f9766260c..22f9bd34a 100644 --- a/.eslintrc +++ b/.eslintrc @@ -14,13 +14,19 @@ "__dirname": "readonly", "settingsManager": "writable" }, - "extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"], + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended" + ], "parser": "@typescript-eslint/parser", "parserOptions": { "sourceType": "module", "ecmaVersion": 2021 }, - "plugins": ["@typescript-eslint", "jest"], + "plugins": [ + "@typescript-eslint", + "jest" + ], "rules": { "accessor-pairs": "error", "array-bracket-newline": "error", @@ -37,10 +43,18 @@ "camelcase": "error", "capitalized-comments": "off", "class-methods-use-this": "off", - "comma-dangle": ["error", "always-multiline"], + "comma-dangle": [ + "error", + "always-multiline" + ], "comma-spacing": "error", "comma-style": "error", - "complexity": ["error", { "max": 40 }], // TODO: change to error + "complexity": [ + "error", + { + "max": 40 + } + ], // TODO: change to error "computed-property-spacing": "error", "consistent-return": "error", "consistent-this": "error", @@ -68,25 +82,65 @@ "id-length": "off", "id-match": "error", "implicit-arrow-linebreak": "off", - "indent": ["error", 2, { "SwitchCase": 1 }], - "indent-legacy": ["error", 2, { "SwitchCase": 1 }], + "indent": [ + "error", + 2, + { + "SwitchCase": 1 + } + ], + "indent-legacy": [ + "error", + 2, + { + "SwitchCase": 1 + } + ], "init-declarations": "off", "jsx-quotes": "error", "key-spacing": "error", - "keyword-spacing": "error", + "keyword-spacing": "off", "line-comment-position": "off", - "linebreak-style": ["error", "unix"], + "linebreak-style": [ + "error", + "unix" + ], "lines-around-comment": "off", "lines-around-directive": "error", "lines-between-class-members": "off", "max-classes-per-file": "error", "max-depth": "warn", // TODO: change to error - "max-len": ["warn", { "code": 180 }], // TODO: change to error - "max-lines": ["warn", { "max": 1000 }], // TODO: change to error - "max-lines-per-function": ["error", { "max": 300 }], + "max-len": [ + "warn", + { + "code": 180 + } + ], // TODO: change to error + "max-lines": [ + "warn", + { + "max": 1000 + } + ], // TODO: change to error + "max-lines-per-function": [ + "error", + { + "max": 300 + } + ], "max-nested-callbacks": "error", - "max-params": ["warn", { "max": 8 }], // TODO: change to error - "max-statements": ["warn", { "max": 85 }], // TODO: change to error + "max-params": [ + "warn", + { + "max": 8 + } + ], // TODO: change to error + "max-statements": [ + "warn", + { + "max": 85 + } + ], // TODO: change to error "max-statements-per-line": "error", "multiline-comment-style": "warn", // TODO: change to error "multiline-ternary": "off", @@ -172,7 +226,12 @@ "no-template-curly-in-string": "error", "no-ternary": "off", "no-throw-literal": "error", - "no-trailing-spaces": ["error", { "ignoreComments": true }], + "no-trailing-spaces": [ + "error", + { + "ignoreComments": true + } + ], "no-undef-init": "error", "no-undefined": "error", "no-underscore-dangle": "off", @@ -218,7 +277,10 @@ "prefer-spread": "error", "prefer-template": "error", "quote-props": "off", - "quotes": ["error", "single"], + "quotes": [ + "error", + "single" + ], "radix": "off", "require-atomic-updates": "error", "require-await": "warn", // TODO: change to errors @@ -251,4 +313,4 @@ "yoda": "error", "@typescript-eslint/no-explicit-any": "warn" } -} +} \ No newline at end of file diff --git a/src/plugins/polar-plot/polar-plot.ts b/src/plugins/polar-plot/polar-plot.ts index 64279be86..0eb889544 100644 --- a/src/plugins/polar-plot/polar-plot.ts +++ b/src/plugins/polar-plot/polar-plot.ts @@ -14,6 +14,8 @@ export class PolarPlotPlugin extends KeepTrackPlugin { static readonly PLUGIN_NAME = 'Polar Plot'; dependencies = [SelectSatManager.PLUGIN_NAME]; private selectSatManager_: SelectSatManager; + passStartTime_: Date; + passStopTime_: Date; constructor() { super(PolarPlotPlugin.PLUGIN_NAME); @@ -120,16 +122,24 @@ export class PolarPlotPlugin extends KeepTrackPlugin { } private generatePlotData_(): boolean { + this.passStartTime_ = null; + this.passStopTime_ = null; + const sensor = keepTrackApi.getSensorManager().getSensor(); const sat = this.selectSatManager_.getSelectedSat() as DetailedSatellite; let isSomethingInView = false; this.plotData_ = []; + let now: Date = null; + for (let i = 0; i < secondsPerDay * 3; i++) { - const now = keepTrackApi.getTimeManager().getOffsetTimeObj(i * MILLISECONDS_PER_SECOND); + now = keepTrackApi.getTimeManager().getOffsetTimeObj(i * MILLISECONDS_PER_SECOND); const inView = sensor.isSatInFov(sat, now); if (inView) { + if (!this.passStartTime_) { + this.passStartTime_ = now; + } const rae = sensor.rae(sat, now); this.plotData_.push([rae.az, rae.el]); @@ -139,6 +149,8 @@ export class PolarPlotPlugin extends KeepTrackPlugin { } } + this.passStopTime_ = now; + return isSomethingInView; } @@ -147,6 +159,16 @@ export class PolarPlotPlugin extends KeepTrackPlugin { this.drawPlotBackground_(); this.drawOrbitLine_(); this.drawStartAndEnd_(); + this.drawTitle_(); + } + + private drawTitle_(): void { + this.ctx_.font = `${this.canvasSize_ * 0.035}px consolas`; + this.ctx_.fillStyle = 'rgb(255, 255, 255)'; + this.ctx_.textAlign = 'center'; + this.ctx_.textBaseline = 'top'; + this.ctx_.fillText(`Satellite ${(this.selectSatManager_.getSelectedSat()).sccNum}: ` + + `${this.passStartTime_.toISOString().slice(11, 19)} - ${this.passStopTime_.toISOString().slice(11, 19)}`, this.centerX_, 0); } private setupCanvas_() {