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 Request | allowing new function props "onBeforeHeightMatched" and "onAfterHeightMatched" to trigger before/after height matched #11

Open
tandrasi opened this issue Oct 24, 2024 · 4 comments

Comments

@tandrasi
Copy link

I have the code already done and ported from 1.3.0 to 2.0.2, but please see my previous issue #10 .

I am happy to do a pull request. The issue I am using a dependency of "use-debounce".

What are your thoughts? I have this working perfectly.

/** Function to call when height matching is triggered, but before heights are matched */
onBeforeHeightMatched?: () => void;

/** Function to call after heights are matched */
onAfterHeightMatched?: () => void;

@loba-b
Copy link
Owner

loba-b commented Nov 20, 2024

Hi @tandrasi,

I want to clarify your suggestion. Are you proposing to add use-debounce as a dependency to the library? If so, I’d prefer to avoid adding unnecessary dependencies, so I’d rather not include it.

If you’re suggesting adding simple events directly to the library, I’ve already implemented a custom event starting from version 2.0.0. You can find more details about it in the README.

Let me know if I misunderstood or if you have further ideas!

@tandrasi
Copy link
Author

Thanks for the response. I agree that additional dependencies are not desirable. I have quickly glanced over the event emitted via the readme and I think it can be iterated upon to include the functionality I'm suggesting!

Fire an event when height matching has started, and then another one when all calculations have completed AND animation has completed.

This functionality was imperative for me to implement for a project that uses extremely complex and heavy calculations to render svg lines between elements on a map-type canvas. I needed to ensure all heights were matched and animations done before triggering recalculations of element positionings and svg drawings otherwise coordinates would be wrong.

@loba-b
Copy link
Owner

loba-b commented Nov 20, 2024

So just to confirm, do I understand correctly that the functionality you needed can be achieve using the custom events already available in the library? If so, can I close the topic?

@tandrasi
Copy link
Author

No I don't have this implemented with the "event" emitter as I don't think it can currently handle the complexity I'm after. However, I do have my own branch on which I have already implemented the callback functions as mentioned in this original post. So it's more of a suggestion. But the event stuff seems promising, just maybe needs more fleshing out.

My current version debounces the requests and ensures to fire the callback after all heights are matched and animation times accounted for.

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