Skip to content

Commit

Permalink
Disable revealjs backdrop filter on overlays
Browse files Browse the repository at this point in the history
- See rajgoel#180
- Also fix formatting
  • Loading branch information
knightgu committed Mar 4, 2024
1 parent e34fe7f commit 0cfa86b
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions chalkboard/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function scriptPath() {
if ( document.currentScript ) {
src = document.currentScript.src;
} else {
var sel = document.querySelector( 'script[src$="/chalkboard/plugin.js"]' )
var sel = document.querySelector( 'script[src$="/chalkboard/plugin.js"]' );
if ( sel ) {
src = sel.src;
}
Expand Down Expand Up @@ -163,7 +163,7 @@ const initChalkboard = function ( Reveal ) {

var sponge = {
cursor: 'url(' + path + 'img/sponge.png), auto'
}
};


var keyBindings = {
Expand Down Expand Up @@ -291,14 +291,14 @@ const initChalkboard = function ( Reveal ) {

function whenReady( callback ) {
// wait for markdown to be parsed and code to be highlighted
if ( !document.querySelector( 'section[data-markdown]:not([data-markdown-parsed])' )
&& !document.querySelector( '[data-load]:not([data-loaded])')
&& !document.querySelector( 'code[data-line-numbers*="|"]')
if ( !document.querySelector( 'section[data-markdown]:not([data-markdown-parsed])' )
&& !document.querySelector( '[data-load]:not([data-loaded])')
&& !document.querySelector( 'code[data-line-numbers*="|"]')
) {
callback();
} else {
console.log( "Wait for external sources to be loaded and code to be highlighted" );
setTimeout( whenReady, 500, callback )
setTimeout( whenReady, 500, callback );
}
}

Expand All @@ -308,7 +308,7 @@ const initChalkboard = function ( Reveal ) {
callback();
} else {
console.log( "Wait for drawings to be loaded" );
setTimeout( whenLoaded, 500, callback )
setTimeout( whenLoaded, 500, callback );
}
}

Expand Down Expand Up @@ -417,7 +417,7 @@ const initChalkboard = function ( Reveal ) {
mode,
board
};
document.dispatchEvent( message );
document.dispatchEvent( message );
}

function setupDrawingCanvas( id ) {
Expand All @@ -427,7 +427,7 @@ const initChalkboard = function ( Reveal ) {
container.setAttribute( 'data-prevent-swipe', 'true' );
container.oncontextmenu = function () {
return false;
}
};

changeCursor( container, pens[ id ][ color[ id ] ] );

Expand All @@ -443,6 +443,7 @@ const initChalkboard = function ( Reveal ) {
container.style.opacity = 1;
container.style.visibility = 'visible';
container.style.pointerEvents = 'none';
container.style['backdrop-filter'] = 'none';

var slides = document.querySelector( '.slides' );
var aspectRatio = Reveal.getConfig().width / Reveal.getConfig().height;
Expand Down Expand Up @@ -612,9 +613,9 @@ const initChalkboard = function ( Reveal ) {
}

function updateStorage() {
var json = JSON.stringify( storage )
var json = JSON.stringify( storage );
if ( config.storage ) {
sessionStorage.setItem( config.storage, json )
sessionStorage.setItem( config.storage, json );
}
return json;
}
Expand Down Expand Up @@ -691,7 +692,7 @@ const initChalkboard = function ( Reveal ) {
return data;
}
}
var page = Number( Reveal.getCurrentSlide().getAttribute('data-pdf-page-number') );
var page = Number( Reveal.getCurrentSlide().getAttribute('data-pdf-page-number') );
//console.log( indices, Reveal.getCurrentSlide() );
storage[ id ].data.push( {
slide: indices,
Expand Down Expand Up @@ -933,7 +934,7 @@ const initChalkboard = function ( Reveal ) {
}
}
}

function eraseWithSponge( context, x, y ) {
context.save();
context.beginPath();
Expand Down Expand Up @@ -1060,7 +1061,7 @@ const initChalkboard = function ( Reveal ) {
/**
* Set the color
*/
function setColor( index, record ) {
function setColor( index, record ) {
// protect against out of bounds (this could happen when
// replaying events recorded with different color settings).
if ( index >= pens[ mode ].length ) index = 0;
Expand Down Expand Up @@ -1933,7 +1934,7 @@ const initChalkboard = function ( Reveal ) {
];

if ( config.storage ) {
sessionStorage.setItem( config.storage, null )
sessionStorage.setItem( config.storage, null );
}
// broadcast
var message = new CustomEvent( messageType );
Expand Down

0 comments on commit 0cfa86b

Please sign in to comment.