Skip to content

Commit

Permalink
Merge pull request #23 from sinibida/main
Browse files Browse the repository at this point in the history
Added zoom-in feature
  • Loading branch information
sethfair authored Feb 8, 2024
2 parents e2cddf0 + a00f00f commit b9f1dbf
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 181 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ The Focus Mode plugin for Logseq allows you to quickly switch into a distraction
| Hide Right Side Bar | On Focus | Hide the right sidebar when you enter into focus mode. |
| Hide Help | On Focus | Hides the help icon in the lower right corner when you enter into focus mode. |
| Custom Hide Elements | On Focus | Custom CSS selector to hide elements when enter into focus mode. |
| Zoom | On Focus | Applys custom zoom factor when enter into focus mode. |
| Show Left Side Bar | On Unfocus | Show the right sidebar when you exit from focus mode. |
| Show Right Side Bar | On Unfocus | Show the right sidebar when you exit from focus mode. |
| Show Help | On Unfocus | Shows the help icon in the lower right corner when you exit from focus mode. |
| Custom Show Elements | On Unfocus | Custom CSS selector to show elements when you exit from focus mode. |
| Unzoom | On Unfocus | Removes custom zoom factor when you exit from focus mode. |

## License

Expand Down
166 changes: 1 addition & 165 deletions dist/bundle.js

Large diffs are not rendered by default.

14 changes: 1 addition & 13 deletions dist/index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Focus Mode Plugin</title>
<script defer src="bundle.js"></script></head>
<body>
<div id="app"></div>
</body>
</html>
<!doctype html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1,maximum-scale=1,minimum-scale=1"><meta http-equiv="X-UA-Compatible" content="ie=edge"><title>Focus Mode Plugin</title><script defer="defer" src="bundle.js"></script></head><body><div id="app"></div></body></html>
12 changes: 11 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ const main = () => {
logseq.provideStyle(`${logseq.settings.custom_hide_on_focus} { display: none; }`);
}
}

if (stateContains("on_focus", "Zoom")) {
if (logseq.settings.zoom_factor) {
logseq.App.setZoomFactor(logseq.settings.zoom_factor / 100.0);
}
}
}

if (!toggleOn) {
Expand Down Expand Up @@ -120,6 +126,10 @@ const main = () => {
}
`)
}

if (stateContains("on_unfocus", "Unzoom")) {
logseq.App.setZoomFactor(1);
}
}

if (stateContains("on_toggle", "Toggle Page Properties")) {
Expand Down Expand Up @@ -200,4 +210,4 @@ const main = () => {
})
}

export default main;
export default main;
12 changes: 10 additions & 2 deletions src/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const settingUI = () => {
{
key: "on_focus",
type: "enum",
enumChoices: ["Hide Left Sidebar", "Hide Right Sidebar", "Hide Help", "Custom Hide Elements"],
enumChoices: ["Hide Left Sidebar", "Hide Right Sidebar", "Hide Help", "Zoom", "Custom Hide Elements"],
enumPicker: "checkbox",
description:
"When entering focus mode.",
Expand All @@ -30,7 +30,7 @@ export const settingUI = () => {
{
key: "on_unfocus",
type: "enum",
enumChoices: ["Show Left Sidebar", "Show Right Sidebar", "Show Help", "Custom Show Elements"],
enumChoices: ["Show Left Sidebar", "Show Right Sidebar", "Show Help", "Unzoom", "Custom Show Elements"],
enumPicker: "checkbox",
description:
"When exiting focus mode.",
Expand All @@ -57,6 +57,14 @@ export const settingUI = () => {
description:
"CSS selector of elements you wish to show when exiting focus mode.",
title: "Custom Show On Unfocus"
},
{
key: "zoom_factor",
type: "number",
description:
"Zoom factor(%) when focus mode is enabled; Only if 'Zoom' is selected on 'On Focus'",
default: 150,
title: "Zoom Factor"
}
];

Expand Down

0 comments on commit b9f1dbf

Please sign in to comment.