Skip to content

Commit

Permalink
Merge pull request #5927 from mozilla/bit-ecs-debug-remove-entity
Browse files Browse the repository at this point in the history
Add button to remove bit-ecs entities
  • Loading branch information
keianhzo committed Feb 7, 2023
2 parents 0878fa5 + 30cf0e6 commit c8bd5da
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/react-components/debug-panel/ECSSidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { IconButton } from "../input/IconButton";
import { FormattedMessage } from "react-intl";

import * as bitComponents from "../../bit-components";
import { defineQuery, getEntityComponents } from "bitecs";
import { defineQuery, getEntityComponents, removeEntity } from "bitecs";

const bitComponentNames = new Map();
for (const [name, Component] of Object.entries(bitComponents)) {
Expand Down Expand Up @@ -127,6 +127,9 @@ function ObjectProperties({ obj }) {
<button onClick={() => console.log(obj)}>
<FormattedMessage id="ecs-sidebar.log-button" defaultMessage="log" />
</button>
<button onClick={() => removeEntity(APP.world, obj.eid)}>
<FormattedMessage id="ecs-sidebar.remove-button" defaultMessage="remove" />
</button>
</div>
<div className="content">{obj.eid && <EntityInfo eid={obj.eid} />}</div>
</div>
Expand Down
11 changes: 8 additions & 3 deletions src/react-components/debug-panel/ECSSidebar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
padding: 8px 0;
}

.object-list, .object-properties {
.object-list,
.object-properties {
height: 50%;
overflow: auto;
}
Expand All @@ -34,6 +35,7 @@
display: flex;
flex-direction: column;
.title {
border-top: 1px solid #6220d3;
border-bottom: 1px solid #6220d3;
padding: 10px;
display: flex;
Expand All @@ -43,6 +45,11 @@
text-align: center;
padding: 5px;
}

button {
margin-left: 5px;
margin-right: 5px;
}
}
.content {
padding: 10px;
Expand All @@ -65,7 +72,5 @@
font-size: 10px;
border-radius: 10px;
border: none;

}

}

0 comments on commit c8bd5da

Please sign in to comment.