Skip to content

Commit

Permalink
Colors.view.ViewportController: allow detaching widgets from within a…
Browse files Browse the repository at this point in the history
… LivePreview inside the portal app neomjs#5477
  • Loading branch information
tobiu committed Jun 23, 2024
1 parent 100fb06 commit 6b127ab
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
7 changes: 3 additions & 4 deletions apps/colors/childapps/widget/neo-config.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{
"appPath" : "../../apps/colors/childapps/widget/app.mjs",
"appPath" : "apps/colors/childapps/widget/app.mjs",
"basePath" : "../../../../",
"environment" : "development",
"loadApplicationDelay": 100,
"mainPath" : "../../../src/Main.mjs",
"mainPath" : "./Main.mjs",
"mainThreadAddons" : ["AmCharts", "DragDrop", "Navigator", "Stylesheet"],
"themes" : ["neo-theme-dark"],
"useSharedWorkers" : true,
"workerBasePath" : "../../../../src/worker/"
"useSharedWorkers" : true
}
10 changes: 7 additions & 3 deletions apps/colors/view/ViewportController.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,16 @@ class ViewportController extends Component {
* @param {String} name The name of the reference
*/
async createBrowserWindow(name) {
let me = this,
url = `./childapps/widget/index.html?name=${name}`;
let me = this,
{windowId} = me,
{windowConfigs} = Neo,
firstWindowId = parseInt(Object.keys(windowConfigs)[0]),
{basePath} = windowConfigs[firstWindowId],
url = `${basePath}apps/colors/childapps/widget/index.html?name=${name}`;

if (me.getModel().getData('openWidgetsAsPopups')) {
let widget = me.getReference(name),
winData = await Neo.Main.getWindowData(),
winData = await Neo.Main.getWindowData({windowId} ),
rect = await me.component.getDomRect(widget.vdom.id), // using the vdom id to always get the top-level node
{height, left, top, width} = rect;

Expand Down
2 changes: 1 addition & 1 deletion examples/component/multiWindowHelix/ViewportController.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class ViewportController extends Controller {
me.component.add(controlsPanel)
}
// Close popup windows when closing or reloading the main window
else {
else if (appName === 'Neo.examples.component.multiWindowHelix') {
Neo.Main.windowClose({names: me.connectedApps, windowId})
}
}
Expand Down

0 comments on commit 6b127ab

Please sign in to comment.