Skip to content

Commit 8b1dd59

Browse files
fix: add ability to make dialogs active/inactive
1 parent 5b36d46 commit 8b1dd59

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@ For [A-Frame](https://aframe.io).
1616
| titleColor | Text color of title. | black |
1717
| titleFont | Title font. | mozillavr |
1818
| titleWrapCount | Title entity wrap count. | 24 |
19-
| body | String containing body . | This dialog has no body yet. |
19+
| body | String containing body. | This dialog has no body yet. |
2020
| bodyColor | Text color of body. | black |
2121
| bodyFont | Body font. | mozillavr |
2222
| bodyWrapCount | Body entity wrap count. | 30 |
2323
| openOn | Open/Close event. | click |
24+
| active | Turn dialog on/off. | true |
2425
| openIconImage | Icon image for open button. | None |
2526
| openIconRadius | Radius for open icon. | 0.3 |
2627
| openIconColor | Color for open icon. | white |
@@ -45,7 +46,7 @@ Install and use by directly including the [browser files](dist):
4546
<head>
4647
<title>My A-Frame Scene</title>
4748
<script src="https://aframe.io/releases/0.8.2/aframe.min.js"></script>
48-
<script src="https://unpkg.com/@editvr/aframe-dialog-popup-component@1.4.0/dist/aframe-dialog-popup-component.min.js"></script>
49+
<script src="https://unpkg.com/@editvr/aframe-dialog-popup-component@1.7.2/dist/aframe-dialog-popup-component.min.js"></script>
4950
</head>
5051

5152
<body>

dist/aframe-dialog-popup-component.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ AFRAME.registerComponent('dialog-popup', {
125125
type: 'string',
126126
default: 'click'
127127
},
128+
active: {
129+
type: 'boolean',
130+
default: true
131+
},
128132
openIconImage: {
129133
type: 'asset',
130134
default: ''
@@ -230,7 +234,7 @@ AFRAME.registerComponent('dialog-popup', {
230234
toggleDialogOpen: function toggleDialogOpen() {
231235
this.isOpen = !this.isOpen;
232236

233-
if (this.dialogPlaneEl) {
237+
if (this.data.active && this.dialogPlaneEl) {
234238
this.positionDialogPlane();
235239
this.dialogPlaneEl.setAttribute('visible', this.isOpen);
236240
this.openIconEl.setAttribute('visible', !this.isOpen);

dist/aframe-dialog-popup-component.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ AFRAME.registerComponent('dialog-popup', {
5252
type: 'string',
5353
default: 'click'
5454
},
55+
active: {
56+
type: 'boolean',
57+
default: true,
58+
},
5559
openIconImage: {
5660
type: 'asset',
5761
default: ''
@@ -157,7 +161,7 @@ AFRAME.registerComponent('dialog-popup', {
157161
*/
158162
toggleDialogOpen() {
159163
this.isOpen = !this.isOpen;
160-
if (this.dialogPlaneEl) {
164+
if (this.data.active && this.dialogPlaneEl) {
161165
this.positionDialogPlane();
162166
this.dialogPlaneEl.setAttribute('visible', this.isOpen);
163167
this.openIconEl.setAttribute('visible', !this.isOpen);

0 commit comments

Comments
 (0)