Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
HIllya51 committed Jan 7, 2025
1 parent 56ce081 commit bf3228c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cpp/version.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

set(VERSION_MAJOR 6)
set(VERSION_MINOR 17)
set(VERSION_PATCH 6)
set(VERSION_PATCH 7)
set(VERSION_REVISION 0)
set(LUNA_VERSION "{${VERSION_MAJOR},${VERSION_MINOR},${VERSION_PATCH},${VERSION_REVISION}}")
add_library(VERSION_DEF ${CMAKE_CURRENT_LIST_DIR}/version_def.cpp)
Expand Down
23 changes: 21 additions & 2 deletions py/LunaTranslator/rendertext/webview.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,23 @@
</div>
<div id="luna_extra_html_div">
</div>
<div class="overlay" id="overlay"></div>
<script>

const rootdivid = 'luna_root_div';
const extra_html_divid = "luna_extra_html_div";
</script>
<style>
.overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1000;
display: block;
}

body {
overflow: auto;
margin-top: 0;
Expand Down Expand Up @@ -334,8 +345,11 @@
safe_calllunaclickedword(JSON.parse(this.getAttribute('word')))
})

style.innerHTML += `#${div.id}:hover {
background-color: rgba(0,0,0,0.5);
style.innerHTML += `#${div.id} {
z-index: 2000;position: relative;
}
#${div.id}:hover {
background-color: rgba(0,0,0,0.5);
}`

}
Expand Down Expand Up @@ -400,9 +414,14 @@
_setHTMLWithScript(document.getElementById(extra_html_divid), decodeURIComponent(htmlx))

}
function _setselectable(b) {
document.getElementById(rootdivid).style.userSelect = b ? 'text' : 'none';
document.getElementById('overlay').style.display = b ? 'none' : 'block';
}
</script>
<script>
//api
setselectable = _setselectable
showhideorigin = _showhideorigin
showhidetranslate = _showhidetranslate
showhidetranslatorname = _showhidetranslatorname
Expand Down
1 change: 1 addition & 0 deletions py/LunaTranslator/rendertext/webview.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def resizeEvent(self, event: QResizeEvent):

def setselectable(self, b):
self.selectable = b
self.debugeval('setselectable({})'.format(int(b)))

def __init__(self, parent) -> None:
super().__init__(parent)
Expand Down

0 comments on commit bf3228c

Please sign in to comment.