Font size should be adjustable

//FREEBIE
This commit is contained in:
Paolo Inglese 2016-10-04 17:42:43 +01:00 committed by lilia
parent fcffcd35af
commit 7cd45714a5

View file

@ -67,21 +67,23 @@
this.currentSize = this.defaultSize; this.currentSize = this.defaultSize;
this.render(); this.render();
}, },
events: { 'mousewheel': 'zoomText' }, events: { 'keydown': 'zoomText' },
zoomText: function(e) { zoomText: function(e) {
if (e.ctrlKey === true) { if (!e.ctrlKey)
if (e.originalEvent.deltaY > 0) { return;
if (this.currentSize > this.minSize) { var keyCode = e.which || e.keyCode;
this.currentSize--; var maxSize = 22; // if bigger text goes outside send-message textarea
this.render(); var minSize = 14;
} if (keyCode === 189 || keyCode == 109) {
} else if (e.originalEvent.deltaY < 0) { if (this.currentSize > minSize) {
if (this.currentSize < this.maxSize) { this.currentSize--;
this.currentSize++; }
this.render(); } else if (keyCode === 187 || keyCode == 107) {
} if (this.currentSize < maxSize) {
this.currentSize++;
} }
} }
this.render();
}, },
render: function() { render: function() {
this.$el.css('font-size', this.currentSize + 'px'); this.$el.css('font-size', this.currentSize + 'px');
@ -100,7 +102,8 @@
initialize: function (options) { initialize: function (options) {
this.render(); this.render();
this.applyTheme(); this.applyTheme();
new Whisper.FontSizeView({ el: this.el }); this.$el.attr('tabindex', '1');
new Whisper.FontSizeView({ el: this.$el });
this.conversation_stack = new Whisper.ConversationStack({ this.conversation_stack = new Whisper.ConversationStack({
el: this.$('.conversation-stack'), el: this.$('.conversation-stack'),
model: { appWindow: options.appWindow } model: { appWindow: options.appWindow }