diff --git a/game/game.js b/game/game.js index 76771a5e4..8297131ee 100644 --- a/game/game.js +++ b/game/game.js @@ -40951,7 +40951,11 @@ } //创建ul列表 const createMenu=function(pos,self,List,click){ - if (self&&self.createMenu) return false; + if (self&&self.createMenu) { + createList.push(self.createMenu); + ui.window.appendChild(self.createMenu); + return self.createMenu; + } const parent=self.parentNode; if (parent){ for(let i=0;icontainer.editor.refresh(),0); - game.saveConfig('codeMirror_theme', theme); + game.saveConfig('codeMirror_theme',theme); closeMenu.call(self); }; const ul=createMenu(pos,self,list,click); this.createMenu=ul; }); const edit=ui.create.div('.editbutton','编辑',editorpage,function(){ - if(this&&this.createMenu){ + if(this&&this.createMenu&&this.createMenu.parentNode){ return closeMenu.call(this); } const self=this; @@ -41078,6 +41084,24 @@ const ul=createMenu(pos,self,list,click); this.createMenu=ul; }); + const fontSize=ui.create.div('.editbutton','字号',editorpage,function(){ + if(this&&this.createMenu&&this.createMenu.parentNode){ + return closeMenu.call(this); + } + const self=this; + const pos=this.getBoundingClientRect(); + const list=['16px','18px','20px','22px','24px','26px']; + const click=function(e){ + const size=this.innerHTML; + container.style.fontSize=size.slice(0,-2)/game.documentZoom+'px'; + Array.from(self.parentElement.children).map(v=>v.createMenu).filter(Boolean).forEach(v=>{v.style.fontSize=size.slice(0,-2)/game.documentZoom+'px'}); + container.listenTransition(()=>container.editor.refresh()); + game.saveConfig('codeMirror_fontSize',size); + closeMenu.call(self); + }; + const ul=createMenu(pos,self,list,click); + this.createMenu=ul; + }); const editor=ui.create.div(editorpage); return editor; },