Object's position moves when selecting multiple in fabric.js - fabricjs

If select one object, there is no problem.
However, if you select two or more objects by dragging, the position of is moved as shown on the screen below.
Why is the value of "top" and "left" changing when you make multiple selections?

After trying n-number of solution I figured out the solution to this problem. It was something related to the zoomed canvas. Now it works fine!

Related

Creating a custom layout for horizontal buttons with wrapping

I wasn't sure what to title this without explaining it all there. Essentially, I want to populate part of a screen with a bunch of buttons. The buttons should have text from an ArrayList (or other structure) and they should be aligned horizontally to each other from the left to the right of the screen. When there is no more room to the right, it starts a new row. I've attached an example. Example layout here
I know how to make custom list adapters for my objects and how to make listeners for parts within the list items, but I'm just not sure how to make the "list" of buttons go horizontally with wrapping to the next line.
It seems https://github.com/google/flexbox-layout might help you.
You can use FlexboxLayoutManager as adapter, or simply place all the buttons inside FlexboxLayout, they will wrap automatically depending on their width.

Style Grid border in case Grid height is calculated

I have a case which want to get vaadin-grid the maximum height possible in screen.
So, this is easy.
the problem is that despite the vaadin-grid size is ok, the tbody might be shorter than vaadin-grid.
So, whenever there is not enough rows we get empty space.
it would be ok in case had no border. But, because we do use border on the grid, empty space comes up.
Sure can shift the border to thead and tbody and get it looks good, but than the opposite happen cause bottom border will get lost when tbody in longer than vaadin-grid.
Is there a clean way, non dirty js, to distinguish cases? something else?
Thanks
I think you should be able to get at least very close by using the :host([overflow~="bottom"]) state attribute selector. Add/remove the borders based on that. The overflow attribute value changes based on if rows are overflowing the from the bottom of the grid viewport.
The only issue I see is that the border will disappear when the user scrolls to the bottom of the grid.

How to zoom a sheet in revit api?

I wrote an external command that creates detail views for doors, windows, etc and puts each object in a separate sheet.
Sometimes the new sheets are zoomed-out by default (the yellow circle shows the actual sheet).
I guess it has to do with the witness lines (in the blue circle).
Sheet zoomed out
I tried activating the views and then found their uiView and used the zoom methods but they don't seem to make a difference (possibly because they work in model coordinates and not in sheet outline coordinates).
uv.ZoomToFit();
Manual zoom-to-fit works fine.
Also, the sheet's outline property is correct (not too large).
Any ideas?
Thanks!
You can use the ShowElements method to zoom to an element. That does the same as zoom-to-fit to a specific set of elements. The element may possibly also be the sheet itself.
The Building Coder discusses how that can also be used to Switch View or Document.
Also, look at displaying a text file from a TaskDialog command link.

Can't resize columns in grid

I have several custom screens which have grids. On all but one of them I can resize the columns. In the one where I can't resize, I'm using BLC code to determine when to hide the column and what to display as the name of the column. I do this as follows:
PXUIFieldAttribute.SetVisible<xTACOpenSourceDetail.string03>(OpenSourceDataDetail.Cache, null, true);
PXUIFieldAttribute.SetDisplayName<xTACOpenSourceDetail.string03>(this.OpenSourceDataDetail.Cache, ossd.String03);
All my grids are set up the same way, except for this one difference. Is there an attribute or property I can set to make sure these columns are sizable as well?
After dissecting this for a while, The solution I've come up with was to re-create the entire screen from scratch. This corrected the issue, and I can only conclude that something became corrupted within the original screen and could not be refreshed or recompiled. It is still unknown what caused the issue to begin with.

TableWrapData: widgets won't left align properly

My program uses TableWrapLayout with numColumns set to 2. I then have the following code: (background colors are set to show you that the widgets aren't using the blank space).
Label label = toolkit.createLabel(container, "Resource Type":);
label.setLayoutData(new TableWrapData(TableWrapData.LEFT,TableWrapData.MIDDLE));
label.setBackground(DiagramSettings.NODE_BACKGROUND_COLOR);
resourceComboMenu = new Combo(container, SWT.READ_ONLY);
resourceComboMenu.setBackground(DiagramSettings.NODE_BACKGROUND_COLOR);
resourceComboMenu.setLayoutData(new TableWrapData(TableWrapData.LEFT,TableWrapData.MIDDLE));
However as you can see in the picture the combo box refuses to left align properly. But that I mean I want it to start right after the label, not have a bunch of blank space.
One workaround would be to put the row inside it's own Composite just like I do Resource Icon and Geolocation. But I feel like I shouldn't need to since the widgets on this row equals the number of columns set by the layout. I've created this workaround for now but would like to understand this TableWrapData behavior for the future.
Any insight would be helpful, thanks.
I pretty much answered my question in the question. The composite that contains everything in the picture had TableWrapData with columns set to 2. TableWrapData essentially draws a straight, vertical line between each column then makes sure widgets from one column don't cross it.
So to fix this (like I mentioned in my question) you simply make another composite with nested widgets (which in the case would be the resource type label and resourceComboMenu). I just didn't realize that is what you're supposed to do.

Resources