Skip to content

Commit c8a2008

Browse files
committed
scroll down
1 parent 9ea8609 commit c8a2008

File tree

2 files changed

+23
-14
lines changed

2 files changed

+23
-14
lines changed

services/static-webserver/client/source/class/osparc/desktop/preferences/pages/TagsPage.js

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,49 +26,54 @@ qx.Class.define("osparc.desktop.preferences.pages.TagsPage", {
2626

2727
this._add(new qx.ui.core.Spacer(null, 10));
2828

29-
this.__tagsContainer = new qx.ui.container.Composite(new qx.ui.layout.VBox(10));
30-
this.__tagsContainer.set({
31-
paddingLeft: 10
32-
});
33-
const scroll = new qx.ui.container.Scroll(this.__tagsContainer);
34-
this._add(scroll, {
35-
flex: 1
36-
});
37-
3829
this.__renderLayout();
3930
},
4031

4132
members: {
4233
__tagsContainer: null,
43-
__addTagButton: null,
4434

4535
__renderLayout: function() {
36+
// Tags
37+
this.__tagsContainer = new qx.ui.container.Composite(new qx.ui.layout.VBox(10));
38+
this.__tagsContainer.set({
39+
paddingLeft: 10
40+
});
41+
const tagContainerScroll = new qx.ui.container.Scroll(this.__tagsContainer);
42+
this._add(tagContainerScroll, {
43+
flex: 1
44+
});
45+
4646
const tags = osparc.store.Tags.getInstance().getTags();
4747
const tagItems = tags.map(tag => new osparc.form.tag.TagItem().set({tag}));
4848
tagItems.forEach(tagItem => {
4949
this.__tagsContainer.add(tagItem);
5050
this.__attachTagItemEvents(tagItem);
5151
});
5252

53-
this.__addTagButton = new qx.ui.form.Button().set({
53+
// New tag Button
54+
const addTagButton = new qx.ui.form.Button().set({
5455
appearance: "form-button-outlined",
5556
label: this.tr("New Tag"),
5657
icon: "@FontAwesome5Solid/plus/14"
5758
});
58-
osparc.utils.Utils.setIdToWidget(this.__addTagButton, "addTagBtn");
59-
this.__addTagButton.addListener("execute", () => {
59+
osparc.utils.Utils.setIdToWidget(addTagButton, "addTagBtn");
60+
addTagButton.addListener("execute", () => {
6061
const newItem = new osparc.form.tag.TagItem().set({
6162
mode: osparc.form.tag.TagItem.modes.EDIT
6263
});
6364
this.__tagsContainer.add(newItem);
6465
this.__attachTagItemEvents(newItem);
66+
67+
// scroll down
68+
const height = tagContainerScroll.getSizeHint().height;
69+
tagContainerScroll.scrollToY(height);
6570
});
6671

6772
// New tag button
6873
const buttonContainer = new qx.ui.container.Composite(new qx.ui.layout.HBox().set({
6974
alignX: "center"
7075
}));
71-
buttonContainer.add(this.__addTagButton);
76+
buttonContainer.add(addTagButton);
7277
this._add(buttonContainer);
7378
},
7479

services/static-webserver/client/source/class/osparc/form/tag/TagManager.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ qx.Class.define("osparc.form.tag.TagManager", {
9292
newItem.addListener("cancelNewTag", e => tagsContainer.remove(e.getTarget()), this);
9393
newItem.addListener("deleteTag", e => tagsContainer.remove(e.getTarget()), this);
9494
tagsContainer.add(newItem);
95+
96+
// scroll down
97+
const height = scrollTags.getSizeHint().height;
98+
scrollTags.scrollToY(height);
9599
});
96100
this._add(addTagButton);
97101

0 commit comments

Comments
 (0)