Browse Source

Fixes #217

MouseWheel are not supported.
pull/291/merge
Ramiro Saenz 9 years ago
parent
commit
c1f0530bcf
  1. 28
      app/Application.js
  2. 43
      app/ux/WebView.js

28
app/Application.js

@ -65,43 +65,45 @@ Ext.define('Rambox.Application', {
}
}
,{
key: [Ext.event.Event.NUM_PLUS, Ext.event.Event.NUM_MINUS]
key: [Ext.event.Event.NUM_PLUS, Ext.event.Event.NUM_MINUS, 187, 189]
,ctrl: true
,alt: false
,shift: false
,handler: function(key) {
var tabPanel = Ext.cq1('app-main');
if ( tabPanel.items.indexOf(tabPanel.getActiveTab()) === 0 ) return false;
var currentLevel = tabPanel.getActiveTab().zoomLevel;
if ( key === Ext.event.Event.NUM_PLUS ) { // Plus key
currentLevel = currentLevel + 0.25;
} else { // Minus Key
currentLevel = currentLevel - 0.25;
}
tabPanel.getActiveTab().down('component').el.dom.getWebContents().setZoomLevel(currentLevel);
tabPanel.getActiveTab().zoomLevel = currentLevel;
key === Ext.event.Event.NUM_PLUS || key === 187 ? tabPanel.getActiveTab().zoomIn() : tabPanel.getActiveTab().zoomOut();
}
}
,{
key: Ext.event.Event.NUM_ZERO
key: [Ext.event.Event.NUM_ZERO, '0']
,ctrl: true
,alt: false
,shift: false
,handler: function(key) {
var tabPanel = Ext.cq1('app-main');
if ( tabPanel.items.indexOf(tabPanel.getActiveTab()) === 0 ) return false;
tabPanel.getActiveTab().down('component').el.dom.getWebContents().setZoomLevel(0);
tabPanel.getActiveTab().zoomLevel = 0;
tabPanel.getActiveTab().resetZoom();
}
}
,{
key: "0123456789"
key: "123456789"
,ctrl: true
,alt: false
,handler: function(key) {
Ext.cq1('app-main').setActiveTab(key - 48);
}
}
,{
key: 188 // comma
,ctrl: true
,alt: false
,handler: function(key) {
Ext.cq1('app-main').setActiveTab(0);
}
}
,{
key: Ext.event.Event.F1
,ctrl: false

43
app/ux/WebView.js

@ -86,6 +86,25 @@ Ext.define('Rambox.ux.WebView',{
]
}
,'-'
,{
text: 'Zoom In'
,glyph: 'xf00e@FontAwesome'
,scope: me
,handler: me.zoomIn
}
,{
text: 'Zoom Out'
,glyph: 'xf010@FontAwesome'
,scope: me
,handler: me.zoomOut
}
,{
text: 'Reset Zoom'
,glyph: 'xf002@FontAwesome'
,scope: me
,handler: me.resetZoom
}
,'-'
,{
text: 'Reload'
,glyph: 'xf021@FontAwesome'
@ -305,4 +324,28 @@ Ext.define('Rambox.ux.WebView',{
webview.goForward();
}
,zoomIn: function() {
var me = this;
var webview = me.down('component').el.dom;
me.zoomLevel = me.zoomLevel + 0.25;
webview.getWebContents().setZoomLevel(me.zoomLevel);
}
,zoomOut: function() {
var me = this;
var webview = me.down('component').el.dom;
me.zoomLevel = me.zoomLevel - 0.25;
webview.getWebContents().setZoomLevel(me.zoomLevel);
}
,resetZoom: function() {
var me = this;
var webview = me.down('component').el.dom;
me.zoomLevel = 0;
webview.getWebContents().setZoomLevel(0);
}
});

Loading…
Cancel
Save