Aligned entity-selector-popup button and dblclick behaviour

Fixes #3534
This commit is contained in:
Dan Brown 2022-06-27 14:27:29 +01:00
parent 47887ec595
commit 736d6afb7d
No known key found for this signature in database
GPG key ID: 46D9F943C24A2EF9

View file

@ -16,7 +16,7 @@ class EntitySelectorPopup {
this.selectButton.addEventListener('click', this.onSelectButtonClick.bind(this)); this.selectButton.addEventListener('click', this.onSelectButtonClick.bind(this));
window.$events.listen('entity-select-change', this.onSelectionChange.bind(this)); window.$events.listen('entity-select-change', this.onSelectionChange.bind(this));
window.$events.listen('entity-select-confirm', this.onSelectionConfirm.bind(this)); window.$events.listen('entity-select-confirm', this.handleConfirmedSelection.bind(this));
} }
show(callback) { show(callback) {
@ -34,14 +34,7 @@ class EntitySelectorPopup {
} }
onSelectButtonClick() { onSelectButtonClick() {
this.hide(); this.handleConfirmedSelection(this.selection);
if (this.selection !== null && this.callback) this.callback(this.selection);
}
onSelectionConfirm(entity) {
this.hide();
this.getSelector().reset();
if (this.callback && entity) this.callback(entity);
} }
onSelectionChange(entity) { onSelectionChange(entity) {
@ -52,6 +45,12 @@ class EntitySelectorPopup {
this.selectButton.removeAttribute('disabled'); this.selectButton.removeAttribute('disabled');
} }
} }
handleConfirmedSelection(entity) {
this.hide();
this.getSelector().reset();
if (this.callback && entity) this.callback(entity);
}
} }
export default EntitySelectorPopup; export default EntitySelectorPopup;