Last active
October 12, 2023 02:46
-
-
Save adig/e570578e34e6c0e29fa5b5bca21b83f3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let x = 0, y = 0, col = 0, maxCols = 20, rowHeight = 0, width = 0, height = 0; | |
| MQAPI.workspace.startOpBatch(); | |
| MQAPI.workspace.sidebar.view.get('all_stencils') | |
| .map((stencil) => { | |
| return stencil.get('name'); | |
| }) | |
| .forEach(function(stencilName) { | |
| let stencil = MQAPI.canvasManager.addStencil({ | |
| name: stencilName, | |
| x, | |
| y | |
| }); | |
| x += stencil.width + 10; | |
| rowHeight = Math.max(rowHeight, stencil.height); | |
| width = Math.max(x, width); | |
| height = y + rowHeight; | |
| col += 1; | |
| if(col > maxCols) { | |
| col = 0; | |
| x = 0; | |
| y += rowHeight + 10; | |
| } | |
| }); | |
| MQAPI.workspace.activePage.setPageSize({ | |
| width, | |
| height | |
| }); | |
| MQAPI.workspace.endOpBatch(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment