Reposition popup on window resize rather than clear the search
Fixes #107
This commit is contained in:
parent
598cd32946
commit
8f918c63dc
@ -139,8 +139,14 @@ class Frontend {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onResize() {
|
async onResize() {
|
||||||
this.searchClear(false);
|
if (this.textSourceLast !== null && await this.popup.isVisibleAsync()) {
|
||||||
|
const textSource = this.textSourceLast;
|
||||||
|
this.lastShowPromise = this.popup.showContent(
|
||||||
|
textSource.getRect(),
|
||||||
|
textSource.getWritingMode()
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onClick(e) {
|
onClick(e) {
|
||||||
|
@ -40,6 +40,7 @@ class PopupProxyHost {
|
|||||||
createNestedPopup: ({parentId}) => this.createNestedPopup(parentId),
|
createNestedPopup: ({parentId}) => this.createNestedPopup(parentId),
|
||||||
setOptions: ({id, options}) => this.setOptions(id, options),
|
setOptions: ({id, options}) => this.setOptions(id, options),
|
||||||
hide: ({id, changeFocus}) => this.hide(id, changeFocus),
|
hide: ({id, changeFocus}) => this.hide(id, changeFocus),
|
||||||
|
isVisibleAsync: ({id}) => this.isVisibleAsync(id),
|
||||||
setVisibleOverride: ({id, visible}) => this.setVisibleOverride(id, visible),
|
setVisibleOverride: ({id, visible}) => this.setVisibleOverride(id, visible),
|
||||||
containsPoint: ({id, x, y}) => this.containsPoint(id, x, y),
|
containsPoint: ({id, x, y}) => this.containsPoint(id, x, y),
|
||||||
showContent: ({id, elementRect, writingMode, type, details}) => this.showContent(id, elementRect, writingMode, type, details),
|
showContent: ({id, elementRect, writingMode, type, details}) => this.showContent(id, elementRect, writingMode, type, details),
|
||||||
@ -97,9 +98,14 @@ class PopupProxyHost {
|
|||||||
return popup.hide(changeFocus);
|
return popup.hide(changeFocus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async isVisibleAsync(id) {
|
||||||
|
const popup = this.getPopup(id);
|
||||||
|
return await popup.isVisibleAsync();
|
||||||
|
}
|
||||||
|
|
||||||
async setVisibleOverride(id, visible) {
|
async setVisibleOverride(id, visible) {
|
||||||
const popup = this.getPopup(id);
|
const popup = this.getPopup(id);
|
||||||
return popup.setVisibleOverride(visible);
|
return await popup.setVisibleOverride(visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
async containsPoint(id, x, y) {
|
async containsPoint(id, x, y) {
|
||||||
|
@ -58,6 +58,11 @@ class PopupProxy {
|
|||||||
return await this.invokeHostApi('hide', {id: this.id, changeFocus});
|
return await this.invokeHostApi('hide', {id: this.id, changeFocus});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async isVisibleAsync() {
|
||||||
|
const id = await this.getPopupId();
|
||||||
|
return await this.invokeHostApi('isVisibleAsync', {id});
|
||||||
|
}
|
||||||
|
|
||||||
async setVisibleOverride(visible) {
|
async setVisibleOverride(visible) {
|
||||||
const id = await this.getPopupId();
|
const id = await this.getPopupId();
|
||||||
return await this.invokeHostApi('setVisibleOverride', {id, visible});
|
return await this.invokeHostApi('setVisibleOverride', {id, visible});
|
||||||
|
@ -239,6 +239,10 @@ class Popup {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async isVisibleAsync() {
|
||||||
|
return this.isVisible();
|
||||||
|
}
|
||||||
|
|
||||||
isVisible() {
|
isVisible() {
|
||||||
return this.isInjected && (this.visibleOverride !== null ? this.visibleOverride : this.visible);
|
return this.isInjected && (this.visibleOverride !== null ? this.visibleOverride : this.visible);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user