Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

add the opacity value of the cursor to the config #4

Merged
merged 1 commit into from
Sep 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Reveal.initialize({
pointer: {
key: "q", // key to enable pointer, default "q", not case-sensitive
color: "red", // color of a cursor, default "red" any valid CSS color
opacity: 0.8, // opacity of cursor, default 0.8
pointerSize: 12, // pointer size in px, default 12
alwaysVisible: false, // should pointer mode be always visible? default "false"
tailLength: 10, // NOT IMPLEMENTED YET!!! how long the "tail" should be? default 10
Expand Down
2 changes: 1 addition & 1 deletion dist/pointer.esm.js

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

2 changes: 1 addition & 1 deletion dist/pointer.js

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

8 changes: 7 additions & 1 deletion src/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ const Pointer = () => {
) {
options.alwaysVisible = false;
}
if (
options.opacity == null ||
typeof options.opacity !== "number"
) {
options.opacity = 0.8;
}

options.keyCode = getKeyCode(options.key);
}
Expand All @@ -60,7 +66,7 @@ const Pointer = () => {
(mouse.x - bodyOffset.x) / bodyOffset.scale
}px`;
if (mouse.isVisible) {
cursorElement.style.opacity = `0.8`;
cursorElement.style.opacity = options.opacity.toString();
} else {
cursorElement.style.opacity = `0`;
}
Expand Down