@@ -43,6 +43,7 @@ import { SVG } from '../../output/svg.js';
4343import * as AnnotationMenu from './AnnotationMenu.js' ;
4444import { MJContextMenu } from './MJContextMenu.js' ;
4545import { RadioCompare } from './RadioCompare.js' ;
46+ import { mjSlider } from './Slider.js' ;
4647import { MmlVisitor } from './MmlVisitor.js' ;
4748import { MenuMathDocument } from './MenuHandler.js' ;
4849import * as MenuUtil from './MenuUtil.js' ;
@@ -586,6 +587,7 @@ export class Menu {
586587 const parser = new Parser ( [
587588 [ 'contextMenu' , MJContextMenu . fromJson . bind ( MJContextMenu ) ] ,
588589 [ 'radioCompare' , RadioCompare . fromJson . bind ( RadioCompare ) ] ,
590+ [ 'slider' , mjSlider . fromJson . bind ( mjSlider ) ] ,
589591 ] ) ;
590592 this . menu = parser . parse ( {
591593 type : 'contextMenu' ,
@@ -810,7 +812,7 @@ export class Menu {
810812 'Black' ,
811813 ] )
812814 ) ,
813- { type : ' slider' , variable : ' backgroundOpacity', content : ' ' } ,
815+ this . slider ( ' backgroundOpacity') ,
814816 this . submenu (
815817 'Highlight/Foreground' ,
816818 this . radioGroup ( 'foregroundColor' , 'Highlight' , [
@@ -824,7 +826,7 @@ export class Menu {
824826 'Blue' ,
825827 ] )
826828 ) ,
827- { type : ' slider' , variable : ' foregroundOpacity', content : ' ' } ,
829+ this . slider ( ' foregroundOpacity') ,
828830 this . rule ( ) ,
829831 this . radioGroup ( 'highlight' , 'Highlight' , [
830832 'None' ,
@@ -2038,5 +2040,15 @@ export class Menu {
20382040 return { type : 'rule' } ;
20392041 }
20402042
2043+ /**
2044+ * Create JSON for a slider
2045+ *
2046+ * @param {string } variable The (pool) variable to attach to this slider
2047+ * @returns {object } The JSON for the slider item
2048+ */
2049+ public slider ( variable : string ) : object {
2050+ return { type : 'slider' , variable, content : ' ' } ;
2051+ }
2052+
20412053 /*======================================================================*/
20422054}
0 commit comments