add option to always activate menu while holding CTRL
This commit is contained in:
parent
e1dd0f9c04
commit
dbdcb4e367
@ -313,7 +313,8 @@ export interface InPlayerUIOptions {
|
||||
activatorAlignment: MenuPosition,
|
||||
minEnabledWidth: number, // don't show UI if player is narrower than % of screen width
|
||||
minEnabledHeight: number, // don't show UI if player is narrower than % of screen height
|
||||
activation: 'player' | 'player-ctrl' | 'trigger-zone' | 'distance' | 'none', // what needs to be hovered in order for UI to be visible
|
||||
activation: 'player' | 'trigger-zone' | 'distance' | 'none', // what needs to be hovered in order for UI to be visible
|
||||
activateWithCtrl: boolean,
|
||||
activationDistance: number,
|
||||
activationDistanceUnits: '%' | 'px',
|
||||
activatorPadding: {x: number, y: number}
|
||||
|
||||
@ -254,8 +254,6 @@ export default class UWServer {
|
||||
}
|
||||
|
||||
async getCurrentSite(sender: Runtime.MessageSender) {
|
||||
this.logger.info('getCurrentSite', 'received get-current-site ...');
|
||||
|
||||
const site = await this.getVideoTab();
|
||||
|
||||
// Don't propagate 'INVALID SITE' to the popup.
|
||||
|
||||
@ -161,7 +161,8 @@ export default class EventBus {
|
||||
*/
|
||||
private sendToTunnel(command: string, config: any, context: EventBusContext = {}) {
|
||||
if (!context.visitedBusses) {
|
||||
console.error('Visited busses is missing from contextn. This is illegal.');
|
||||
// this should never trigger on production version of the extension.
|
||||
console.error('Visited busses is missing from context. This is illegal.');
|
||||
return;
|
||||
}
|
||||
context.visitedBusses = [...context.visitedBusses ?? [], this.uuid];
|
||||
@ -220,8 +221,8 @@ export default class EventBus {
|
||||
|
||||
const payload = event.data.payload as EventBusMessage;
|
||||
|
||||
console.info(this.name, 'received message from iframe. command:', payload);
|
||||
if (!payload.context?.visitedBusses) {
|
||||
// this should never be visible to a real user
|
||||
console.warn('Received iframe message without context. Doing nothing in order to avoid infinite loop. Event:', event);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -197,7 +197,6 @@ class Logger {
|
||||
|
||||
storageChangeListener(changes: any, area: any) {
|
||||
if (!changes.uwLogger) {
|
||||
console.info('We dont have any logging settings, not processing frther');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -364,8 +364,15 @@ export class AardDebugUi {
|
||||
Active: ${ar}, changed since last check? ${testResults.aspectRatioUpdated} letterbox width: ${testResults.letterboxWidth} offset ${testResults.letterboxOffset}<br/>
|
||||
<sup>(last: ${this._lastAr})</sup>
|
||||
|
||||
Paused until? ${Date.now() < timers.pauseUntil ? ((timers.pauseUntil - Date.now()) / 1000) + 's' : 'not paused'};
|
||||
<sup>now: ${Date.now()}ms; until:${timers.pauseUntil}ms; diff: ${(+timers.pauseUntil - Date.now())} </sup>
|
||||
${
|
||||
timers ?
|
||||
`
|
||||
Paused until? ${Date.now() < timers?.pauseUntil ? ((timers?.pauseUntil - Date.now()) / 1000) + 's' : 'not paused'};
|
||||
<sup>now: ${Date.now()}ms; until:${timers?.pauseUntil}ms; diff: ${(+timers?.pauseUntil - Date.now())} </sup>
|
||||
` :
|
||||
`- timers are missing -`
|
||||
}
|
||||
|
||||
|
||||
image in black level probe (aka "not letterbox"): ${testResults.notLetterbox}
|
||||
`;
|
||||
|
||||
@ -299,11 +299,13 @@ export class ClientMenu {
|
||||
}
|
||||
|
||||
private bindGlobalMouse(anchorEl: HTMLElement) {
|
||||
// const forceRecheckAfter = 5000;
|
||||
// let lastRecalculation = performance.now();
|
||||
|
||||
const playerRect = anchorEl.getBoundingClientRect();
|
||||
|
||||
let menuActivatorRect, cx, cy;
|
||||
|
||||
const activationRadius = this.getActivationRadius(anchorEl);
|
||||
let activationRadius = this.getActivationRadius(anchorEl);
|
||||
|
||||
const recalculateActivator = () => {
|
||||
menuActivatorRect = this.trigger.getBoundingClientRect();
|
||||
@ -314,22 +316,30 @@ export class ClientMenu {
|
||||
recalculateActivator();
|
||||
|
||||
this.onDocumentMouseMove = (e: MouseEvent) => {
|
||||
this.lastMouseMove = performance.now();
|
||||
const now = performance.now();
|
||||
this.lastMouseMove = now;
|
||||
|
||||
if (activationRadius) {
|
||||
if (! menuActivatorRect.width) {
|
||||
recalculateActivator();
|
||||
// activateWithCtrl is independent from other options.
|
||||
// Depending on user settings, UI can be triggered even if we aren't holding CTRL
|
||||
if (this.config.ui.activateWithCtrl) {
|
||||
this.isWithinActivation = e.ctrlKey;
|
||||
}
|
||||
|
||||
if (!this.isWithinActivation && this.config.ui.activation !== 'none') {
|
||||
if (activationRadius) {
|
||||
if (! menuActivatorRect.width || !menuActivatorRect.height) {
|
||||
recalculateActivator();
|
||||
}
|
||||
const d = Math.hypot(e.clientX - cx, e.clientY - cy);
|
||||
this.isWithinActivation = d <= activationRadius;
|
||||
|
||||
} else {
|
||||
this.isWithinActivation =
|
||||
e.clientX >= playerRect.left &&
|
||||
e.clientX <= playerRect.right &&
|
||||
e.clientY >= playerRect.top &&
|
||||
e.clientY <= playerRect.bottom;
|
||||
}
|
||||
const d = Math.hypot(e.clientX - cx, e.clientY - cy);
|
||||
this.isWithinActivation = d <= activationRadius;
|
||||
|
||||
} else {
|
||||
this.isWithinActivation =
|
||||
e.clientX >= playerRect.left &&
|
||||
e.clientX <= playerRect.right &&
|
||||
e.clientY >= playerRect.top &&
|
||||
e.clientY <= playerRect.bottom &&
|
||||
(this.config.ui.activation !== 'player-ctrl' || e.ctrlKey);
|
||||
}
|
||||
|
||||
this.updateVisibility();
|
||||
|
||||
@ -88,7 +88,6 @@ class UI {
|
||||
|
||||
'uw-show-settings-window': {
|
||||
function: (commandData, context) => {
|
||||
console.warn('received show settings window:', commandData, context, 'is global?', this.isGlobal);
|
||||
this.createSettingsWindow(commandData?.initialState);
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,14 +19,14 @@
|
||||
v-model="settings.active.ui.inPlayer.activation"
|
||||
@change="saveSettings()"
|
||||
>
|
||||
<option value="none">
|
||||
Never activate UI with mouse movement alone
|
||||
</option>
|
||||
<option value="player">
|
||||
When mouse moves over player, always
|
||||
</option>
|
||||
<option value="player-ctrl">
|
||||
When mouse moves over player, while holding CTRL key
|
||||
</option>
|
||||
<option value="distance">
|
||||
When mouse is close to the menu activator
|
||||
(experimental) When mouse is close to the menu activator
|
||||
</option>
|
||||
<!-- <option value="trigger-zone">
|
||||
When mouse moves over trigger zone
|
||||
@ -35,6 +35,18 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<div class="label">
|
||||
<input type="checkbox"
|
||||
v-model="settings.active.ui.inPlayer.activateWithCtrl"
|
||||
@change="saveSettings()"
|
||||
>
|
||||
</div>
|
||||
<div class="text-left">
|
||||
Also show on CTRL + mouse move
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-show="settings.active.ui.inPlayer.activation === 'distance'" class="field">
|
||||
<div class="label">
|
||||
Show menu when mouse is closer than:
|
||||
|
||||
@ -271,7 +271,6 @@ export default defineComponent({
|
||||
this.selectedTab = this.defaultTab;
|
||||
}
|
||||
|
||||
console.log('does event bus exist yet?', this.eventBus);
|
||||
if (!this.eventBus) {
|
||||
// inter-frame communication should be set up by eventBus for free
|
||||
this.eventBus = new EventBus({name: 'ui-window'});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user