Skip to content
Permalink
Browse files

comp/material: Use common close for tooltip and menu

  • Loading branch information...
lauriro committed May 14, 2019
1 parent a568911 commit 53346a139cab4a730917784774cfa1cf810b053a
Showing with 14 additions and 8 deletions.
  1. +14 −8 ui/component/material.tpl
@@ -239,12 +239,6 @@
El.css(source, "top", (top < 0 ? 0 : top) + "px")
El.css(source, "left", (left < 0 ? 0 : left) + "px")
}
function closeTooltip() {
if (tipOpen) {
setTimeout(El.kill.bind(El, tooltip), 999)
El.cls(tooltip, "is-visible", tipOpen = tooltip = null)
}
}
El.on(document.body, "mouseover", onOver)
El.on(window, "focusin", onOver)
View.on("show", closeTooltip)
@@ -276,11 +270,23 @@
near(tooltip, target, x, y, 6)
El.cls(tooltip, "is-visible")
}
function close(el) {
if (el) {
setTimeout(el.closeFn || El.kill.bind(El, el), 999)
El.cls(el, "is-visible", 0)
}
}
function closeTooltip() {
if (tooltip) {
close(tooltip)
tipOpen = tooltip = null
}
}
function closeMenu(e) {
if (e && e.target == lastMenuTarget) return
if (openMenu) {
setTimeout(openMenu.closeFn || El.kill.bind(null, openMenu), 800)
El.cls(openMenu, "is-visible", openMenu = null, 300)
close(openMenu)
openMenu = null
}
El.cls(lastMenuTarget, "is-active", 0)
}

0 comments on commit 53346a1

Please sign in to comment.
You can’t perform that action at this time.