3.5.9
Updated pet calcs to be more accurate Fixed some layout issues Updated profile popup
This commit is contained in:
@@ -33,7 +33,7 @@
|
||||
|
||||
import { h, Fragment } from '../../vendor/preact.js';
|
||||
import htm from '../../vendor/htm.js';
|
||||
import { confidenceBand, utciCategory, VEHICLE_SPEEDS, VEHICLE_TYPES, BUILDING_TYPES, FUR_COLORS } from '../utils.js';
|
||||
import { confidenceBand, utciCategory, petCategory, VEHICLE_SPEEDS, VEHICLE_TYPES, BUILDING_TYPES, FUR_COLORS } from '../utils.js';
|
||||
import { FREE_DAYS, UTCI_ENVIRONMENTS, deriveProfileMain, FILTER_PROFILES, variantIcons } from '../config.js';
|
||||
import { calcVehicleInteriorTempPass } from '../physics.js';
|
||||
import { CloudIcon, PrecipIcon, HouseIcon, CarIcon, FogIcon, IceIcon } from '../components.js';
|
||||
@@ -134,7 +134,7 @@ export function DayTabs({
|
||||
// only need the derived main metric to compute the day-tab numbers and to
|
||||
// label the "what temps am I looking at" row below.
|
||||
const {
|
||||
isHomeOrOffice, isVehicleProfile, mainConfigKey, mainField, secondaryField, mainLabel,
|
||||
isHomeOrOffice, isVehicleProfile, isPetsProfile, mainConfigKey, mainField, secondaryField, mainLabel,
|
||||
mainMetricLabel, mainMetricDesc, secondaryMetricLabel, secondaryMetricDesc,
|
||||
} = deriveProfileMain(activeProfile, outdoorsVariant);
|
||||
|
||||
@@ -302,12 +302,18 @@ export function DayTabs({
|
||||
// • Otherwise rain wins, then cloud, then a clear "sunny"/cold colour.
|
||||
const mix = (a, b, t) => a.map((v, i) => Math.round(v + (b[i] - v) * Math.max(0, Math.min(1, t))));
|
||||
const hex2rgb = (hx) => { const n = parseInt(hx.replace('#', ''), 16); return [(n >> 16) & 255, (n >> 8) & 255, n & 255]; };
|
||||
const tBand = dayHi !== null ? utciCategory(dayHi) : { bg: '#f8e554' };
|
||||
const catFn = isPetsProfile ? petCategory : utciCategory;
|
||||
const tBand = dayHi !== null ? catFn(dayHi) : { bg: '#f8e554' };
|
||||
|
||||
const ccVals = repRows.map(r => r.cc).filter(v => isFinite(v));
|
||||
const avgCloud = ccVals.length ? ccVals.reduce((s, v) => s + v, 0) / ccVals.length : 0;
|
||||
|
||||
const isHot = dayHi !== null && dayHi >= 29; // Hot band and above
|
||||
// Hot/cold cutoffs below are calibrated against UTCI_BANDS; for the
|
||||
// Pets profile (furSurfaceT, judged against the shifted PET_BANDS)
|
||||
// the same cutoffs are re-projected onto the pet scale so the
|
||||
// "hot hue" / "plain cold" branches kick in at the same relative
|
||||
// point in each band, not the same absolute degree.
|
||||
const isHot = dayHi !== null && dayHi >= (isPetsProfile ? 35 : 29); // Hot band and above
|
||||
const isDanger = tBand.solid === true;
|
||||
|
||||
// Home/indoor/vehicle tabs show a modelled temperature, not the
|
||||
@@ -321,7 +327,9 @@ export function DayTabs({
|
||||
} else if (isHot) {
|
||||
// Keep the heat hue; cloud only mutes it a touch (orange/red never
|
||||
// greens) and rain does not override heat.
|
||||
const heatFactor = dayHi >= 39 ? 0.15 : dayHi >= 34 ? 0.30 : 0.45;
|
||||
const heatFactor = isPetsProfile
|
||||
? (dayHi >= 49 ? 0.15 : dayHi >= 43 ? 0.30 : 0.45)
|
||||
: (dayHi >= 39 ? 0.15 : dayHi >= 34 ? 0.30 : 0.45);
|
||||
const t = Math.max(0, Math.min(1, (avgCloud - 30) / 70)) * heatFactor;
|
||||
rgb = mix(hex2rgb(tBand.bg), [170, 162, 152], t);
|
||||
} else if (daySnow >= 0.1) {
|
||||
@@ -333,7 +341,7 @@ export function DayTabs({
|
||||
} else if (avgCloud >= 30) {
|
||||
// Cloud: light → dark grey with cover (pure grey, no temperature hue).
|
||||
rgb = mix([205, 206, 208], [110, 115, 122], Math.max(0, Math.min(1, (avgCloud - 30) / 70)));
|
||||
} else if (dayHi !== null && dayHi < 10) {
|
||||
} else if (dayHi !== null && dayHi < (isPetsProfile ? 2 : 10)) {
|
||||
// Clear & cold: keep the cold temperature blue.
|
||||
rgb = hex2rgb(tBand.bg);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user