File tree Expand file tree Collapse file tree 4 files changed +70632
-7435
lines changed Expand file tree Collapse file tree 4 files changed +70632
-7435
lines changed Original file line number Diff line number Diff line change 39
39
nextCursorBtn ,
40
40
resetCursorBtn ,
41
41
showCursorBtn ,
42
- hideCursorBtn ;
42
+ hideCursorBtn ,
43
+ backendSelect ;
43
44
44
45
// Initialization code
45
46
function init ( ) {
57
58
resetCursorBtn = document . getElementById ( "reset-cursor-btn" ) ;
58
59
showCursorBtn = document . getElementById ( "show-cursor-btn" ) ;
59
60
hideCursorBtn = document . getElementById ( "hide-cursor-btn" ) ;
61
+ backendSelect = document . getElementById ( "backend-select" ) ;
60
62
61
63
// Hide error
62
64
error ( ) ;
85
87
} ;
86
88
87
89
// Create OSMD object and canvas
88
- OSMD = new opensheetmusicdisplay . OSMD ( canvas ) ;
90
+ OSMD = new opensheetmusicdisplay . OSMD ( canvas , false ) ;
89
91
OSMD . setLogLevel ( 'info' ) ;
90
92
91
93
// Set resize event handler
121
123
showCursorBtn . addEventListener ( "click" , function ( ) {
122
124
OSMD . cursor . show ( ) ;
123
125
} ) ;
126
+
127
+ backendSelect . addEventListener ( "change" , function ( e ) {
128
+ var value = e . target . value ;
129
+ // clears the canvas element
130
+ canvas . innerHTML = "" ;
131
+ OSMD = new opensheetmusicdisplay . OSMD ( canvas , false , value ) ;
132
+ OSMD . setLogLevel ( 'info' ) ;
133
+ selectOnChange ( ) ;
134
+
135
+ } ) ;
124
136
}
125
137
126
138
function Resize ( startCallback , endCallback ) {
Original file line number Diff line number Diff line change @@ -14,6 +14,14 @@ OSMD can display [MusicXML][0] in both `.xml` and `.mxl` containers. On this dem
14
14
15
15
<select id =" select " class =" btn btn-demo " ></select >
16
16
17
+ ## Renderer
18
+ You can select the rendering strategy, by choosing either the Canvas option, or the SVG one.
19
+
20
+ <select id =" backend-select " class =" btn btn-demo " value =" canvas " >
21
+ <option value="canvas">Canvas</option>>
22
+ <option value="svg">SVG</option>
23
+ </select >
24
+
17
25
## Zoom level
18
26
You control the zoom level of the music sheet displayed. Right now, OSMD is rendering the music piece at <span id =" zoom-str " >100</span >% on <span id =" size-str " >0</span >px width.
19
27
Load Diff Large diffs are not rendered by default.
You can’t perform that action at this time.
0 commit comments