@girder/core 3.1.3 → 3.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -85,7 +85,7 @@ var ItemListWidget = View.extend({
|
|
|
85
85
|
restRequest({
|
|
86
86
|
url: `item/${this._selectedItem.get('_id')}/position`,
|
|
87
87
|
method: 'GET',
|
|
88
|
-
data: { folderId: this._selectedItem.get('folderId') }
|
|
88
|
+
data: { folderId: this._selectedItem.get('folderId'), sort: 'name' }
|
|
89
89
|
}).done((val) => {
|
|
90
90
|
// Now we fetch the correct page for the position
|
|
91
91
|
val = Number(val);
|
|
@@ -237,11 +237,16 @@ var ItemListWidget = View.extend({
|
|
|
237
237
|
centerSelected: function () {
|
|
238
238
|
const widgetcontainer = this.$el.parents('.g-hierarchy-widget-container');
|
|
239
239
|
const selected = this.$('li.g-item-list-entry.g-selected');
|
|
240
|
-
|
|
241
240
|
if (widgetcontainer.length > 0 && selected.length > 0) {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
const
|
|
241
|
+
// These items will effect the scroll position if they exists
|
|
242
|
+
const folderHeight = $('.g-folder-list').length ? $('.g-folder-list').height() : 0;
|
|
243
|
+
const breadcrumbHeight = $('.g-hierarchy-breadcrumb-bar').length ? $('.g-hierarchy-breadcrumb-bar').height() : 0;
|
|
244
|
+
const selectedTop = selected.position().top;
|
|
245
|
+
// The selectedTop position needs to account for the breadcrumbHeight and the folderHeight
|
|
246
|
+
const scrollingPos = selectedTop + folderHeight + breadcrumbHeight;
|
|
247
|
+
const centerPos = (widgetcontainer.height() / 2.0) - (folderHeight / 2.0) - (breadcrumbHeight / 2.0) - (selected.outerHeight() / 2.0);
|
|
248
|
+
|
|
249
|
+
const scrollPos = scrollingPos - centerPos;
|
|
245
250
|
if (this.tempScrollPos === undefined) {
|
|
246
251
|
this.tempScrollPos = scrollPos;
|
|
247
252
|
}
|