Skip to content

Commit

Permalink
fixed a scrolling issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Mudloop committed Nov 9, 2024
1 parent 7d7a8de commit 48e0478
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 8 deletions.
5 changes: 3 additions & 2 deletions docs/bundle/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2036,6 +2036,7 @@ const dependencies = {
overflow-y: hidden;
position: relative;
background-color: #202223;
visibility: hidden;
}
main {
position: absolute;
Expand Down Expand Up @@ -2108,7 +2109,7 @@ const dependencies = {
.tab:hover .close {
opacity: 1;
}
`;firstUpdated(t){super.firstUpdated(t),this.playground.onChange.add(()=>this.requestUpdate())}prevSelected;updated(){if(this.prevSelected!=this.playground.project.editorsOrder.at(-1))this.shadowRoot.querySelector(".active")?.scrollIntoView({behavior:"smooth"}),this.prevSelected=this.playground.project.editorsOrder.at(-1)}render=()=>Fn`<main>${this.playground.project.editors.map((t)=>this.rendertab(t))}</main>`;rendertab=(t)=>Fn`
`;firstUpdated(t){super.firstUpdated(t),this.playground.onChange.add(()=>this.requestUpdate()),setTimeout(()=>{this.checkScroll(!0),this.style.visibility="visible"},30)}firstScroll=!0;prevSelected;updated(){if(this.prevSelected!=this.playground.project.editorsOrder.at(-1))this.checkScroll()}checkScroll(t){const j=this.shadowRoot.querySelector(".active");if(!j)return;const r=this.shadowRoot.querySelector("main"),g=j.offsetLeft,S=j.offsetWidth,I=r.clientWidth/2,a=g-I+S/2;r.scrollTo({left:a,behavior:t?"instant":"smooth"}),this.prevSelected=this.playground.project.editorsOrder.at(-1)}render=()=>Fn`<main>${this.playground.project.editors.map((t)=>this.rendertab(t))}</main>`;rendertab=(t)=>Fn`
<div class="tab ${t==this.playground.project.editorsOrder.at(-1)?"active":""}" @pointerdown=${()=>this.playground.project.focusEditor(t)}>
<ui-file-icon .path=${t.file.name} width="16" height="16"></ui-file-icon>
<label>
Expand Down Expand Up @@ -2847,5 +2848,5 @@ const dependencies = {
</button>
`;connectGithub(t){window.open("https://github.com/login/oauth/authorize?client_id=Ov23li52ClmsCJFfVhqc","_blank")}disconnectGithub(t){Ec.disconnect(),document.location.replace("./")}}bB=xn([Cr("cmaj-github-user-widget")],bB);export{kB as Tabs,BB as Sidebar,mk as Prompt,fB as ProjectPanel,FB as ProductsPanel,pB as Playground,vc as MonacoEditor,io as Modals,_B as Menu,EB as Loader,TM as Layout,H6 as IconRegistry,pk as Icon,qB as Header,bB as GithubUserWidget,vB as FlexSplitter,vG as FileIcon,mB as Explorer,gB as ExamplesPanel,hk as Confirm,fX as CLOSE_ICON,Op as Alert};

//# debugId=CDA86950C9E01A4264756E2164756E21
//# debugId=4E6C9418D38BF2F364756E2164756E21
//# sourceMappingURL=index.js.map
Loading

0 comments on commit 48e0478

Please sign in to comment.