Skip to content
This repository has been archived by the owner on Sep 26, 2024. It is now read-only.

Commit

Permalink
clamp
Browse files Browse the repository at this point in the history
  • Loading branch information
ruihe774 committed Dec 9, 2023
1 parent a58f645 commit c225c09
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 1 deletion.
11 changes: 11 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
},
"dependencies": {
"@tauri-apps/api": "1.5.x",
"core-js": "^3.34.0",
"lodash-es": "4.x",
"vue": "3.x"
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/FeatureSlider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default defineComponent({
monitorManager.updateFeature(
this.monitorId,
this.featureName,
Math.max(0, Math.min(this.maximum, Math.round(current + offset * 0.01))),
Math.clamp(Math.round(current + offset * 0.01), 0, this.maximum),
);
}
},
Expand Down
1 change: 1 addition & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { watchThrottled } from "./watchers";
import monitorManager from "./monitor";
import BrightnessPanel from "./components/BrightnessPanel.vue";
import panelState from "./wm";
import "./polyfill";
import "./style";
import "./style.global.sass";

Expand Down
3 changes: 3 additions & 0 deletions src/polyfill.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
interface Math {
clamp(x: number, lower: number, upper: number): number;
}
1 change: 1 addition & 0 deletions src/polyfill.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import "core-js/full/math/clamp";

0 comments on commit c225c09

Please sign in to comment.