| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 | 
							- <!DOCTYPE html>
 
- <html lang="en">
 
- <head>
 
-   <meta charset="UTF-8">
 
-   <meta http-equiv="X-UA-Compatible" content="IE=edge">
 
-   <meta name="viewport" content="width=device-width, initial-scale=1.0">
 
-   <title>Document</title>
 
-   <script src="./opensheetmusicdisplay.min.js"></script>
 
-   <style>
 
-     * {
 
-       margin: 0;
 
-       padding: 0;
 
-     }
 
-     body {
 
-       padding-bottom: 60px;
 
-       height: 600px;
 
-       overflow: hidden;
 
-     }
 
-     .vf-text {
 
-       display: none;
 
-     }
 
-   </style>
 
- </head>
 
- <body>
 
-   <div id="osmdContainer" />
 
-   <script>
 
-     var osmd = new opensheetmusicdisplay.OpenSheetMusicDisplay("osmdContainer");
 
-     osmd.setOptions({
 
-       backend: "svg",
 
-       drawTitle: false,
 
-       drawPartNames: true,
 
-       drawLyricist: false,
 
-       drawComposer: false
 
-       // drawingParameters: "compacttight" // don't display title, composer etc., smaller margins
 
-     });
 
-     function getSvgPngToSize(osmd) {
 
-       if (osmd) {
 
-         const imgList = ''
 
-         if (osmd.Drawer.Backends.length > 0) {
 
-           var backend = osmd.Drawer.Backends[0]
 
-           var state = backend.ctx.state;
 
-           var width = backend.ctx.width / state.scale.x;
 
-           var height = backend.ctx.height / state.scale.y;
 
-           var cont = new XMLSerializer().serializeToString(
 
-             backend.ctx.svg
 
-           )
 
-           return {
 
-             img: cont,
 
-             width: width,
 
-             height: height
 
-           }
 
-         }
 
-       } else {
 
-         console.log('没有OSMD')
 
-       }
 
-     }
 
-     function render() {
 
-       osmd.render();
 
-       window.parent.postMessage({
 
-         api: 'musicStaffRender',
 
-         loading: false,
 
-         osmdImg: getSvgPngToSize(osmd)
 
-       }, '*');
 
-     }
 
-     function renderXml(xmlUrl, partIndex) {
 
-       osmd
 
-         .load(xmlUrl)
 
-         .then(
 
-           function () {
 
-             for (let i = 0; i < osmd.Sheet.Instruments.length; i++) {
 
-               // console.log(osmd.Sheet.Instruments[i].Name);
 
-               osmd.Sheet.Instruments[i].Visible = i === partIndex;
 
-             }
 
-             osmd.zoom = .5
 
-             render();
 
-           }
 
-         );
 
-     }
 
-     function resetRender(partIndex) {
 
-       for (let i = 0; i < osmd.Sheet.Instruments.length; i++) {
 
-         // console.log(osmd.Sheet.Instruments[i].Name);
 
-         osmd.Sheet.Instruments[i].Visible = i === partIndex;
 
-       }
 
-       render();
 
-     }
 
-   </script>
 
- </body>
 
- </html>
 
 
  |