suppose that I have created this panel and have modified sizes of the children to my favorable size.
Now I understand that there is some spare space at the bottom of the panel and since I have little space for other panels, I decide to cut this spare space.
But whenever I do all of the children get smaller and thiner!
I know that I can change size of the panel and then resize its children to my favorable size. But is there an easier way in order to not wasting time?
I assume you are using GUIDE.
This is related to resize behaviour. If you follow Tools-> GUI Options you can see the combobox for resize behaviour. Yours is probably set to "Proportional".
If you change it to "Non-resizable", you will be able to resize your panel without affecting children sizes. You can change it back to "Proportional" after you are done.
Related
I currently have a problem on a UI.
The button on the phone moves when changing resolution and changes size as well. On the screenshots, it is in the General Panel. I also tried to put a second panel of the size of the phone, but it is all this panel that moves and changes size. How can I do, to keep the buttons at the right size and in place, as the background does when changing resolution?
Thanks in advance !
You need to change the UI Scale Mode to "Scale With Screen Size".
THe Reference Resolution can help you place items in the editor. You can choose wether you want the width or the height (or a mixture) to be preferred when fitting the canvas to the resolution.
If you, for example, choose "Width" in the "Match" slider, the elements will never overshoot horizontally. This would be perfect for wrapping textfields.
This is my hierarchy in the Unity scene:
Vertical Layout Group
ScrollView (Horizontal)
Text (Very long)
I set the graphics to work perfectly in portrait mode with mobile device screens. But when I use the graphics on a tablet, or when I rotate the device, I have to enlarge the elements, and here the problem arises.
I can't find the correct way to expand the elements, I want many ScrollViews in the Vertical Layout Group, and I want to be able to scroll horizontally to view the texts inside, that's what I'm asking.
The question is convoluted and complex to explain, I explain it in three different ways (talking about the same thing, so they may seem similar), you choose which one is more understandable to you:
Explanation 1
The Vertical Layout Group expands autonomously, covering a large part of the screen.
The problem arises when I have to decide how to enlarge the ScrollView, I cannot use the anchors because they are replaced by the Vertical Layout Group, and I cannot use the "Control Child Size" and "Child Force Expand" option, because it would expand beyond the Vertical Layout Group, if the text component inside was longer, thus making the Scroll useless.
I want the ScrollView to expand only within the limits of the Vertical Layout Group, and therefore not be affected by the length of the internal text component (so that I can scroll it) (PS. I cannot use a Layout Element, because the text can vary both horizontally and vertically, and because the ScrollView is equipped with another Vertical Layout Group (I need it to manage the vertical development of the text, if it want to expand in height))
Explanation 2
I would like the ScrollView to expand horizontally until it touches the limits of the Vertical Layout Group.
This I would be able to do by enabling "Control Child Size" and "Child Force Expand".
However, I would like one more thing, which is that the ScrollView does not expand beyond the limits of the Vertical Layout Group. This problem is caused when the Text component (of variable size) will be longer than the length of the Vertical Layout Group.
I would therefore like the ScrollView to expand into the Vertical Layout Group, without being influenced by the size of the child.
Explanation 3
Trying to seem clearer, to enlarge the ScrollView to the limits of the VLG, I have to enable both "Control Child Size" and "Child Force Expand" (I can't use anchors, because it's the same VLG that replaces them with its own), but putting "Control Child Size", if the child Text were to be longer than the VLG, it would make the ScrollView enlarge (and I don't want this to happen! otherwise the ScrollView, if it were as long as its component, would make no sense! I want that the ScrollView stretch to the limits of the VLG, but don't exceed them!)
Enabling "Control Child Size" and "Child Force Expand" in the VLG made the ScrollView dependent on the length of the child. However, by also enabling "Control Child Size" in an additional VLG in the ScrollView, the problem vanished. In practice, the ScrollView stops depending on the child, so it is it who controls, instead of being controlled.
After the clarification, I believe I understand what you'd like to achieve. If this is not what you'd like, please correct my implementation so I can answer the question properly.
Here is the hierarchy I have set up.
Here is the UI working with the current setup.
As the UI is rather extensive, if you make any changes at runtime, you will need to make calls to rebuild the layout if you happen to change the text's length. The scroll will not change properly in a single update cycle. To update it at runtime, you can make a call to LayoutRebuilder.ForceRebuildImmediate while passing in a proper RectTransform for rebuilding.
I may have misunderstood the question, but is this solved by just changing the anchor points of the ScrollView to fit the Vertical Layout Group (no "Control Child Size" and "Child Force Expand" needed):
Using Anchor points to stretch to fit the parent object:
My problem is very difficult to describe, so hopefully (with the pictures I provide) someone can help me figure this out. If you are confident you can fix it, I'm willing to pay if I have to. I need this fixed.
I cannot for the life of me figure out how to work with the Unity canvas/layout groups. I have a series of canvases that only show one at a time (think of them as screens). Inside each canvas are components (the first one is a graph and timer, and then a data panel and some buttons.
Here is an image of what I'd like each of the panels to look like (only one of these will be open at a time):
Essentially, I just want each sub-canvas (the dark gray boxes) to inhabit ~50% x 50% of the screen, and when the orientation is horizontal/vertical, tile them accordingly.
Each Child panel (the dark gray) only needs to change. The children inside of the panel can stay and scale relative to the parent canvas.
I have tried EVERYTHING, dug through the documentation, and have run out of options.
Have you tried adding a Layout Element to all of those gray panels with a Flexible Width or Height setting? The screenshot below shows how to have two panels that are side by side, both occupying half the width of their container. (Both have a Flexible Width setting of 1.)
The two Panels are children of the Canvas that has a Horizontal Layout group like this:
I'm working on a Perl/Tk GUI. It will have three main areas. Two of them side by side on top and then another one below the two.
I could just use grid geometry management. The upper two would have a row weight of 2. The lower one would have a weight of 1.
This would be good for the starting position, but the user needs the ability to adjust the sizes.
Looking at the Tk documentation, PanedWindows can also have a weight, but I can't figure out how to access it.
As I have it now, with my Paned frames, the upper and left children are minimum size, everthing else fills the area below and to the right. If I adjust the main window. only the lower and right windows are resize. Worst of all, I can resize the window and make some of the children disappear.
I want to maintain the current relative sizes.
How do I do this? I'm not tied to paned, grid, pack. Whatever works.
Sounds like you are using frames in Tk. While I have never used Perl/Tk, I am kind of savy html which Tk is probably based on html. So, you might want to look into frames and framesets at Frames in HTML documents on the W3C site.
It sounds like you need 1 frameset with 2 frames for the top and another frame for the bottom.
I hope that this helps.
I'm investigating the feasibility of using Raphael for a user-research project. One of the features allows for users to drag images onto a canvas and we record where they placed it. The pool of images is potentially quite large and we'll have them in a scrollable box in the tool.
I put together a quick wireframe of the issue I'm looking into since it'll probably be clearer than my explanation.
Please see the wireframe:
I'd stick with straight HTML/CSS and use jQueryUI draggables, as you mention in your comment.
You don't appear to need any of the drawing/display features SVG offers, yet if you went that route, you'd have to build your own custom scrolling behavior (instead of setting a CSS overflow-y rule) and picture layout algorithms (again instead of using CSS floats or something).
You can create a scrollable region using Raphael.
Create the viewport with fixed
dimensions (say 800x600)
Draw the images with increasing y value. After few images, the y value will go beyond 600. It will be drawn but will not be visible in the viewport.
Create a scrollbar using raphael rects. Attach drag events to the scrollbar handle rect.
When the handle is moved, translate all the images accordingly.
For e.g. lets assume in step 2, you had drawn all the images and the bottom most point of the end image is having y value 2000. Assuming the scrollbar has length 500, each dx movement of the handle will have to translate 2000/500 = 4dx. You can calculate the handle length similarly using ratios.
Since everything inside a single Raphael paper the dragging of images will work seamlessly. You will have to maintain the positions of each images.
You might find this demo similar
Remember you can always use getBBox when you drop. In this case it's rects but images would be the same..
http://irunmywebsite.com/raphael/additionalhelp.php?q=bearbones