Skip to content

Commit

Permalink
feat: add active param, remove un-needed look at param
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickocoffeyo committed Aug 9, 2018
1 parent d52a8db commit 1d9483b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
6 changes: 4 additions & 2 deletions dist/aframe-simple-link-component.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ if (typeof AFRAME === 'undefined') {

AFRAME.registerComponent('simple-link', {
schema: {
lookAtCamera: {
active: {
default: true,
type: 'boolean'
},
Expand Down Expand Up @@ -217,7 +217,9 @@ AFRAME.registerComponent('simple-link', {
*
*/
navigate: function navigate() {
window.location = this.data.href;
if (this.data.active) {
window.location = this.data.href;
}
}
});

Expand Down
2 changes: 1 addition & 1 deletion dist/aframe-simple-link-component.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ if (typeof AFRAME === 'undefined') {
*/
AFRAME.registerComponent('simple-link', {
schema: {
lookAtCamera: { default: true, type: 'boolean' },
active: { default: true, type: 'boolean' },
href: { default: '', type: 'string' },
title: { default: '', type: 'string' },
radius: { default: 1, type: 'number' },
font: {default: 'kelsonsans', type: 'string' },
font: { default: 'kelsonsans', type: 'string' },
color: { default: '#fff', type: 'color' },
titleColor: { default: '#fff', type: 'color' },
image: { default: '', type: 'asset' },
Expand Down Expand Up @@ -106,7 +106,9 @@ AFRAME.registerComponent('simple-link', {
},

removeEventListener() {
const { data: { on } } = this;
const {
data: { on }
} = this;
if (on) {
this.el.removeEventListener(on, this.navigate);
}
Expand All @@ -117,6 +119,8 @@ AFRAME.registerComponent('simple-link', {
*
*/
navigate() {
window.location = this.data.href;
if (this.data.active) {
window.location = this.data.href;
}
}
});

0 comments on commit 1d9483b

Please sign in to comment.