From cdc115e9baecbd723d655629641e92ee24617155 Mon Sep 17 00:00:00 2001 From: JAGFx Date: Sun, 13 Mar 2022 12:14:21 +0100 Subject: [PATCH] :bug: [feat/rework-scania] #78 finalizing somme adjustment on skins --- lib/config/config.json | 4 +- src/assets/scss/dashboard/_default.scss | 44 +++++--------- .../scss/dashboard/scania/_display.scss | 2 +- src/assets/scss/dashboard/shared/_map.scss | 19 +++--- src/assets/scss/menu/_menu-tab-about.scss | 2 + .../dashboards/DefaultDashboard.vue | 20 +++---- .../dashboards/jagfx/Zone/JagfxJob.vue | 18 ++++-- .../dashboards/jagfx/Zone/JagfxTruck.vue | 34 +++++++---- .../scania/display/ScaniaDisplay.vue | 8 ++- src/components/dashboards/shared/Map.vue | 37 +++++++----- src/components/menu/MenuTabAbout.vue | 2 +- src/model/telemetry-truck.model.js | 6 +- src/utils/_app.js | 10 +++- src/utils/_map.js | 59 +++++++++++-------- 14 files changed, 152 insertions(+), 113 deletions(-) diff --git a/lib/config/config.json b/lib/config/config.json index 98db3c11..55baeaf4 100644 --- a/lib/config/config.json +++ b/lib/config/config.json @@ -1,8 +1,8 @@ { "general_refresh_rate" : 100, - "general_skin_on_load" : "Scania", + "general_skin_on_load" : "Map", "general_h-shift-layout" : "h-shifter", - "general_skin_locale" : "fr-FR", + "general_skin_locale" : "en-EN", "general_job_remaining" : "due_date", "general_port": 3000, "general_damage_accurate": "damage-diagnostic" diff --git a/src/assets/scss/dashboard/_default.scss b/src/assets/scss/dashboard/_default.scss index 33ce567f..823ca401 100644 --- a/src/assets/scss/dashboard/_default.scss +++ b/src/assets/scss/dashboard/_default.scss @@ -332,35 +332,21 @@ // color: coral; //} - ._truckWearInfo { - font-family: Arial, Helvetica, sans-serif; - font-size: 26px; - position: absolute; - left: 1600px; - top: 1066px; - width: 330px; - height: 30px; - text-align: left; - color: #aaa; - line-height: 90%; - } - - ._trailerWearInfo { - font-family: Arial, Helvetica, sans-serif; - font-size: 26px; + .wears { position: absolute; - left: 1600px; - top: 1066px; - width: 330px; - height: 30px; - text-align: left; - color: #aaa; - line-height: 90%; - left: 1810px; - } - - .truck-wearSum, .trailer-wear { - font-size: 44px; - color: orangered; + right: 0; + bottom: 0; + width: 43rem; + + .info { + font-family: Arial, Helvetica, sans-serif; + font-size: 26px; + color: #aaa; + } + + .wear { + font-size: 2.3rem; + color: orangered; + } } } diff --git a/src/assets/scss/dashboard/scania/_display.scss b/src/assets/scss/dashboard/scania/_display.scss index 74d22651..ff3fd7dd 100644 --- a/src/assets/scss/dashboard/scania/_display.scss +++ b/src/assets/scss/dashboard/scania/_display.scss @@ -69,7 +69,7 @@ > i { line-height: 0; } } - .value{ font-size: 2rem; line-height: 2rem; font-weight: bold;} + .value{ font-size: 2.7rem; line-height: 2rem;} .value { color: $cGreen; } .unit{ font-size: 1.5rem; line-height: 1.5rem;} } diff --git a/src/assets/scss/dashboard/shared/_map.scss b/src/assets/scss/dashboard/shared/_map.scss index b4788bf6..5d746922 100644 --- a/src/assets/scss/dashboard/shared/_map.scss +++ b/src/assets/scss/dashboard/shared/_map.scss @@ -55,7 +55,7 @@ justify-content: center; align-items: center; outline: 0; - font-size: 1.1rem; + font-size: 1.9rem; border: 2px solid $cRed; border-width: 0 0 2px 0; @@ -95,8 +95,8 @@ border-left-color: transparent !important; } - &.fuel { min-width: 5rem !important; } - &.cruise-control { min-width: 8rem !important; } + &.fuel { min-width: 10rem !important; } + &.cruise-control { min-width: 13rem !important; } &.menuControl { border-width: 0 2px 2px 0; @@ -122,7 +122,8 @@ justify-content: center; align-items: center; outline: 0; - font-size: 1.1rem; + font-size: 1.9rem; + font-size: 1.9rem; border-right: 2px solid $cRed; @@ -150,7 +151,7 @@ height: auto; width: auto; z-index: 2; - margin-bottom: 2.2rem; + margin-bottom: 3rem; #ol-zoom-wrapper { width: 100%; @@ -168,7 +169,7 @@ justify-content: center; align-items: center; outline: 0; - font-size: 1.1rem; + font-size: 1.9rem; border-right: 2px solid $cRed; @@ -187,7 +188,7 @@ left: 0; width: auto; bottom: 0; - margin-bottom: 2.2rem; + margin-bottom: 3rem; .button{ border-left: 2px solid $cRed; @@ -266,7 +267,7 @@ height: auto; padding: .3rem; z-index: 1; - width: 9.5rem; + width: 11rem; border-right: 0; } @@ -291,7 +292,7 @@ height: inherit; font-weight: bold; font-size: 1.5rem; - width: 3.3rem; + width: 3.5rem; &.hshifter { &:first-letter{ diff --git a/src/assets/scss/menu/_menu-tab-about.scss b/src/assets/scss/menu/_menu-tab-about.scss index d73b5ef1..420a7247 100644 --- a/src/assets/scss/menu/_menu-tab-about.scss +++ b/src/assets/scss/menu/_menu-tab-about.scss @@ -87,6 +87,8 @@ z-index: 0; width: 100vw; height: 100vh; + max-width: inherit; + min-width: inherit; @include prefixer(object-fit, cover, ("webkit", "moz", "o")); } diff --git a/src/components/dashboards/DefaultDashboard.vue b/src/components/dashboards/DefaultDashboard.vue index 51d81ab9..528942f6 100644 --- a/src/components/dashboards/DefaultDashboard.vue +++ b/src/components/dashboards/DefaultDashboard.vue @@ -186,18 +186,16 @@ -
-
- {{ $t('Truck wear') }}:
- {{ telemetry.truck.averageDamage }}% +
+
+ {{ $t('Truck wear') }}: + {{ telemetry2.truck.averageDamage }}%
-
- {{ $t('Trailer damage') }}:
- {{ telemetry2.trailer.chassisDamage.toFixed(0) }}% +
+ {{ $t('Trailer damage') }}: + + {{ telemetry2.trailer.chassisDamage.toFixed(0) }}% +
diff --git a/src/components/dashboards/jagfx/Zone/JagfxJob.vue b/src/components/dashboards/jagfx/Zone/JagfxJob.vue index 965ea9a8..9278ec65 100644 --- a/src/components/dashboards/jagfx/Zone/JagfxJob.vue +++ b/src/components/dashboards/jagfx/Zone/JagfxJob.vue @@ -8,7 +8,8 @@
- {{ $t('N/A') }} + + {{ $t('N/A') }} {{ telemetry2.job.departureCityName }}
- {{ $t('N/A') }} + + {{ $t('N/A') }} {{ telemetry2.job.arrivalCityName }}
+ - {{ $t('N/A') }} + + {{ $t('N/A') }} {{ telemetry2.job.income }} {{ $unitReadable('unit_currency') }} @@ -77,7 +81,8 @@ - + + {{ $t('N/A') }} {{ telemetry2.navigation.distanceToTargetString }} @@ -86,7 +91,8 @@
- {{ $t('N/A') }} + + {{ $t('N/A') }} {{ telemetry2.job.cargoWeightString }} diff --git a/src/components/dashboards/jagfx/Zone/JagfxTruck.vue b/src/components/dashboards/jagfx/Zone/JagfxTruck.vue index fe53501b..51c35e05 100644 --- a/src/components/dashboards/jagfx/Zone/JagfxTruck.vue +++ b/src/components/dashboards/jagfx/Zone/JagfxTruck.vue @@ -40,13 +40,23 @@ disabled: !telemetry2.symbols.cruiseControlIsEnabled }" > - {{ - $t('OFF') - }} - + {{ $t('OFF') }} + {{ telemetry2.truck.cruiseControlSpeed }} {{ $unitReadable('unit_speed') }} +
@@ -65,7 +75,7 @@ {{ telemetry2.truck.fuelLevel.toFixed(0) }} {{ $unitReadable('unit_volume') }}
- -- {{ $unitReadable('unit_volume') }} +
@@ -81,7 +91,7 @@ {{ telemetry2.truck.fuelAverageConsumption.toFixed(1) }} {{ $unitReadable('unit_consumption') }}
- -- {{ $unitReadable('unit_consumption') }} +
@@ -96,7 +106,7 @@ in {{ $nextRestStopFormater(telemetry2.navigation.nextRestStopTime) }} - -- +
@@ -116,7 +126,7 @@ {{ telemetry2.truck.brakeAirPressure.toFixed(0) }} {{ $unitReadable('unit_pressure') }}
- -- {{ $unitReadable('unit_pressure') }} +
@@ -132,7 +142,7 @@ {{ telemetry2.truck.engineOilTemperature.toFixed(1) }} {{ $unitReadable('unit_degrees') }}
- -- {{ $unitReadable('unit_degrees') }} +
@@ -148,7 +158,7 @@ {{ telemetry2.truck.brakeTemperature.toFixed(1) }} {{ $unitReadable('unit_degrees') }}
- -- {{ $unitReadable('unit_degrees') }} +
@@ -167,7 +177,7 @@ {{ telemetry2.truck.engineWaterTemperature.toFixed(1) }} {{ $unitReadable('unit_degrees') }}
- -- {{ $unitReadable('unit_degrees') }} +
@@ -185,7 +195,7 @@ {{ Math.round(telemetry2.truck.batteryVoltage) }} V - -- V +
diff --git a/src/components/dashboards/scania/display/ScaniaDisplay.vue b/src/components/dashboards/scania/display/ScaniaDisplay.vue index dd58d34c..1fc903fe 100644 --- a/src/components/dashboards/scania/display/ScaniaDisplay.vue +++ b/src/components/dashboards/scania/display/ScaniaDisplay.vue @@ -31,7 +31,9 @@ class="programmable-field-1 w-100 d-flex justify-content-around align-items-center" >
-
+
-
+
import TelemetryMixin from '@/mixins/TelemetryMixin'; -import { store as telemetryStore } from '@/store/telemetry.store'; -import { history, map } from '@/utils/utils'; +import { HTY_LEVEL, HTY_ZONE } from '@/utils/_history'; +import * as map from '@/utils/_map'; import { mapGetters } from 'vuex'; export default { @@ -296,23 +296,30 @@ export default { ...mapGetters({ configEnabled: 'config/enabled' }), - m: () => map.d + m: () => map.d, + mapData() { + return { + x: this.telemetry2.truck.positionX, + z: this.telemetry2.truck.positionY, + orientation: this.telemetry2.truck.orientation, + speed: this.telemetry2.truck.speed + }; + } }, watch: { - telemetry(newTelemetry) { - if (this.ready) { - map.updatePlayerPositionAndRotation( - newTelemetry.truck.position.X, - newTelemetry.truck.position.Z, - newTelemetry.truck.orientation.heading, - newTelemetry.truck.speed.kph - ); + mapData: { + deep: true, + immediate: true, + handler() { + if (this.ready) { + map.triggerMapUpdate(); + } } } }, - created() { + mounted() { map - .init(telemetryStore.model.gameName) + .init(this.telemetry2.gameName) .then(() => { this.ready = true; this.rotateWithPlayer = map.d.gBehaviorRotateWithPlayer; @@ -327,8 +334,8 @@ export default { this.$pushALog( `Unknown error: ${errorMessage}`, - history.HTY_ZONE.MAPS_INIT, - history.HTY_LEVEL.ERROR + HTY_ZONE.MAPS_INIT, + HTY_LEVEL.ERROR ); }); }, diff --git a/src/components/menu/MenuTabAbout.vue b/src/components/menu/MenuTabAbout.vue index 0bd1910f..cc80a1e6 100644 --- a/src/components/menu/MenuTabAbout.vue +++ b/src/components/menu/MenuTabAbout.vue @@ -4,7 +4,7 @@ gameID === GAME_ID_ATS; export const gameIsETS2 = (gameID) => gameID === GAME_ID_ETS2; export const betweenFloat = (data, a, b) => { - return parseFloat(data) >= a && parseFloat(data) <= b; + return greaterOrEqualThanFloat(data, a) && lessOrEqualThanFloat(data, b); +}; + +export const greaterOrEqualThanFloat = (data, a) => { + return parseFloat(data) >= a; +}; + +export const lessOrEqualThanFloat = (data, a) => { + return parseFloat(data) <= a; }; export const pushLog = (message, zone, level = history.HTY_LEVEL.INFO) => { diff --git a/src/utils/_map.js b/src/utils/_map.js index b8f6a726..d391dba2 100644 --- a/src/utils/_map.js +++ b/src/utils/_map.js @@ -8,7 +8,12 @@ import store from '@/store/index'; import { store as telemetryStore } from '@/store/telemetry.store'; -import { app, history, map } from '@/utils/utils'; +import { + betweenFloat, + greaterOrEqualThanFloat, + lessOrEqualThanFloat +} from '@/utils/_app'; +import { HTY_LEVEL, HTY_ZONE } from '@/utils/_history'; import axios from 'axios'; import { Feature } from 'ol'; import { defaults as defaultControls } from 'ol/control'; @@ -76,7 +81,7 @@ const basePath = (game) => { Vue.prototype.$pushALog( `Base path: ${path} | Type: ${type} | Tile version: ${tilesVersion} | Custom tiles host: ${tilesRemoteUseCustom}`, - history.HTY_ZONE.MAPS_INIT + HTY_ZONE.MAPS_INIT ); return `${path}`; @@ -92,7 +97,7 @@ const initConfig = (game) => { return axios.get(d.paths.base + d.paths.config).then( (response) => { d.config = response.data; - Vue.prototype.$pushALog(`Map config found`, history.HTY_ZONE.MAPS_INIT); + Vue.prototype.$pushALog(`Map config found`, HTY_ZONE.MAPS_INIT); const tilesPath = d.paths.tiles.replace(/{[xyz]}/g, 0); @@ -100,15 +105,15 @@ const initConfig = (game) => { () => { Vue.prototype.$pushALog( `Tiles OK: ${d.paths.base + tilesPath}`, - history.HTY_ZONE.MAPS_INIT + HTY_ZONE.MAPS_INIT ); d.gBehaviorRotateWithPlayer = rotateWithPlayer; }, () => { Vue.prototype.$pushALog( `Tiles NOT FOUND`, - history.HTY_ZONE.MAPS_INIT, - history.HTY_LEVEL.ERROR + HTY_ZONE.MAPS_INIT, + HTY_LEVEL.ERROR ); throw new Error('Cant get tiles - Tiles NOT FOUND'); } @@ -117,8 +122,8 @@ const initConfig = (game) => { () => { Vue.prototype.$pushALog( `Map config NOT FOUND`, - history.HTY_ZONE.MAPS_INIT, - history.HTY_LEVEL.ERROR + HTY_ZONE.MAPS_INIT, + HTY_LEVEL.ERROR ); throw new Error('Cant get config - Map config NOT FOUND'); } @@ -192,22 +197,24 @@ const initMap = () => { }); }; -const init = (game) => { - return initConfig(game) +const init = () => { + return initConfig(telemetryStore.model.gameName) .then(() => initMap()) .then(() => (d.ready = true)) - .then(() => { - map.updatePlayerPositionAndRotation( - telemetryStore.telemetry.truck.position.X, - telemetryStore.telemetry.truck.position.Z, - telemetryStore.telemetry.truck.orientation.heading, - telemetryStore.telemetry.truck.speed.kph - ); - }); + .then(triggerMapUpdate); }; // ---- +const triggerMapUpdate = () => { + updatePlayerPositionAndRotation( + telemetryStore.model.truck.positionX, + telemetryStore.model.truck.positionY, + telemetryStore.model.truck.orientation, + telemetryStore.model.truck.speed + ); +}; + const getMapTilesLayer = (projection) => { return new Tile({ source: new XYZ({ @@ -273,10 +280,10 @@ const updatePlayerPositionAndRotation = (lon, lat, rot, speed) => { if (d.gBehaviorCenterOnPlayer) { if (d.gBehaviorRotateWithPlayer) { //auto-zoom map by speed - if (app.betweenFloat(speed, 15, 35)) d.map.getView().setZoom(9); - else if (app.betweenFloat(speed, 51, 55)) d.map.getView().setZoom(8); - else if (app.betweenFloat(speed, 61, 65)) d.map.getView().setZoom(7); - else if (app.betweenFloat(speed, 81, 88)) d.map.getView().setZoom(6); + if (lessOrEqualThanFloat(speed, 30)) d.map.getView().setZoom(15); + else if (betweenFloat(speed, 30, 50)) d.map.getView().setZoom(9); + else if (betweenFloat(speed, 51, 89)) d.map.getView().setZoom(8); + else if (greaterOrEqualThanFloat(speed, 90)) d.map.getView().setZoom(7); d.map.getView().setCenter(map_coords); d.map.getView().setRotation(rad); @@ -294,4 +301,10 @@ const gameCoordToPixels = (x, y) => { return [x, -y]; }; -export { d, init, updatePlayerPositionAndRotation, gameCoordToPixels }; +export { + d, + init, + updatePlayerPositionAndRotation, + gameCoordToPixels, + triggerMapUpdate +};