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

Dragging causes "wiggle" when resize handles are clicked #917

Open
atrauzzi opened this issue Dec 21, 2023 · 2 comments
Open

Dragging causes "wiggle" when resize handles are clicked #917

atrauzzi opened this issue Dec 21, 2023 · 2 comments

Comments

@atrauzzi
Copy link

Screencast.from.2023-12-20.19-31-02.webm

I'll do my best to explain, but basically what you're seeing in the video is an instance of rnd. If I don't drag the component at all, clicking the resize handles is fine and doesn't cause that horizontal wiggle/wobble. If I attempt to move the element in any direction however, it starts popping to one side or the other. The last thing I do at the end of the video is perform multiple drags "past" the bounds element. Even though the box doesn't move past the bounds, it still seems to be registering some change in value internally as the wiggle becomes wayyy more pronounced after doing so.

I have no clue what is causing this as I can observe the behaviour under just about every circumstance. But I feel like there might be state in the background that's changing when it shouldn't be??

This is basically what I have:

    <div
        ref={boxRef}
        style={{
            position: "relative",
            width: "100%",
            height: "100%",
        }}
    >
        <ul>
            <li>one</li>
            <li>one</li>
            <li>one</li>
            <li>one</li>
            <li>one</li>
            <li>one</li>
            <li>one</li>
            <li>one</li>
            <li>one</li>
            <li>one</li>
            <li>one</li>
            <li>one</li>
        </ul>
        <Rnd
            dragAxis="y"
            default={{
                x: 80,
                y: 0,
                width: "300px",
                height: "20px",
            }}
            bounds={boxRef.current}
            enableResizing={{
                bottom: true,
                top: true,
                left: false,
                right: false,
                topLeft: false,
                topRight: false,
                bottomLeft: false,
                bottomRight: false,
            }}
            dragGrid={[20,20]}
            resizeGrid={[20,20]}
        >
            <div
                style={{
                    width: "100%",
                    height: "100%",
                    backgroundColor: "#18058F6F",
                    borderRadius: "5px",
                }}
            />
        </Rnd>
    </div>
@JChouCode
Copy link

I think it's a problem with dragAxis "y", its a bug that hasn't been fixed yet.

@bokuweb
Copy link
Owner

bokuweb commented Apr 21, 2024

@atrauzzi Sorry, thanks for your report. Could you please provide project in codesandbox?

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