Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Item Context Menu - Change option selection to Single click instead of Double click #1486

Merged
merged 4 commits into from
Sep 7, 2023

Conversation

10Dozen
Copy link
Contributor

@10Dozen 10Dozen commented Jul 28, 2021

When merged this pull request will:

  • Change the method of the option selection in Item Context Menu -- select and execute option via single click (instead of default double click)

Note:
Currently to use inventory action player needs to double click the item, then find needed option and double click it again.
It's work fine in tests and without much interactions available.

But after hours of playing it becomes not so trivial. Especially when there is a need to interact with multiple items in short period of time (e.g. pack individual magazines manually - 4x clicks (to open menu and select options) * number of items in backpack of the average milsimer = ∞ number of clicks!).
So new options is just a small step to reduce number of the clicks needed.

p.s. Maybe option to open menu via Ctrl+Click is also needed, but didn't investigated possibility of this.

@Dystopian
Copy link
Contributor

Also maybe single scroll click is a good idea instead of double left click for menu call (if it possible).

@10Dozen
Copy link
Contributor Author

10Dozen commented Jul 29, 2021

Also maybe single scroll click is a good idea instead of double left click for menu call (if it possible).
Not a problem for slots (e.g. uniform, rifle), but hard to make for items in containers.

Now context menu invoked by LBDblClick event (returns selected element). If we replace it with MouseButtonUp for LMB - it will work (click will select item in the listbox, so it's possible to track curSel element), but now option menu will be opened each time we click somewhere inside listbox too. For MMB it won't even select item in listbox, so it's not easy to get item that was clicked.

Maybe if we can track mouse coursor over specific listbox item...

EDIT:
Ok, Middle mouse button looks like ignored by everything, lol.
This useless code, btw, returns the index of the element under mouse (not sure about reliability on different ui scale, but works pretty good for me):

// Getting listbox's displayed size
private _lbHeight = getNumber (configFile >> "RscDisplayInventory" >> "controls" >> _containerConfigClass >> "h");
private _lbTopPos = getNumber (configFile >> "RscDisplayInventory" >> "controls" >> _containerConfigClass >> "y");
private _lbBottomPos = _lbTopPos + _lbHeight;

// Gettings full listbox's size
private _lbRowHeight = getNumber (configFile >> "RscDisplayInventory" >> "controls" >> _containerConfigClass >> "rowHeight");
private _lbRowOffset = getNumber (configFile >> "RscDisplayInventory" >> "controls" >> _containerConfigClass >> "itemSpacing");
private _lbSize = lbSize _control;
// Magic here! There is some offset in the bottom of the inventory listbox for Uniform/Vest/Backpack
private _lbBottomOffset = [0, _lbRowHeight * 0.9] select (_containerType in ["UNIFORM_CONTAINER","VEST_CONTAINER","BACKPACK_CONTAINER"]);
private _lbTotalItemsHeight = (_lbSize * _lbRowHeight) + (_lbSize - 1) * _lbRowOffset + _lbBottomOffset;

// Position (top and bottom) of the displayed part of the Listbox
private _lbScrollVertical = (ctrlScrollValues _control) select 0;
private _scrolledTopPos = _lbScrollVertical * (_lbTotalItemsHeight - _lbHeight);
private _scrolledBottomPos = _scrolledTopPos + _lbHeight;

// Getting row number under mouse position by interpolation position of the mouse over listbox viewport to actual listbox position displayed
private _scrolledToLBPos = linearConversion [_lbTopPos, _lbBottomPos, _yPos, _scrolledTopPos, _scrolledBottomPos, false];
private _index = -1 + ceil (_scrolledToLBPos / (_lbRowHeight + _lbRowOffset));

So the only option i can imagine now is <ctrl/shift/alt> + LMB click alternative.

This will highlight selected option at least for 1 frame
@commy2
Copy link
Contributor

commy2 commented Aug 3, 2021

This setting seems like bloat to me. It is a setting about how you can either use single or double clicks in an ui...

CBA devs should make the choice whatever makes more sense. I am open to this being changed, but a setting for this? Just no.

@jonpas
Copy link
Member

jonpas commented Aug 3, 2021

Single click makes more sense to me.

@10Dozen
Copy link
Contributor Author

10Dozen commented Aug 3, 2021

I prefer single click (reason in PR first message). Removed setting.

@10Dozen 10Dozen changed the title Item Context Menu - Optional Single click mode for option selection Item Context Menu - Change option selection to Single click instead of Double click Aug 4, 2021
@jonpas
Copy link
Member

jonpas commented Jun 24, 2023

Does this single-click implementation work reliably?

@10Dozen
Copy link
Contributor Author

10Dozen commented Jun 25, 2023

I don't have A3 now and it's like 1 year old, so someone needs to test =)
If UI handling didn't change, then it should work.

@jonpas
Copy link
Member

jonpas commented Sep 6, 2023

Could put this into next update if somebody tests it.

@Mike-MF
Copy link
Contributor

Mike-MF commented Sep 7, 2023

I tested this, it works.

@jonpas jonpas added this to the 3.16.0 milestone Sep 7, 2023
@jonpas jonpas merged commit 0796c26 into CBATeam:master Sep 7, 2023
4 checks passed
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.

None yet

5 participants