mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-21 16:22:20 +02:00
N°9468 - Make the 4px height difference a variable
This commit is contained in:
@@ -120,6 +120,7 @@ function ExtKeyWidget(id, sTargetClass, sFilter, sTitle, bSelectMode, oWizHelper
|
|||||||
this.sFormAttCode = sFormAttCode;
|
this.sFormAttCode = sFormAttCode;
|
||||||
|
|
||||||
var me = this;
|
var me = this;
|
||||||
|
const iDropdownContentHeightDifference = 4;
|
||||||
|
|
||||||
this.Init = function () {
|
this.Init = function () {
|
||||||
// make sure that the form is clean
|
// make sure that the form is clean
|
||||||
@@ -353,13 +354,13 @@ function ExtKeyWidget(id, sTargetClass, sFilter, sTitle, bSelectMode, oWizHelper
|
|||||||
|
|
||||||
// N°9468 Dropdown content needs to be a few pixel shorter than the dropdown itself to avoid double scrollbar
|
// N°9468 Dropdown content needs to be a few pixel shorter than the dropdown itself to avoid double scrollbar
|
||||||
if(oDropdownContentElem) {
|
if(oDropdownContentElem) {
|
||||||
oDropdownContentElem.css('max-height', 'calc(30vh - 4px)');
|
oDropdownContentElem.css('max-height', `calc(30vh - ${iDropdownContentHeightDifference}px)`);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Position dropdown above input if not enough space on the bottom part of the screen
|
/* Position dropdown above input if not enough space on the bottom part of the screen
|
||||||
Doesn't seem to work with selectize as an internal plugin "auto_position" refreshes the top position after
|
Doesn't seem to work with selectize as an internal plugin "auto_position" refreshes the top position after
|
||||||
this method is called, input set use a custom plugin to avoid fix this issue "plugin_combodo_auto_position"
|
this method is called, input set use a custom plugin to avoid fix this issue "plugin_combodo_auto_position"
|
||||||
This would need to take the potential 4px difference into account if this is fixed.
|
This would need to take the potential 4px difference (iDropdownContentHeightDifference) into account if this is fixed.
|
||||||
*/
|
*/
|
||||||
if ((fDropdownTopY / fWindowHeight) > 0.6) {
|
if ((fDropdownTopY / fWindowHeight) > 0.6) {
|
||||||
oDropdownElem.css({
|
oDropdownElem.css({
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ Selectize.define("combodo_auto_position", function (aOptions) {
|
|||||||
|
|
||||||
// Selectize instance
|
// Selectize instance
|
||||||
let oSelf = this;
|
let oSelf = this;
|
||||||
|
const iDropdownContentHeightDifference = 4;
|
||||||
|
|
||||||
// Plugin options
|
// Plugin options
|
||||||
aOptions = $.extend({
|
aOptions = $.extend({
|
||||||
@@ -53,7 +54,7 @@ Selectize.define("combodo_auto_position", function (aOptions) {
|
|||||||
iDropdownHeight = oSelf.$dropdown.outerHeight();
|
iDropdownHeight = oSelf.$dropdown.outerHeight();
|
||||||
|
|
||||||
oSelf.$dropdown.css({
|
oSelf.$dropdown.css({
|
||||||
top: oSelf.$control.offset().top - iDropdownHeight + 4, // Content will be shorter, so our real height too
|
top: oSelf.$control.offset().top - iDropdownHeight + iDropdownContentHeightDifference, // Content will be shorter, so our real height too
|
||||||
left: oSelf.$control.offset().left,
|
left: oSelf.$control.offset().left,
|
||||||
width: oSelf.$wrapper.outerWidth(),
|
width: oSelf.$wrapper.outerWidth(),
|
||||||
overflowY: 'auto',
|
overflowY: 'auto',
|
||||||
@@ -62,7 +63,7 @@ Selectize.define("combodo_auto_position", function (aOptions) {
|
|||||||
|
|
||||||
// N°9468 Dropdown content needs to be a few pixel shorter than the dropdown itself to avoid double scrollbar
|
// N°9468 Dropdown content needs to be a few pixel shorter than the dropdown itself to avoid double scrollbar
|
||||||
oSelf.$dropdown_content.css({
|
oSelf.$dropdown_content.css({
|
||||||
'max-height': `calc(${aOptions.maxDropDownHeight} - 4px)`
|
'max-height': `calc(${aOptions.maxDropDownHeight} - ${iDropdownContentHeightDifference}px)`
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user