forked from mbk-lab/rui_orig
Bug fixing
This commit is contained in:
parent
b15305d727
commit
1cf0ee0bae
|
@ -149,7 +149,6 @@ func (app *wasmApp) init(params AppParams) {
|
|||
div = document.Call("createElement", "div")
|
||||
div.Set("className", "ruiPopupLayer")
|
||||
div.Set("id", "ruiPopupLayer")
|
||||
div.Set("onclick", "clickOutsidePopup(event)")
|
||||
div.Set("style", "visibility: hidden;")
|
||||
body.Call("appendChild", div)
|
||||
|
||||
|
|
|
@ -1253,11 +1253,6 @@ function loadInlineImage(url, content) {
|
|||
img.src = content;
|
||||
}
|
||||
|
||||
function clickOutsidePopup(e) {
|
||||
sendMessage("clickOutsidePopup{session=" + sessionID + "}")
|
||||
e.stopPropagation();
|
||||
}
|
||||
|
||||
function clickClosePopup(element, e) {
|
||||
var popupId = element.getAttribute("data-popupId");
|
||||
sendMessage("clickClosePopup{session=" + sessionID + ",id=" + popupId + "}")
|
||||
|
@ -2072,6 +2067,14 @@ function mouseLeaveEvent(element, event) {
|
|||
sendMessage("mouse-leave{session=" + sessionID + ",id=" + element.id + mouseEventData(element, event) + "}");
|
||||
}
|
||||
|
||||
function hideTooltip() {
|
||||
const layer = document.getElementById("ruiTooltipLayer");
|
||||
if (layer) {
|
||||
layer.style.opacity = 0;
|
||||
layer.style.visibility = "hidden";
|
||||
}
|
||||
}
|
||||
|
||||
function stopEventPropagation(element, event) {
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ func getStartPage(buffer *strings.Builder, params AppParams, addScripts string)
|
|||
</head>
|
||||
<body>
|
||||
<div class="ruiRoot" id="ruiRootView"></div>
|
||||
<div class="ruiPopupLayer" id="ruiPopupLayer" style="visibility: hidden; isolation: isolate;" onclick="clickOutsidePopup(event)"></div>
|
||||
<div class="ruiPopupLayer" id="ruiPopupLayer" style="visibility: hidden; isolation: isolate;"></div>
|
||||
<div class="ruiTooltipLayer" id="ruiTooltipLayer" style="visibility: hidden; opacity: 0;">
|
||||
<div id="ruiTooltipText" class="ruiTooltipText"></div>
|
||||
<div id="ruiTooltipTopArrow" class="ruiTooltipTopArrow"></div>
|
||||
|
|
|
@ -652,7 +652,7 @@ func (session *sessionData) handleEvent(command string, data DataObject) {
|
|||
if view := session.viewByHTMLID(viewID); view != nil {
|
||||
view.handleCommand(view, command, data)
|
||||
}
|
||||
} else if command != "clickOutsidePopup" {
|
||||
} else {
|
||||
ErrorLog(`"id" property not found. Event: ` + command)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,8 @@ func updateInnerHTML(htmlID string, session Session) {
|
|||
view = session.viewByHTMLID(htmlID)
|
||||
}
|
||||
if view != nil {
|
||||
session.callFunc("hideTooltip")
|
||||
|
||||
script := allocStringBuilder()
|
||||
defer freeStringBuilder(script)
|
||||
|
||||
|
|
2
view.go
2
view.go
|
@ -412,10 +412,12 @@ func viewPropertyChanged(view *viewData, tag string) {
|
|||
case Invisible:
|
||||
session.updateCSSProperty(htmlID, Visibility, "hidden")
|
||||
session.updateCSSProperty(htmlID, "display", "")
|
||||
session.callFunc("hideTooltip")
|
||||
|
||||
case Gone:
|
||||
session.updateCSSProperty(htmlID, Visibility, "hidden")
|
||||
session.updateCSSProperty(htmlID, "display", "none")
|
||||
session.callFunc("hideTooltip")
|
||||
|
||||
default:
|
||||
session.updateCSSProperty(htmlID, Visibility, "visible")
|
||||
|
|
Loading…
Reference in New Issue