Git Product home page Git Product logo

Comments (9)

Renovamen avatar Renovamen commented on June 27, 2024

Got it, will be fixed later. Thank you!

from playground-macos.

Renovamen avatar Renovamen commented on June 27, 2024

Hmmm it seems harder than I thought. Before making the dropdown menu always overlay windows, I have to limit the movement boundary of windows below topbar, or the ui will seem strange. However, I use react-rnd for dragging and resizing windows and it's not easy to set boundaries in react-rnd...

I'll try to find out a solution but this issue may not be solved immediately. (Also, pull requests are welcome

from playground-macos.

mirkoRainer avatar mirkoRainer commented on June 27, 2024

I recommend looking for something to overlay the dropdown so that it is always rendered on top of things at a fixed positive.
https://www.npmjs.com/package/react-overlays comes to mind but might not be the right solution.

Is this what you tried?

from playground-macos.

Ashiria7 avatar Ashiria7 commented on June 27, 2024

I try to set z-index of the dropdown menu and the top toolbar (the div of dropdown menu), it seems to work well. In my opinion, the z-index of top toolbar and the dropdown menu should be the max of the page so that it can always show over other element.
image

from playground-macos.

Renovamen avatar Renovamen commented on June 27, 2024

I try to set z-index of the dropdown menu and the top toolbar (the div of dropdown menu), it seems to work well. In my opinion, the z-index of top toolbar and the dropdown menu should be the max of the page so that it can always show over other element.
image

That's right. However, in that way, when dragging the window to the top of the screen, it will be overlapped by the topbar, which seems weird:

image

So I guess I should limit the movement boundary of windows below the topbar (red line), but it's seems not easy in react-rnd...

from playground-macos.

Ashiria7 avatar Ashiria7 commented on June 27, 2024

I try to set z-index of the dropdown menu and the top toolbar (the div of dropdown menu), it seems to work well. In my opinion, the z-index of top toolbar and the dropdown menu should be the max of the page so that it can always show over other element.
image

That's right. However, in that way, when dragging the window to the top of the screen, it will be overlapped by the topbar, which seems weird:

image

So I guess I should limit the movement boundary of windows below the topbar (red line), but it's seems not easy in react-rnd...

I never use react before(always using vue), so it maybe hard to change the code directly and properly for me. I just read the doc of react-rnd and I understand the question is to ensure that the x and y of the window do not extend beyond the desktop area. And I find that the problem can be solved with putting the rnd in a div. I try to write a example. Hope it can help you deal with this issue.

from playground-macos.

Renovamen avatar Renovamen commented on June 27, 2024

I just read the doc of react-rnd and I understand the question is to ensure that the x and y of the window do not extend beyond the desktop area. And I find that the problem can be solved with putting the rnd in a div. I try to write a example. Hope it can help you deal with this issue.

@AXiLiYa Thank you for your detailed explanation and example. Yes, theoretically, movement boundaries can be set using div in react-rnd. But this would be difficult in practice in this case, because the size and position of the boundary div should adapt according to the window size. Here's a simple sketch:

image

For window1 (blue), the boundary div should be the blue box. But for window2 (another window, or resized window1), the boundary div transforms to the red box.

So in my opinion, this way is neither easy nor elegant. I guess it would be much easier if react-rnd provides a way to set bounds prop with a position object, just like what react-draggable (one of react-rnd's dependencies) does. I'll try to submit a pr to react-rnd when I have time (although I hope some others could do it hahaha

from playground-macos.

Renovamen avatar Renovamen commented on June 27, 2024

@mirkoRainer @AXiLiYa Hi, finally I took @AXiLiYa's advice and added a boundary for rnds via putting them in a parent div. In fact it's much easier than I thought hahaha. Now this problem should be solved, have a look at the website. Thank you!

from playground-macos.

mirkoRainer avatar mirkoRainer commented on June 27, 2024

Nice!

from playground-macos.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.