Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some UI issues #638

Merged
merged 6 commits into from
Oct 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/components/components/CommonComponents.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export default class CommonComponents extends React.Component {
className="gltfIcon"
onClick={event => {
this.exportToGLTF();
event.preventDefault();
event.stopPropagation();
}} >
<img src={process.env.NODE_ENV === 'production' ? 'https://aframe.io/aframe-inspector/assets/gltf.svg' : '../assets/gltf.svg'} />
Expand All @@ -114,7 +115,10 @@ export default class CommonComponents extends React.Component {
title="Copy entity HTML to clipboard"
data-action="copy-entity-to-clipboard"
className="button fa fa-clipboard"
onClick={event => event.stopPropagation()}
onClick={event => {
event.preventDefault();
event.stopPropagation();
}}
/>
</div>
);
Expand Down
4 changes: 4 additions & 0 deletions src/components/components/Component.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@ export default class Component extends React.Component {
data-component={subComponentName || componentName}
className="button fa fa-clipboard"
href="#"
onClick={event => {
event.preventDefault();
event.stopPropagation();
}}
/>
<a
title="Remove component"
Expand Down
6 changes: 5 additions & 1 deletion src/components/components/PropertyRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ export default class PropertyRow extends React.Component {
const isMap =
props.componentname === 'material' &&
(props.name === 'envMap' || props.name === 'src');
const type = props.schema.type;
let type = props.schema.type;
if (props.componentname === 'animation' && props.name === 'loop') {
// fix wrong number type for animation loop property
type = 'boolean';
}

const value =
props.schema.type === 'selector'
Expand Down
1 change: 1 addition & 0 deletions src/components/scenegraph/SceneGraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export default class SceneGraph extends React.Component {
this.rebuildEntityOptions();
Events.on('entityidchange', this.rebuildEntityOptions);
Events.on('entitycreated', this.rebuildEntityOptions);
Events.on('entityclone', this.rebuildEntityOptions);
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/components/widgets/TextureWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ export default class TextureWidget extends React.Component {
if (!component) {
return;
}
var newValue = component.attrValue[this.props.name];
// component.attrValue may be undefined if component is from a mixin
var newValue = component.attrValue && component.attrValue[this.props.name];

// This will be triggered typically when the element is changed directly with element.setAttribute
if (newValue && newValue !== this.state.value) {
Expand Down
11 changes: 4 additions & 7 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,6 @@ Inspector.prototype = {
},

addHelper: (function() {
const geometry = new THREE.SphereBufferGeometry(2, 4, 2);
const material = new THREE.MeshBasicMaterial({
color: 0xff0000,
visible: false
});

return function(object) {
let helper;

Expand All @@ -132,7 +126,10 @@ Inspector.prototype = {
helper.visible = false;
this.sceneHelpers.add(helper);
this.helpers[object.uuid] = helper;
helper.update();
// SkeletonHelper doesn't have an update method
if (helper.update) {
helper.update();
}
};
})(),

Expand Down
2 changes: 1 addition & 1 deletion src/lib/viewport.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function Viewport(inspector) {

function updateHelpers(object) {
object.traverse(node => {
if (inspector.helpers[node.uuid]) {
if (inspector.helpers[node.uuid] && inspector.helpers[node.uuid].update) {
inspector.helpers[node.uuid].update();
}
});
Expand Down