Skip to content

Commit 7df91d5

Browse files
committed
set width dynamically
1 parent 9cb44e0 commit 7df91d5

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,6 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
136136
this.__nonGroupedContainer.add(card);
137137
this.self().sortListByPriority(this.__nonGroupedContainer);
138138
}
139-
/*
140-
if (this.getMode() === "list") {
141-
const width = this.getBounds().width - 15;
142-
card.setWidth(width);
143-
}
144-
*/
145139
} else {
146140
console.error("ToggleButtonContainer only allows ToggleButton as its children.");
147141
}
@@ -236,11 +230,6 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
236230
resourceData: resourceData,
237231
tags
238232
});
239-
if (this.getMode() === "list") {
240-
const bounds = this.getBounds() || this.getSizeHint();
241-
const width = bounds.width - 15;
242-
card.setWidth(width);
243-
}
244233
const menu = new qx.ui.menu.Menu().set({
245234
position: "bottom-right"
246235
});
@@ -260,6 +249,18 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
260249

261250
__addCardToContainer: function(card, container) {
262251
container.add(card);
252+
253+
if (this.getMode() === "list") {
254+
[
255+
"appear",
256+
"resize",
257+
].forEach(ev => {
258+
container.addListener(ev, e => {
259+
const data = e.getData();
260+
card.setWidth(data.width);
261+
});
262+
});
263+
}
263264
},
264265

265266
setResourcesToList: function(resourcesList) {

0 commit comments

Comments
 (0)