Skip to content

Commit

Permalink
debounce
Browse files Browse the repository at this point in the history
  • Loading branch information
ycw committed May 23, 2024
1 parent e712cda commit 05d155b
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
6 changes: 3 additions & 3 deletions editor/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,17 @@ textarea, input { outline: none; } /* osx */

.TabbedPanel .Tabs {
position: relative;
z-index: 1; /** above Panel **/
z-index: 1; /** Above .Panels **/
display: block;
width: 100%;
white-space: pre;
overflow: hidden;
}

.TabbedPanel .Tabs:hover {
.TabbedPanel .Tabs.entered {
overflow-x: auto;
}


.TabbedPanel .Tabs .Tab {
padding: 10px 9px;
text-transform: uppercase;
Expand Down Expand Up @@ -309,6 +308,7 @@ select {

#resizer {
position: absolute;
z-index: 2; /* Above #sidebar */
top: 32px;
right: 350px;
width: 5px;
Expand Down
30 changes: 29 additions & 1 deletion editor/js/libs/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ properties.forEach( function ( property ) {

// events

const events = [ 'KeyUp', 'KeyDown', 'MouseOver', 'MouseOut', 'Click', 'DblClick', 'Change', 'Input' ];
const events = [ 'KeyUp', 'KeyDown', 'MouseOver', 'MouseOut', 'MouseLeave', 'MouseEnter', 'Click', 'DblClick', 'Change', 'Input' ];

events.forEach( function ( event ) {

Expand Down Expand Up @@ -1080,6 +1080,34 @@ class UITabbedPanel extends UIDiv {

this.selected = '';

//

let delayHoveringTimer = null;

this.tabsDiv.onMouseEnter( () => {

if ( delayHoveringTimer !== null ) {

clearTimeout( delayHoveringTimer );

}

delayHoveringTimer = setTimeout( () => this.tabsDiv.addClass( 'entered' ), 200 );

} );

this.tabsDiv.onMouseLeave( () => {

if ( delayHoveringTimer !== null ) {

clearTimeout( delayHoveringTimer );

}

this.tabsDiv.removeClass( 'entered' );

} );

}

select( id ) {
Expand Down

0 comments on commit 05d155b

Please sign in to comment.