Skip to content

Commit

Permalink
Merge pull request #392 from matt8707/climate
Browse files Browse the repository at this point in the history
Round climate temperature, closes #317
  • Loading branch information
matt8707 authored Feb 22, 2024
2 parents 733acc0 + af5906f commit 47208ea
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 21 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"devDependencies": {
"@iconify/svelte": "^3.1.6",
"@sveltejs/adapter-node": "^4.0.1",
"@sveltejs/kit": "^2.5.0",
"@sveltejs/kit": "^2.5.1",
"@sveltejs/vite-plugin-svelte": "^3.0.2",
"@types/d3-array": "^3.2.1",
"@types/d3-scale": "^4.0.8",
Expand Down
38 changes: 19 additions & 19 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion src/lib/Components/WheelPicker.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,14 @@
// if temperature elements
if (container.children.length > 0) {
const temperature = stateObj?.attributes?.temperature;
// round temperature to ignore decimals
let temperature = Math.round(stateObj?.attributes?.temperature);
// but don't round below or over minmax temp
if (minTemp && maxTemp) {
temperature = Math.max(minTemp, Math.min(maxTemp, temperature));
}
value = temperatures.indexOf(temperature);
// fallback
Expand Down

0 comments on commit 47208ea

Please sign in to comment.