MDL-82832 ddimageortext: center the dd item using js.

This commit is contained in:
hieuvu
2024-08-22 12:23:10 +07:00
committed by Huong Nguyen
parent 96410abbf9
commit 56f329366d
3 changed files with 8 additions and 4 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -133,8 +133,12 @@ define([
// Now resize all the items in the same group if we have new maximum width or height.
this.resizeAllDragsAndDropsInGroup(group);
} else {
currentFilteredItem.height(currentHeight);
currentFilteredItem.width(currentWidth);
// Calculate the top padding.
const top = Math.floor((this.questionDragDropWidthHeight[group].maxHeight - filteredElement.offsetHeight) / 2);
// Set top padding so the content of filtered item is center again.
currentFilteredItem.width(currentWidth).height(currentHeight).css({
'padding-top': top + 'px',
});
}
// Remove the d-block class after resize.
filteredElement.classList.remove('d-block');