File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -159,10 +159,14 @@ class TreemapViewer {
159
159
this . updateColors ( ) ;
160
160
} ) ;
161
161
162
- treemapEl . addEventListener ( 'keypress ' , ( e ) => {
162
+ treemapEl . addEventListener ( 'keyup ' , ( e ) => {
163
163
if ( ! ( e instanceof KeyboardEvent ) ) return ;
164
164
165
165
if ( e . key === 'Enter' ) this . updateColors ( ) ;
166
+
167
+ if ( e . key === 'Escape' && this . treemap ) {
168
+ this . treemap . zoom ( [ ] ) ; // zoom out to root
169
+ }
166
170
} ) ;
167
171
168
172
treemapEl . addEventListener ( 'mouseover' , ( e ) => {
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ declare global {
7
7
constructor ( data : any , options : WebTreeMapOptions ) ;
8
8
render ( el : HTMLElement ) : void ;
9
9
layout ( data : any , el : HTMLElement ) : void ;
10
+ zoom ( address : number [ ] ) : void
10
11
}
11
12
12
13
interface WebTreeMapOptions {
You can’t perform that action at this time.
0 commit comments