1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-06-27 12:55:55 +00:00
* Fixed: Do not scroll context-menus with chat.
* Fixed: After repositioning a tool-tip, check that its host element is still within the page. If it's not, hide the tool-tip.
This commit is contained in:
SirStendec 2019-08-07 14:13:04 -04:00
parent 49d3e96517
commit 056cc9c401
4 changed files with 45 additions and 6 deletions

View file

@ -1,7 +1,7 @@
{ {
"name": "frankerfacez", "name": "frankerfacez",
"author": "Dan Salvato LLC", "author": "Dan Salvato LLC",
"version": "4.8.0", "version": "4.8.1",
"description": "FrankerFaceZ is a Twitch enhancement suite.", "description": "FrankerFaceZ is a Twitch enhancement suite.",
"license": "Apache-2.0", "license": "Apache-2.0",
"scripts": { "scripts": {

View file

@ -17,7 +17,7 @@ var SERVERS = []string{
"https://tuturu.frankerfacez.com", "https://tuturu.frankerfacez.com",
"https://yoohoo.frankerfacez.com", "https://yoohoo.frankerfacez.com",
"https://lilz.frankerfacez.com", "https://lilz.frankerfacez.com",
"https://pog.frankerfacez.com" "https://pog.frankerfacez.com",
} }
const folderPrefix = "/hll/" const folderPrefix = "/hll/"

View file

@ -366,6 +366,7 @@ export default class Actions extends Module {
live: false, live: false,
html: true, html: true,
hover_events: true, hover_events: true,
no_update: true,
tooltipClass: 'ffz-action-balloon tw-balloon tw-block tw-border tw-elevation-1 tw-border-radius-small tw-c-background-base', tooltipClass: 'ffz-action-balloon tw-balloon tw-block tw-border tw-elevation-1 tw-border-radius-small tw-c-background-base',
arrowClass: 'tw-balloon__tail tw-overflow-hidden tw-absolute', arrowClass: 'tw-balloon__tail tw-overflow-hidden tw-absolute',

View file

@ -9,7 +9,7 @@
// ============================================================================ // ============================================================================
import {createElement, setChildren} from 'utilities/dom'; import {createElement, setChildren} from 'utilities/dom';
import {maybe_call} from 'utilities/object'; import {maybe_call, debounce} from 'utilities/object';
import Popper from 'popper.js'; import Popper from 'popper.js';
@ -253,7 +253,7 @@ export class Tooltip {
}); });
el.addEventListener('mouseover', el._ffz_over_handler = event => { el.addEventListener('mouseover', el._ffz_over_handler = event => {
if ( ! document.contains(target) ) if ( ! opts.no_auto_remove && ! document.contains(target) )
this.hide(tip); this.hide(tip);
if ( hover_events && opts.onHover ) if ( hover_events && opts.onHover )
@ -290,10 +290,19 @@ export class Tooltip {
arrowElement: arrow arrowElement: arrow
}, opts.popper); }, opts.popper);
pop_opts.onUpdate = tip._on_update = debounce(() => {
if ( ! opts.no_auto_remove && ! document.contains(tip.target) )
this.hide(tip);
}, 250);
let popper_target = target;
if ( opts.no_update )
popper_target = makeReference(target);
tip._update = () => { tip._update = () => {
if ( tip.popper ) { if ( tip.popper ) {
tip.popper.destroy(); tip.popper.destroy();
tip.popper = new Popper(target, el, pop_opts); tip.popper = new Popper(popper_target, el, pop_opts);
} }
} }
@ -333,7 +342,7 @@ export class Tooltip {
// Add everything to the DOM and create the Popper instance. // Add everything to the DOM and create the Popper instance.
tip.popper = new Popper(target, el, pop_opts); tip.popper = new Popper(popper_target, el, pop_opts);
this.parent.appendChild(el); this.parent.appendChild(el);
tip.visible = true; tip.visible = true;
@ -379,5 +388,34 @@ export class Tooltip {
export default Tooltip; export default Tooltip;
export function makeReference(x, y, height=0, width=0) {
if ( x instanceof Node ) {
const rect = x.getBoundingClientRect();
x = rect.x;
y = rect.y;
height = rect.height;
width = rect.width;
}
const out = {
getBoundingClientRect: () => ({
top: y,
bottom: y + height,
y,
left: x,
right: x + width,
x,
height,
width
}),
clientWidth: width,
clientHeight: height
};
console.log('makeReference', out);
return out;
}
// Function Intentionally Left Blank // Function Intentionally Left Blank
function noop() { } function noop() { }