slide-cast
Version:
Web presentation tool with video recording included
54 lines (48 loc) • 1.39 kB
JavaScript
import Symbiote from '@symbiotejs/symbiote';
import template from './CommonToolbar.html.js';
import styles from './CommonToolbar.css.js';
import { Recorder } from '../../lib/Recorder.js';
export class CommonToolbar extends Symbiote {
renderShadow = true;
init$ = {
recIcon: 'R',
eraseIcon: 'x',
onColorChange: (e) => {
this.$['APP/drawColor'] = e.target.value;
this.style.setProperty('--clr-draw-current', e.target.value);
},
onPrev: () => {
this.$['APP/currentSlide']?.prevSlide();
},
onTop: () => {
let firstSlide = document.querySelector('slide-it');
firstSlide?.focus();
},
onNext: () => {
this.$['APP/currentSlide']?.nextSlide();
},
onBottom: () => {
let lastSlide = document.querySelector('slide-it:last-of-type');
lastSlide?.focus();
},
onErase: () => {
this.$['APP/eraseMode'] = !this.$['APP/eraseMode'];
this.$.eraseIcon = this.$['APP/eraseMode'] ? '>' : 'x';
},
onClear: () => {
this.$['APP/currentSlide']?.clearDrawing();
},
onToggleRecorder: () => {
if (Recorder.active) {
Recorder.stop();
this.$.recIcon = 'R';
} else {
Recorder.start();
this.$.recIcon = 'S';
}
}
}
}
CommonToolbar.template = template;
CommonToolbar.rootStyles = styles;
CommonToolbar.reg('common-toolbar');