From 239d4a86d70ff614618bcdf9e5b28545a3f89f0d Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sat, 5 Mar 2016 02:45:02 +0300 Subject: [PATCH] some cleanup and refactoring... Signed-off-by: Alex A. Naanou --- ui (gen4)/css/layout.css | 2 ++ ui (gen4)/css/layout.less | 3 ++ ui (gen4)/features/meta.js | 1 + ui (gen4)/features/ui-status.js | 3 ++ ui (gen4)/features/ui-widgets.js | 48 ++++++++++++++++++++++++++++++++ ui (gen4)/lib/widget/overlay.js | 5 +++- 6 files changed, 61 insertions(+), 1 deletion(-) diff --git a/ui (gen4)/css/layout.css b/ui (gen4)/css/layout.css index dd9394d8..2a8d0e7a 100644 --- a/ui (gen4)/css/layout.css +++ b/ui (gen4)/css/layout.css @@ -365,6 +365,8 @@ stretching in width... */ border: solid 5px red; background: none; z-index: 100; + /* pass events through... (do we need IE10-?) */ + pointer-events: none; } .marker { width: 50px; diff --git a/ui (gen4)/css/layout.less b/ui (gen4)/css/layout.less index 522c73bf..d2b6dc0f 100755 --- a/ui (gen4)/css/layout.less +++ b/ui (gen4)/css/layout.less @@ -519,6 +519,9 @@ stretching in width... */ border: solid 5px red; background: none; z-index: 100; + + /* pass events through... (do we need IE10-?) */ + pointer-events: none; } .marker { diff --git a/ui (gen4)/features/meta.js b/ui (gen4)/features/meta.js index cd9ade61..e642674b 100755 --- a/ui (gen4)/features/meta.js +++ b/ui (gen4)/features/meta.js @@ -107,6 +107,7 @@ core.ImageGridFeatures.Feature('viewer-testing', [ 'ui-url-history', 'ui-browse-actions', + 'ui-context-action-menu', 'ui-widget-test', // ui control... diff --git a/ui (gen4)/features/ui-status.js b/ui (gen4)/features/ui-status.js index 1e53f61c..8958ecfd 100755 --- a/ui (gen4)/features/ui-status.js +++ b/ui (gen4)/features/ui-status.js @@ -347,6 +347,9 @@ module.StatusBar = core.ImageGridFeatures.Feature({ tag: 'ui-status-bar', depends: [ 'ui', + + // XXX this is here to enable context menu... + 'ui-browse-actions', ], actions: StatusBarActions, diff --git a/ui (gen4)/features/ui-widgets.js b/ui (gen4)/features/ui-widgets.js index 23103581..9a538faa 100755 --- a/ui (gen4)/features/ui-widgets.js +++ b/ui (gen4)/features/ui-widgets.js @@ -179,6 +179,54 @@ module.BrowseActions = core.ImageGridFeatures.Feature({ +//--------------------------------------------------------------------- + +var ContextActionMenu = +module.ContextActionMenu = core.ImageGridFeatures.Feature({ + title: '', + doc: '', + + tag: 'ui-context-action-menu', + depends: [ + 'ui-browse-actions', + ], + + handlers: [ + ['updateImage', + function(){ + var that = this + var img = this.ribbons.getImage(gid) + + !img.data('context-menu') + && img + .data('context-menu', true) + .on('contextmenu', function(){ + event.preventDefault() + event.stopPropagation() + + that.browseActions('/Image/') + }) + }], + ['load', + function(){ + var that = this + var viewer = this.ribbons.viewer + + !viewer.data('context-menu') + && viewer + .data('context-menu', true) + .on('contextmenu', function(){ + event.preventDefault() + event.stopPropagation() + + that.browseActions() + }) + }], + ], +}) + + + //--------------------------------------------------------------------- // XXX make this not applicable to production... diff --git a/ui (gen4)/lib/widget/overlay.js b/ui (gen4)/lib/widget/overlay.js index a891c34d..a261a687 100755 --- a/ui (gen4)/lib/widget/overlay.js +++ b/ui (gen4)/lib/widget/overlay.js @@ -23,6 +23,10 @@ var OverlayClassPrototype = { .on(options.nonPropagatedEvents.join(' '), function(){ event.stopPropagation() }) + .on('contextmenu', function(){ + event.preventDefault() + event.stopPropagation() + }) .append($('
') .addClass('content') .click(function(){ @@ -31,7 +35,6 @@ var OverlayClassPrototype = { .on('contextmenu', function(){ event.preventDefault() event.stopPropagation() - return false }) .append(client))