feat: use box for mqtt zoom #90

This commit is contained in:
leukipp
2025-10-06 19:17:35 +02:00
parent 3e4d96536f
commit 01c7411ddc
2 changed files with 6 additions and 3 deletions
+2 -1
View File
@@ -576,9 +576,10 @@ const initPageZoom = () => {
command_topic: `${root}/set`,
state_topic: `${root}/state`,
value_template: "{{ value | int }}",
mode: "slider",
mode: "box",
min: 25,
max: 400,
step: 5,
unit_of_measurement: "%",
icon: "mdi:magnify-plus",
device: INTEGRATION.device,
+4 -2
View File
@@ -378,7 +378,8 @@ const toggleStatus = (force = null) => {
*/
const zoomMinus = () => {
const view = WEBVIEW.views[WEBVIEW.viewActive];
view.webContents.setZoomFactor(Math.max(0.25, view.webContents.getZoomFactor() - 0.1));
const zoom = view.webContents.getZoomFactor() - 0.1;
view.webContents.setZoomFactor(Math.max(0.25, Math.round(zoom * 10) / 10));
update();
};
@@ -387,7 +388,8 @@ const zoomMinus = () => {
*/
const zoomPlus = () => {
const view = WEBVIEW.views[WEBVIEW.viewActive];
view.webContents.setZoomFactor(Math.min(4.0, view.webContents.getZoomFactor() + 0.1));
const zoom = view.webContents.getZoomFactor() + 0.1;
view.webContents.setZoomFactor(Math.min(4.0, Math.round(zoom * 10) / 10));
update();
};