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

Bind actions to objects #39

Closed
squirrel289 opened this issue Aug 18, 2021 · 7 comments
Closed

Bind actions to objects #39

squirrel289 opened this issue Aug 18, 2021 · 7 comments

Comments

@squirrel289
Copy link

There is no direct way to access the user interaction within the model. It would be useful for such things as adding external info panels, popping up entity controls, etc.

Bind actions (I.e., via cardtools bindActionHandler) to entity-mapped objects in the model.

Other similar features requests have been made (like showing panel on hover). The approach of binding actions provides greater flexibility and would be a good starting point for the other requests as you could provide requested features as default behavior that users could override using custom actions.

@adizanni
Copy link
Owner

I have to study your proposed solution, in the meantime, please point me to other custom card implementing the concept and or code snippets to help me implement your suggestion.

@adizanni
Copy link
Owner

Hey Squirrel, the bindActionHandler is obsolete (still using lit-element); also the even handlers of the card are all captured by the THREE.js orbit control to allow for model zoom, move and rotation. I can use the double-click only but I need to find an alternative way compared to your proposed approach.

@adizanni
Copy link
Owner

Hey squirrel, please give me some advise if you are a card tool expert (the project is a little stalled: 2 years untouched now)

@adizanni
Copy link
Owner

Hello @JVital2013 are you familiar with this type of implementations ?

@squirrel289
Copy link
Author

I have not personally created any custom cards (thank you for ALL of the effort you’ve put into yours) but Thomas Lovén (https://github.com/thomasloven) is a bit of a legend

@JVital2013
Copy link
Contributor

Unfortunately not, but maybe I can give a bit of insight.

I think we might have more flexibility than just double-click with THREE. See this example: https://jsfiddle.net/41aun97x/1/. It lets you do a single-click. I was even able to get some hover functionality by changing the addEventListener call on line 92 of the example.

If you can get this kind of Event Listener to work in Floor3D-Card, you could then couple it with this._hass.fireEvent to perform hass-more-info, or this._hass.callService to do some other action on an entity.

From there, I can envision a new type3d called "custom" that lets you specify:

  • Associated entity
  • Trigger (mouseover, click, double-click, etc)
  • Action (hass-more-info, call service, etc)

I'm not 100% sure how to implement this - just spit-balling

@adizanni
Copy link
Owner

Hello guys, I do not think this is going to happen in the short term. I've added a link to this issue in the Project 2.0 (https://github.com/adizanni/floor3d-card/projects/2#card-73036987). But I close it here because I do not want to have very long running issues I know I cannot work on.

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

3 participants