Skip to content

Conversation

@kfritsch
Copy link

@kfritsch kfritsch commented Dec 16, 2021

Feature Request
I would find it more intuitive if the from and to elements were searched exclusively within the within element if that prop is specified in the component LineTo. This would make specifying the selector classnames a little easier, when the same element occurs multiple time within the dom. This would NOT be a breaking change. From and to have to be within this within element in order to be placed relative to that element, since the placement is computed with regards to the within element.

I would also find it more intuitive to be able to pass any css selector to from, to and within and use querySelector to find the element. Being able to pass an id to identify an element within the dom would make a lot of sense after all. However this would be a breaking change so I did not add this with this pr.

Copy link
Owner

@kdeloach kdeloach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good idea. But I'm not familiar enough with the within feature to merge this yet.

What this could use is a demo to showcase how this works and what problem it solves. The demo would also help to verify if this is a breaking change or not so I could update the package version accordingly.


findElementWithin(className, within) {
return within.querySelector(`.${CSS.escape(className)}`);
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be more or less equivalent to the existing findElement method. Maybe we could add an optional param to the original method instead?

    findElement(className, parent=document) {
        return parent.getElementsByClassName(className)[0];
    }

offsetY -=
parentBox.top +
(window.pageYOffset || document.documentElement.scrollTop) -
parent.scrollTop;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The formatting of these lines seems off.

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

Successfully merging this pull request may close these issues.

2 participants