Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

f5j: fix document pollution; place panel #66

Merged
merged 1 commit into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion page/selector.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const theme = document.querySelector('#fcitx-theme')!
export const decoration = document.querySelector('.fcitx-decoration')!
export const decoration = document.querySelector('.fcitx-decoration')! as HTMLElement
export const panel = document.querySelector('.fcitx-panel')!
export const hoverables = panel.querySelector('.fcitx-hoverables')!
export const preedit = document.querySelector('.fcitx-preedit')!
Expand Down
8 changes: 4 additions & 4 deletions page/ux.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export function hideContextmenu () {
contextmenu.style.display = 'none'
}

document.addEventListener('mousedown', e => {
decoration.addEventListener('mousedown', e => {
if (e.button !== 0) {
return
}
Expand All @@ -173,7 +173,7 @@ document.addEventListener('mousedown', e => {
dragOffset = 0
})

document.addEventListener('mousemove', e => {
decoration.addEventListener('mousemove', e => {
if (++mouseMoveState >= 2) {
hoverables.classList.add('fcitx-mousemoved')
}
Expand All @@ -191,7 +191,7 @@ document.addEventListener('mousemove', e => {
resize(dx, -dy, true, false)
})

document.addEventListener('mouseup', e => {
decoration.addEventListener('mouseup', e => {
if (e.button !== 0) {
return
}
Expand Down Expand Up @@ -235,7 +235,7 @@ export function answerActions (actions: CandidateAction[]) {
showContextmenu(actionX, actionY, actionIndex, actions)
}

document.addEventListener('contextmenu', e => {
decoration.addEventListener('contextmenu', e => {
e.preventDefault()
let target = e.target as Element
if (!isInsideHoverables(target)) {
Expand Down
2 changes: 1 addition & 1 deletion src/platform/js.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ void WebviewCandidateWindow::resize(double dx, double dy, double anchor_top,
double anchor_right, double anchor_bottom,
double anchor_left, double width,
double height, bool dragging) {
std::cerr << "resize" << std::endl;
EM_ASM(fcitx.placePanel($0, $1, $2, $3), dx, dy, anchor_top, anchor_left);
}
} // namespace candidate_window