Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
decker
decker
Commits
be5cdd65
Commit
be5cdd65
authored
May 01, 2021
by
Mario Botsch
Browse files
fine tune laser pointer
parent
46f7beb0
Changes
2
Hide whitespace changes
Inline
Side-by-side
resource/support/plugins/jingles/jingles.js
0 → 100644
View file @
be5cdd65
"
use strict
"
;
let
RevealJingle
=
(
function
()
{
const
config
=
Reveal
.
getConfig
().
jingles
||
{};
let
jingleLayout
=
null
;
let
jingles
=
[];
function
createJingle
(
filename
,
style
)
{
const
defaultStyle
=
"
display:block; position:absolute; left:0; right:0; top:0; bottom:0; margin:auto; object-fit:contain; pointer-events:none;
"
let
vid
=
document
.
createElement
(
"
video
"
);
vid
.
style
=
style
?
defaultStyle
+
style
:
defaultStyle
;
vid
.
src
=
filename
;
vid
.
onplay
=
()
=>
{
jingleLayout
.
style
.
display
=
"
flex
"
;
vid
.
style
.
display
=
"
block
"
;
}
vid
.
onended
=
()
=>
{
jingleLayout
.
style
.
display
=
vid
.
style
.
display
=
"
none
"
;
}
jingleLayout
.
appendChild
(
vid
);
return
vid
;
}
function
setupJingles
()
{
// setup container
const
reveal
=
document
.
querySelector
(
"
.reveal
"
);
jingleLayout
=
document
.
createElement
(
"
div
"
);
jingleLayout
.
style
=
"
display:flex; flex-flow: column nowrap; justify-content:center; position:fixed; left:0; right:0; top:0; bottom:0; margin:0; z-index:100; background:none;
"
;
reveal
.
appendChild
(
jingleLayout
);
// setup video element per jingle
for
(
let
i
=
0
;
i
<
config
.
length
;
i
++
)
{
jingles
.
push
(
createJingle
(
config
[
i
].
vid
,
config
[
i
].
css
)
);
}
}
function
playJingle
(
i
)
{
jingles
[
i
].
play
();
}
function
setupKeyBindings
()
{
const
N
=
Math
.
min
(
9
,
jingles
.
length
);
for
(
let
i
=
0
;
i
<
N
;
i
++
)
{
Reveal
.
addKeyBinding
(
{
keyCode
:
49
+
i
,
key
:
String
.
fromCharCode
(
49
+
i
),
description
:
"
Play jingle
"
+
i
,
},
()
=>
{
playJingle
(
i
);
}
);
}
}
return
{
init
:
function
()
{
console
.
log
(
"
init jingle plugin
"
);
if
(
config
.
length
)
{
setupJingles
();
setupKeyBindings
();
}
},
};
})();
Reveal
.
registerPlugin
(
"
jingle
"
,
RevealJingle
);
resource/support/plugins/whiteboard/whiteboard.js
View file @
be5cdd65
...
...
@@ -1148,6 +1148,9 @@ let RevealWhiteboard = (function () {
* pointer and mouse callbacks
******************************************************************/
// need this to remember button state for pointerup event
let
buttonsPressed
=
null
;
function
pointerdown
(
evt
)
{
// only when whiteboard is active
if
(
!
whiteboardActive
)
return
;
...
...
@@ -1158,6 +1161,9 @@ let RevealWhiteboard = (function () {
// only pen and mouse events
if
(
evt
.
pointerType
!=
"
pen
"
&&
evt
.
pointerType
!=
"
mouse
"
)
return
;
// remember button state
buttonsPressed
=
evt
.
buttons
;
// mouse button 2: toggle laser
if
(
evt
.
buttons
==
2
)
{
toggleLaser
();
...
...
@@ -1229,7 +1235,9 @@ let RevealWhiteboard = (function () {
if
(
evt
.
pointerType
!=
"
pen
"
&&
evt
.
pointerType
!=
"
mouse
"
)
return
;
// mouse button 2: toggle laser (nothing to do here)
if
(
evt
.
buttons
==
2
)
{
console
.
log
(
"
HALLO
"
);
return
;}
if
(
buttonsPressed
==
2
)
{
return
killEvent
(
evt
);
}
// finish pen stroke
if
(
tool
==
ToolType
.
PEN
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment