mirror of
https://github.com/zulip/zulip.git
synced 2025-11-11 09:27:43 +00:00
popovers: Use fix_positions option for streams popover.
The fix_positions argument here fixes the horizontal position of the stream popover. It also fixes the vertical position, both in the default case, and also doing an appropriate adjustment for the case that the color picker is open. This contains a few changes by tabbott to, rather than hiding the arrow unconditionally, only do so when it would no longer point at the right part of the screen. Fixes #2374. Fixes #6059. Fixes #7290.
This commit is contained in:
@@ -77,9 +77,21 @@ function update_spectrum(popover, update_func) {
|
|||||||
|
|
||||||
var popover_root = popover.closest(".popover");
|
var popover_root = popover.closest(".popover");
|
||||||
var current_top_px = parseFloat(popover_root.css('top').replace('px', ''));
|
var current_top_px = parseFloat(popover_root.css('top').replace('px', ''));
|
||||||
var height_delta = -(after_height - initial_height) * 0.5;
|
var height_delta = after_height - initial_height;
|
||||||
|
var top = current_top_px - height_delta / 2;
|
||||||
|
|
||||||
popover_root.css('top', current_top_px + height_delta + "px");
|
if (top < 0) {
|
||||||
|
top = 0;
|
||||||
|
popover_root.find("div.arrow").hide();
|
||||||
|
} else if (top + after_height > $(window).height() - 20) {
|
||||||
|
top = $(window).height() - after_height - 20;
|
||||||
|
if (top < 0) {
|
||||||
|
top = 0;
|
||||||
|
}
|
||||||
|
popover_root.find("div.arrow").hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
popover_root.css('top', top + "px");
|
||||||
}
|
}
|
||||||
|
|
||||||
function build_stream_popover(e) {
|
function build_stream_popover(e) {
|
||||||
@@ -106,6 +118,7 @@ function build_stream_popover(e) {
|
|||||||
content: content,
|
content: content,
|
||||||
trigger: "manual",
|
trigger: "manual",
|
||||||
fixed: true,
|
fixed: true,
|
||||||
|
fix_positions: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
$(elt).popover("show");
|
$(elt).popover("show");
|
||||||
|
|||||||
11
static/third/bootstrap/js/bootstrap.js
vendored
11
static/third/bootstrap/js/bootstrap.js
vendored
@@ -1289,14 +1289,21 @@
|
|||||||
*/
|
*/
|
||||||
if (top < 0) {
|
if (top < 0) {
|
||||||
top = 0;
|
top = 0;
|
||||||
} else if (top + actualHeight > win_height) {
|
$tip.find("div.arrow").hide();
|
||||||
top = win_height - actualHeight;
|
} else if (top + actualHeight > win_height - 20) {
|
||||||
|
top = win_height - actualHeight - 20;
|
||||||
|
if (top < 0) {
|
||||||
|
top = 0;
|
||||||
|
}
|
||||||
|
$tip.find("div.arrow").hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (left < 0) {
|
if (left < 0) {
|
||||||
left = 0;
|
left = 0;
|
||||||
|
$tip.find("div.arrow").hide();
|
||||||
} else if (left + actualWidth > win_width) {
|
} else if (left + actualWidth > win_width) {
|
||||||
left = win_width - actualWidth;
|
left = win_width - actualWidth;
|
||||||
|
$tip.find("div.arrow").hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user