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 = document.Call("createElement", "div")
|
||||||
div.Set("className", "ruiPopupLayer")
|
div.Set("className", "ruiPopupLayer")
|
||||||
div.Set("id", "ruiPopupLayer")
|
div.Set("id", "ruiPopupLayer")
|
||||||
div.Set("onclick", "clickOutsidePopup(event)")
|
|
||||||
div.Set("style", "visibility: hidden;")
|
div.Set("style", "visibility: hidden;")
|
||||||
body.Call("appendChild", div)
|
body.Call("appendChild", div)
|
||||||
|
|
||||||
|
|
|
@ -1253,11 +1253,6 @@ function loadInlineImage(url, content) {
|
||||||
img.src = content;
|
img.src = content;
|
||||||
}
|
}
|
||||||
|
|
||||||
function clickOutsidePopup(e) {
|
|
||||||
sendMessage("clickOutsidePopup{session=" + sessionID + "}")
|
|
||||||
e.stopPropagation();
|
|
||||||
}
|
|
||||||
|
|
||||||
function clickClosePopup(element, e) {
|
function clickClosePopup(element, e) {
|
||||||
var popupId = element.getAttribute("data-popupId");
|
var popupId = element.getAttribute("data-popupId");
|
||||||
sendMessage("clickClosePopup{session=" + sessionID + ",id=" + 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) + "}");
|
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) {
|
function stopEventPropagation(element, event) {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ func getStartPage(buffer *strings.Builder, params AppParams, addScripts string)
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="ruiRoot" id="ruiRootView"></div>
|
<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 class="ruiTooltipLayer" id="ruiTooltipLayer" style="visibility: hidden; opacity: 0;">
|
||||||
<div id="ruiTooltipText" class="ruiTooltipText"></div>
|
<div id="ruiTooltipText" class="ruiTooltipText"></div>
|
||||||
<div id="ruiTooltipTopArrow" class="ruiTooltipTopArrow"></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 {
|
if view := session.viewByHTMLID(viewID); view != nil {
|
||||||
view.handleCommand(view, command, data)
|
view.handleCommand(view, command, data)
|
||||||
}
|
}
|
||||||
} else if command != "clickOutsidePopup" {
|
} else {
|
||||||
ErrorLog(`"id" property not found. Event: ` + command)
|
ErrorLog(`"id" property not found. Event: ` + command)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,8 @@ func updateInnerHTML(htmlID string, session Session) {
|
||||||
view = session.viewByHTMLID(htmlID)
|
view = session.viewByHTMLID(htmlID)
|
||||||
}
|
}
|
||||||
if view != nil {
|
if view != nil {
|
||||||
|
session.callFunc("hideTooltip")
|
||||||
|
|
||||||
script := allocStringBuilder()
|
script := allocStringBuilder()
|
||||||
defer freeStringBuilder(script)
|
defer freeStringBuilder(script)
|
||||||
|
|
||||||
|
|
2
view.go
2
view.go
|
@ -412,10 +412,12 @@ func viewPropertyChanged(view *viewData, tag string) {
|
||||||
case Invisible:
|
case Invisible:
|
||||||
session.updateCSSProperty(htmlID, Visibility, "hidden")
|
session.updateCSSProperty(htmlID, Visibility, "hidden")
|
||||||
session.updateCSSProperty(htmlID, "display", "")
|
session.updateCSSProperty(htmlID, "display", "")
|
||||||
|
session.callFunc("hideTooltip")
|
||||||
|
|
||||||
case Gone:
|
case Gone:
|
||||||
session.updateCSSProperty(htmlID, Visibility, "hidden")
|
session.updateCSSProperty(htmlID, Visibility, "hidden")
|
||||||
session.updateCSSProperty(htmlID, "display", "none")
|
session.updateCSSProperty(htmlID, "display", "none")
|
||||||
|
session.callFunc("hideTooltip")
|
||||||
|
|
||||||
default:
|
default:
|
||||||
session.updateCSSProperty(htmlID, Visibility, "visible")
|
session.updateCSSProperty(htmlID, Visibility, "visible")
|
||||||
|
|
Loading…
Reference in New Issue