-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[Core] Add relative modifier #1711
Copy link
Copy link
Closed
Labels
featureThis would be nice to have.This would be nice to have.
Description
Hey,
thanks for creating the library
I'm suggesting to add a relative modifier to the library, which let's you align tooltips relative to element from another context
The use-case for this is aligning tooltips within iframes or on canvas (where you know the relative coordinates upfront)
Here's the modifier code:
const relative = {
name: 'relative',
fn: ({ x, y, element }) => {
const rect = element.getBoundingClientRect()
return {
x: rect.left + x,
y: rect.top + y
}
}
}without relative modifier
Screen.Recording.2022-05-22.at.14.16.51.mov
with relative modifier
Screen.Recording.2022-05-22.at.14.17.03.mov
you can already achieve similar functionality by using virtual elements
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
featureThis would be nice to have.This would be nice to have.