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

Feature: Mouse Support #29

Closed
unikzforce opened this issue May 3, 2021 · 4 comments
Closed

Feature: Mouse Support #29

unikzforce opened this issue May 3, 2021 · 4 comments

Comments

@unikzforce
Copy link

This has been implemented in this repository:
https://github.com/jroimartin/gocui

@meowgorithm
Copy link
Member

Hi! Lip Gloss is strictly for rendering only. That said, it works wonderfully with Bubble Tea, a terminal user interface framework which features mouse support.

@unikzforce
Copy link
Author

Wow, How cool is this ecosystem :) thanks man

@ghost
Copy link

ghost commented May 21, 2021

@meowgorithm I'm struggling with how to detect mouse clicks in a bounding box of something generated by Lipgloss. I believe it's not possible in Bubbletea's current state, but I'd love to be wrong about this:

Let's say you wanted to make those fancy tabs in the Lipgloss demo respond to clicks. You'd have to calculate the bounding box of each tab, but mouse events get passed through the Update method, while all of the Lipgloss work happens in the View method. I tried some unmentionable ugly hacks that break the functional nature of the Elm architecture for storing bounding boxes in the model that are computed during the View cycle, but clearly not a sustainable way to continue. The only other thing I can imagine is abstracting the view rendering code into a function that gets recomputed on both View and optionally Update when required, that attaches additional hitbox data to each cell to compare a mouse event with some identifier (some 3D games work this way).

Any suggestions or ideas?

@meowgorithm
Copy link
Member

meowgorithm commented May 21, 2021

@winduptoy Hi! I know exactly your plight, and you're correct that it's not an easy task at the moment. We're actually putting the finishing touches on updates for both Lip Gloss and Bubble Tea that will address exactly what you want to do here. I'll update this issue with progress, but expect a release soon.

(Related: charmbracelet/bubbletea#79)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants