-
-
Notifications
You must be signed in to change notification settings - Fork 318
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
Question: set position in bottom right instead of top left? #871
Comments
I have a same question |
Ran into this same issue myself. There is no good way to go about this in the library, so I used a wrapper. I know this question is old, but I'll leave this here for anyone needing this feature. Note, theres certainly more going on in my wrapper but I'll try to trim it down to only the relevant things so if a variable was missing, it's probably other options for me but no the core of the solution here. essentially what is happening is the first layout renders the rnd component and it's children with either defined width and height or 'auto' in the top left corner of the parent container with visibility hidden. once the browser handles that and the rnd component has its browser determined size, the useEffect will run, grab the calculated size as well as the size of the container, run the math based on flex-similar properties to position the still absolutely positioned rnd component around the screen wheerever it's needed if those options are selected and then bottom/right pixel values override that new position. onceall that is done, change visibility to 'visibile'. After that, I'm still using the standard on drag/resize callbacks to control the position with state as described in the documentation here. ` export interface WindowPositionOptions extends Partial { interface WindowPositionState extends Partial { const margin = 5; export type WindowJustify = 'left' | 'center' | 'right' | 'stretch'; export type WindowProps = Partial &
const maxPosition = { export const initJustifyAlign = (
}; export const Window: RA.FC<WindowProps, true> = ({
}; |
I had the same issue and for me, a simple initial effect that changes the position based on the element dimensions and the viewport size did the job:
|
Thank you. However, I think there should be an easier solution. |
I have a same question |
I have noticed that by default you can only initially place a Rnd element in a top left position, however, I want to place my element in the bottom right, so I need to set bottom-right to 0 and left the top left undeclared. I wish to know if that particular operation is possible, since it doesn't work with the style parameter.
The text was updated successfully, but these errors were encountered: