Change font size on ctrl+scroll

Fixes #864

// FREEBIE
This commit is contained in:
lilia 2016-08-24 16:07:46 -07:00
parent 41e4154d60
commit b330b80484

View file

@ -57,11 +57,41 @@
}
});
Whisper.FontSizeView = Whisper.View.extend({
defaultSize: 14,
maxSize: 30,
minSize: 14,
initialize: function() {
this.currentSize = this.defaultSize;
this.render();
},
events: { 'mousewheel': 'zoomText' },
zoomText: function(e) {
if (e.ctrlKey == true) {
if (e.originalEvent.deltaY > 0) {
if (this.currentSize > this.minSize) {
this.currentSize--
this.render();
}
} else if (e.originalEvent.deltaY < 0) {
if (this.currentSize < this.maxSize) {
this.currentSize++;
this.render();
}
}
}
},
render: function() {
this.$el.css('font-size', this.currentSize + 'px');
}
});
Whisper.InboxView = Whisper.View.extend({
templateName: 'two-column',
className: 'inbox',
initialize: function (options) {
this.render();
new Whisper.FontSizeView({ el: this.el });
this.conversation_stack = new Whisper.ConversationStack({
el: this.$('.conversation-stack'),
model: { appWindow: options.appWindow }