index.cf2be60b.js 2.9 KB

1
  1. import{d as o,f as l,R as n,_ as d,U as c,j as m,a as i,V as g,q as u,y as h}from"./App.3b52122c.js";let a=null;var f=o({name:"music-score",props:{score:{type:String,default:""},showPartNames:{type:Boolean,default:!1},onRerender:{type:Function,default:()=>{}},opotions:{type:Object,default:()=>{}},EngravingRules:{type:Object,default:()=>{}}},data(){return{osmd:null,loading:!1}},watch:{score(){this.loadRender()}},methods:{async loadRender(){if(this.loading=!0,this.score)try{await this.osmd.load(this.score),this.osmd.zoom=l(),await this.osmd.render(),this.onRerender(a)}catch(e){console.log(e),this.onRerender(null)}n.emit("loaded"),this.loading=!1},noteClickEvent(e){n.emit("container-click",e);const s=e.path||e.composedPath&&e.composedPath();for(const t of s)t.classList&&t.classList.contains("vf-stavenote")&&n.emit("click",e,t)}},beforeUnmount(){var e;(e=this.$refs.container)==null||e.removeEventListener("touchstart",this.noteClickEvent,!1)},async mounted(){var e;console.log(this.$refs.container),this.$refs.container.addEventListener("touchstart",this.noteClickEvent,!1),await d(),this.osmd=await new c(this.$refs.container,{followCursor:!1,autoResize:!0,drawSubtitle:!1,drawTitle:!1,autoBeam:!0,drawMetronomeMarks:!1,drawMeasureNumbers:!1,drawComposer:!1,drawLyricist:!1,drawPartNames:this.showPartNames,...this.opotions}),this.osmd.EngravingRules.CompactMode=!0,this.osmd.EngravingRules.DYMinNoteWidth=3,this.osmd.EngravingRules.VoiceSpacingMultiplierVexflow=.65,this.osmd.EngravingRules.VoiceSpacingAddendVexflow=2,this.osmd.EngravingRules.MinSkyBottomDistBetweenStaves=2,this.osmd.EngravingRules.MinSkyBottomDistBetweenSystems=2,this.osmd.EngravingRules.MinimumStaffLineDistance=4,this.osmd.EngravingRules.BetweenStaffDistance=2.5,this.osmd.EngravingRules.StaffDistance=3.5,this.osmd.EngravingRules.MinimumDistanceBetweenSystems=1,this.osmd.EngravingRules.PageBottomMargin=0,this.osmd.EngravingRules.PageLeftMargin=2,this.osmd.EngravingRules.PageRightMargin=2,this.osmd.EngravingRules.PageTopMarginNarrow=3,this.osmd.EngravingRules.WedgeEndDistanceBetweenTimestampsFactor=1,this.osmd.rules.RehearsalMarkXOffset=-18,this.osmd.rules.RehearsalMarkYOffset=10,this.osmd.EngravingRules.DYWorkId=((e=m.activeDetail)==null?void 0:e.parentCategoriesId)||0;for(const s in this.EngravingRules)if(Object.prototype.hasOwnProperty.call(this.EngravingRules,s)){const t=this.EngravingRules[s];this.osmd.EngravingRules[s]=t}console.log(a,this.$refs.container),this.loadRender()},render(){return i("div",{class:g.container,ref:"container"},null)}});const r={};console.log(r);var v=o({name:"RenderTest",data(){return{scores:[]}},async mounted(){const e=[];for(const s of Object.keys(r)){const t=await u(s);e.push(h(t,0))}console.log(e),this.scores=e},render(){return this.scores.map((e,s)=>i(f,{key:s,score:e,opotions:{drawMetronomeMarks:!0,drawTitle:!0},EngravingRules:{DYContainerId:"dy-container1",DYSVGContainerId:"dy-svg-container1"}},null))}});export{v as default};