From 6de70e7b985ab63a352b338abfca322da5ce0031 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Tue, 5 Apr 2016 18:54:09 +0300 Subject: [PATCH] minor refactoring + moved crop context keys to the crop context... Signed-off-by: Alex A. Naanou --- ui (gen4)/features/keyboard.js | 13 +++++++------ ui (gen4)/features/ui.js | 10 ++++------ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/ui (gen4)/features/keyboard.js b/ui (gen4)/features/keyboard.js index 28eba2f5..5fd7d105 100755 --- a/ui (gen4)/features/keyboard.js +++ b/ui (gen4)/features/keyboard.js @@ -64,12 +64,17 @@ module.GLOBAL_KEYBOARD = { Esc: 'toggleSingleImage: "off" -- Exit single image view', }, - // XXX cropped -- needs a class to indicate a crop... + // XXX add "save as collection..." 'Cropped': { - // XXX make .crop(..) toggle the class... pattern: '.crop-mode', + + Esc: { + default: 'uncrop', + ctrl: 'uncropAll', + }, }, + // XXX add "save as collection..." (???) // XXX cleanup... 'Viewer': { doc: 'NOTE: binding priority is the same as the order of sections '+ @@ -203,10 +208,6 @@ module.GLOBAL_KEYBOARD = { ctrl: 'cropMarked', alt: 'cropBookmarked', }, - Esc: { - default: 'uncrop', - ctrl: 'uncropAll', - }, // marking... M: { diff --git a/ui (gen4)/features/ui.js b/ui (gen4)/features/ui.js index 2fa62927..ec29f88b 100755 --- a/ui (gen4)/features/ui.js +++ b/ui (gen4)/features/ui.js @@ -758,14 +758,12 @@ module.Viewer = core.ImageGridFeatures.Feature({ delete this.__viewer_resize } }], + // manage the .crop-mode css class... ['crop uncrop', function(){ - if(this.cropped){ - this.ribbons.viewer.addClass('crop-mode') - - } else { - this.ribbons.viewer.removeClass('crop-mode') - } + this.ribbons.viewer[this.cropped ? + 'addClass' + : 'removeClass']('crop-mode') }], ], })