forked from XinFinOrg/XDCremix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
framingService.js
37 lines (33 loc) · 1.18 KB
/
framingService.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
export class FramingService {
constructor (sidePanel, verticalIcon, mainView, resizeFeature) {
this.sidePanel = sidePanel
this.verticalIcon = verticalIcon
this.mainPanel = mainView.getAppPanel()
this.mainView = mainView
this.resizeFeature = resizeFeature
}
start () {
this.sidePanel.events.on('toggle', () => {
this.resizeFeature.panel.clientWidth !== 0 ? this.resizeFeature.hidePanel() : this.resizeFeature.showPanel()
})
this.sidePanel.events.on('showing', () => {
this.resizeFeature.panel.clientWidth === 0 ? this.resizeFeature.showPanel() : ''
})
this.mainPanel.events.on('toggle', () => {
this.resizeFeature.showPanel()
})
this.verticalIcon.select('fileExplorers')
document.addEventListener('keypress', (e) => {
if (e.shiftKey && e.ctrlKey) {
if (e.code === 'KeyF') { // Ctrl+Shift+F
this.verticalIcon.select('fileExplorers')
} else if (e.code === 'KeyA') { // Ctrl+Shift+A
this.verticalIcon.select('pluginManager')
} else if (e.code === 'KeyS') { // Ctrl+Shift+S
this.verticalIcon.select('settings')
}
e.preventDefault()
}
})
}
}