Have ESC zoom out topics if you're zoomed in.

This is the natural behavior that most users will
probably expect.  If you need to go to All Messages when
topics are zoomed in, you can just hit ESC twice.
This commit is contained in:
Steve Howell 2018-09-11 11:04:57 +00:00 committed by Tim Abbott
parent 06b1aece31
commit 3a267b5cc6
2 changed files with 12 additions and 3 deletions

View File

@ -278,6 +278,11 @@ exports.process_escape_key = function (e) {
return true; return true;
} }
if (topic_zoom.is_zoomed_in()) {
topic_zoom.zoom_out();
return true;
}
narrow.deactivate(); narrow.deactivate();
return true; return true;
}; };

View File

@ -4,6 +4,10 @@ var exports = {};
var zoomed_in = false; var zoomed_in = false;
exports.is_zoomed_in = function () {
return zoomed_in;
};
function zoom_in() { function zoom_in() {
var stream_id = topic_list.active_stream_id(); var stream_id = topic_list.active_stream_id();
@ -16,7 +20,7 @@ function zoom_in() {
zoomed_in = true; zoomed_in = true;
} }
function zoom_out() { exports.zoom_out = function () {
var stream_li = topic_list.get_stream_li(); var stream_li = topic_list.get_stream_li();
popovers.hide_all(); popovers.hide_all();
@ -28,7 +32,7 @@ function zoom_out() {
} }
zoomed_in = false; zoomed_in = false;
} };
exports.clear_topics = function () { exports.clear_topics = function () {
var stream_li = topic_list.get_stream_li(); var stream_li = topic_list.get_stream_li();
@ -55,7 +59,7 @@ exports.initialize = function () {
}); });
$('.show-all-streams').on('click', function (e) { $('.show-all-streams').on('click', function (e) {
zoom_out(); exports.zoom_out();
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();