From ab17ffa62220fc92da0d8e1b75f0f3e57dad8414 Mon Sep 17 00:00:00 2001 From: Cagatay Civici Date: Tue, 27 Jul 2021 11:00:47 +0300 Subject: [PATCH] Fixed #942 - Custom target for OverlayPane --- src/components/overlaypanel/OverlayPanel.vue | 12 +++++++----- src/views/overlaypanel/OverlayPanelDoc.vue | 5 +++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/components/overlaypanel/OverlayPanel.vue b/src/components/overlaypanel/OverlayPanel.vue index 947fd5c088..b2ce14c73d 100755 --- a/src/components/overlaypanel/OverlayPanel.vue +++ b/src/components/overlaypanel/OverlayPanel.vue @@ -58,6 +58,7 @@ export default { }, selfClick: false, target: null, + eventTarget: null, outsideClickListener: null, scrollHandler: null, resizeListener: null, @@ -94,15 +95,16 @@ export default { } }, methods: { - toggle(event) { + toggle(event, target) { if (this.visible) this.hide(); else - this.show(event); + this.show(event, target); }, - show(event) { + show(event, target) { this.visible = true; - this.target = event.currentTarget; + this.eventTarget = event.currentTarget; + this.target = target || event.currentTarget; }, hide() { this.visible = false; @@ -211,7 +213,7 @@ export default { } }, isTargetClicked(event) { - return this.target && (this.target === event.target || this.target.contains(event.target)); + return (this.eventTarget && (this.eventTarget === event.target || this.eventTarget.contains(event.target))); }, containerRef(el) { this.container = el; diff --git a/src/views/overlaypanel/OverlayPanelDoc.vue b/src/views/overlaypanel/OverlayPanelDoc.vue index e9f3cdc503..fc79848608 100755 --- a/src/views/overlaypanel/OverlayPanelDoc.vue +++ b/src/views/overlaypanel/OverlayPanelDoc.vue @@ -116,13 +116,14 @@ toggle(event) { toggle - event: Browser event + event: Browser event
+ target: Optional target if event.currentTarget should not be used Toggles the visibility of the overlay. show event: Browser event
- target: Optional target if event.target should not be used + target: Optional target if event.currentTarget should not be used Shows the overlay.