Skip to content

Optional expose on right click - #78

Open
Dravenshorst wants to merge 8 commits into
rlamana:masterfrom
Dravenshorst:optional-expose-on-right-click
Open

Optional expose on right click#78
Dravenshorst wants to merge 8 commits into
rlamana:masterfrom
Dravenshorst:optional-expose-on-right-click

Conversation

@Dravenshorst

Copy link
Copy Markdown
Contributor

Adds the option to disable/enable expose on right click.

* Adds `wmOptions` to constructor of WindowManager.
* Adds `exposeOnRightClick` to `wmOptions` (default: true).
* Adds function to add the value to `expose.js`, so the register method knows the value.
* Updates `README.md`.

Signed-off-by: Daniel Ravenshorst <daniel.ravenshorst@dealerdirect.nl>
* Updates `README.md`.

Signed-off-by: Daniel Ravenshorst <daniel.ravenshorst@dealerdirect.nl>
Signed-off-by: Daniel Ravenshorst <daniel.ravenshorst@dealerdirect.nl>

# Conflicts:
#	dist/ventus.min.js

@rlamana rlamana left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for all these improvements!

Comment thread README.md Outdated
Default is true (right click shows expose).

var wm = new Ventus.WindowManager({
exposeOnRightClick: true

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just going to suggest to change the previous name to something like this. Maybe something shorther? exposeOnMouse? or maybe use a string to specify a trigger, something like exposeShortcut = 'rightclick' | 'a' | 'enter'...

Comment thread src/ventus/wm/modes/expose.js Outdated
if(self.windows.length > 0) {
self.mode = 'expose';
if (exposeOnRightClick === true) {
this.el.on('contextmenu', _.throttle(function() {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the goal of setExposeOnRightClick is to be able to dynamically enable/disable this option, the registration of the event listener should happen there.

However, to avoid register/unregister the listener every time the option changes, we could just check the value of exposeOnRightClick inside the listener code.

Comment thread src/ventus/wm/modes/expose.js Outdated

var ExposeMode = {
// Enable/disable expose on right-click (true=disable / false=enable)
setExposeOnRightClick: function (value) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To keep consistency with other parts of the code, we could use a setter for this.

* Removes `setExposeOnRightClick` as it's not needed.
* Adds jQuery `$` to expose.js
* Adds validListeners, like a,enter,space,rightclick.
* Adds the exposeListeners in WindowManager.
* Updates README.md
* Updates the `dist` folder.
* Updates the examples.

Signed-off-by: Daniel Ravenshorst <daniel.ravenshorst@dealerdirect.nl>
@Dravenshorst

Copy link
Copy Markdown
Contributor Author

@rlamana I have fixed your concerns.
You can now specify the exposeListeners like:

var wm = new Ventus.WindowManager({
  showExposeOn: 'a|enter|space|rightclick'
});

Available listeners are a,enter,space,rightclick, but you can also disable it by setting showExposeOn: 'none'.

If you don't specify anything it will use the default rightclick.

Can you look at it again. Thanks

@rlamana rlamana left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Comment thread src/ventus/wm/windowmanager.js Outdated
'use strict';

var WindowManager = function () {
var WindowManager = function (wmOptions) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: remove wm- prefix. In the context of the WindowManager "class" this is redundant.

Comment thread src/ventus/wm/modes/expose.js Outdated
};

var validListeners = {
a: keypressCallback(97),

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also not very important, but technically that function is not a callback nor it returns a callback exactly. I would rename it to something more descriptive like configKeyListener.

* Merges master into current branch.
* Renames function `keypressCallback` to `configKeyListener` in `expose.js`.
* Renames `wmOptions` to `options` in `windowmanager.js`.

Signed-off-by: Daniel Ravenshorst <daniel.ravenshorst@dealerdirect.nl>
* Renames function `keypressCallback` to `configKeyListener` in `expose.js`.
* Renames `wmOptions` to `options` in `windowmanager.js`.

Signed-off-by: Daniel Ravenshorst <daniel.ravenshorst@dealerdirect.nl>
@Dravenshorst

Copy link
Copy Markdown
Contributor Author

@rlamana I have fixed your concerns, can you have look at it again?

@rlamana

rlamana commented Jun 22, 2018

Copy link
Copy Markdown
Owner

Please resolve the conflicts.

These problems with the dist files should be solved once the branch v0.3.0 is merged. This is a branch where I have been working on a migration to webpack and upgraded a little this old code.

…nal-expose-on-right-click

Signed-off-by: Daniel Ravenshorst <daniel.ravenshorst@dealerdirect.nl>

# Conflicts:
#	dist/ventus.min.js
…nal-expose-on-right-click

Signed-off-by: Daniel Ravenshorst <daniel.ravenshorst@dealerdirect.nl>

# Conflicts:
#	dist/ventus.min.js
@danimesq

Copy link
Copy Markdown

@Dravenshorst, please solve the conflicts. Appreciate if this PR gets merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants