Is there a way to resize plugin window via JS?

I’m trying to find a way to resize my plugin window in UXP?

With CEP I used to use:

csInterface.resizeContent(width, height);

Is there something similar in UXP?

Thanks!

Mario OM

It was already asked and it seems no update

1 Like

This is something that should be implemented.

Hi @indranil, Is there any plan to introduce the feature for dynamic resizing of panel windows via code in future versions of the UXP platform? This capability would be very useful for creating more flexible and adaptable interfaces.

TBH, unless there’s an option to turn off auto-resize, I would not want this. Usually I dock panels somewhere and resize would create a mess :confused:

hi @Karmalakas
By dynamic, I mean the ability to programmatically change the dimensions of the panel.

Yes, I understand :slight_smile: When I dock the panel, I usually adjust the size manually to place it where and how I wish, to make my workflow comfortable and consistent. If panel would get resized depending on some of my actions (or worse - depending on some actions, that developer decides), that would ruin the layout I’ve set up, thus ruining my usual workflow to reach the panels. In these cases I don’t mind having scrollbars, but the size should not change.

IMO, if panel requires a size change, maybe the design (not necessary visual) is flawed. Maybe there should be some dialog or maybe even a completely separate panel with different interface :thinking:

I wonder what the use cases would be for actually justifiable panel size change without user actually changing the size manually

I simply think it should be an additional feature so that if you don’t like it, you simply don’t use it and continue resizing your panel manually. I am creating widgets for color grading like curves, horizontal curves, vectorscope, etc. There are cases where I want to dynamically resize the panel to optimize space or to see them larger. Many software programs allow dynamic resizing of their panels.

1 Like

I would love to be able to also dynamically resize a Modal window with it open. @svumme this feature would be a great option.

1 Like

Oh, I would be interested in those, but I’d love to have them in separate panels freely resizeable so I could have curves and vectorscope open at the same time

Hello @svumme, this feature is there in our backlog but not planned for this year. On a related note, would a resizable window/dialog work for your use case?

1 Like

@indranil Can a window/dialog box resize with a click event on it?If yes, could you please share the JS logic? I’m not sure, but I don’t think this is documented

Thank you for the response! Yes, but only if they are non-modal windows, in that case, they would be useful.

Unfortunately, the documentation of dialog options and overall dialogs is well…abysmal to be candid :grimacing:. We are working on updating the dialog documentation, it shall take some time but it shall be done. Here’s how you can try out a dialog that resizes upon clicking a button in it.

<!DOCTYPE HTML>
<html>
<head>
    <script src="main.js"></script>
</head>
<body>
    <button id="show-dialog">Show dialog 3</button>
</body>
</body>
</html>

and in main.js:

document.getElementById("show-dialog").addEventListener("click", (e) => {
    const dialog = document.createElement("dialog");
    document.appendChild(dialog);
    const resizeButton = document.createElement("button");
    resizeButton.innerText = "Click to resize";
    resizeButton.addEventListener("click", (e) => {
        // random size on every click
        dialog.resizeTo(
            Math.floor(Math.random() * 50) + 500,
            Math.floor(Math.random() * 50) + 500
        );
    });
    dialog.appendChild(resizeButton);
    dialog.show({
        "size": {
            "width": 300,
            "height": 500
        }
    });
});
7 Likes

Yes, you can try my above code snippet for a non-modal dialog to see if it suits your use case.

1 Like

Tested and approved, this works perfectly! Luckily this feature is already available in the API, it was just hidden, this is essential in my projects. @indranil thanks for sharing, great support, and taking advantage of the fact that you have frequently visited this community, as soon as you can, visit this topic:Object: printOneCopy does not work from the UXP plugin and inform us there about the implementation of this feature. Thanks.

That’s fantastic! Perfect for me, thank you so much!

@PS-fxrios I did check the print related thread that you directed me to and that’s something that the Photoshop team would need to add in the PS DOM. Unfortunately, it’s not something that’s slated for this year.

1 Like

@indranil thanks for responding to the complaint. I am improvising using atn actions for such print settings and run them via jsx in my UXP modal window.