Fixed #942 - Custom target for OverlayPane
parent
01b5c0f59c
commit
ab17ffa622
|
@ -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;
|
||||
|
|
|
@ -116,13 +116,14 @@ toggle(event) {
|
|||
<tbody>
|
||||
<tr>
|
||||
<td>toggle</td>
|
||||
<td>event: Browser event</td>
|
||||
<td>event: Browser event <br />
|
||||
target: Optional target if event.currentTarget should not be used</td>
|
||||
<td>Toggles the visibility of the overlay.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>show</td>
|
||||
<td>event: Browser event <br />
|
||||
target: Optional target if event.target should not be used</td>
|
||||
target: Optional target if event.currentTarget should not be used</td>
|
||||
<td>Shows the overlay.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
Loading…
Reference in New Issue