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

Left Menu Paddle Sticking #61

Open
kglebows opened this issue Dec 6, 2024 · 1 comment
Open

Left Menu Paddle Sticking #61

kglebows opened this issue Dec 6, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@kglebows
Copy link
Collaborator

kglebows commented Dec 6, 2024

image

it should 'stick' to the selected option and highlight whatever option is displayed on the right
image

( my old JS had that )

function stickPaddleToMenuOption(paddle, option) {
	  const optionRect = option.getBoundingClientRect();
	  paddle.style.top = `${optionRect.top + optionRect.height / 2 - paddle.offsetHeight / 2}px`;
	}

	leftMenuOptions.forEach(option => {
	  option.addEventListener('mouseenter', () => stickPaddleToMenuOption(leftPaddle, option));
	});

	rightMenuOptions.forEach(option => {
	  option.addEventListener('mouseenter', () => stickPaddleToMenuOption(rightPaddle, option));
	});

	updatePaddlePositions();
	window.addEventListener('resize', updatePaddlePositions);

	rightMenuContainer.addEventListener('mouseover', event => {
        const option = event.target.closest('.menu-option');
        if (option) {
            stickPaddleToMenuOption(rightPaddle, option);
        }
    });

    // Use event delegation for statically loaded content in the left-menu
    document.querySelector('left-menu').addEventListener('mouseover', event => {
        const option = event.target.closest('.menu-option');
        if (option) {
            stickPaddleToMenuOption(leftPaddle, option);
        }
    });

and

	leftMenuOptions.forEach((leftOption, index) => {
	  leftOption.addEventListener('mouseover', () => {
		if (currentIndex !== index) {
		  loadRightMenuContent(index);
		  highlightLeftOption(index);
		  currentIndex = index;
		}
	  });
	}
	function highlightLeftOption(index) {
	  unhighlightLeftOptions();
	  const button = leftMenuOptions[index].querySelector('button');
	  button.classList.add('glowing-effect');
	}

	function unhighlightLeftOptions() {
		leftMenuOptions.forEach(option => {
		  const button = option.querySelector('button');
		  button.classList.remove('glowing-effect');
		});
	}
@kglebows kglebows added the bug Something isn't working label Dec 6, 2024
@RealConrad
Copy link
Owner

RealConrad commented Dec 6, 2024

I do not plan on implementing/fixing this.

Will add it if I have time this weekend.

@kglebows kglebows self-assigned this Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants